1. Identify the correct option.
a) enumerators are contants
b) enumerators are user defined types
c) enumerators are unchangables.
d) character
2. In which type does the enumerators are stored by the compiler?
a) string
b) integer
c) float
d) none of the mentioned
3. To which of these enumerators can be assigned?
a) integer
b) negative
c) enumerator
d) all of the mentioned
4. What will happen when defining the enumerated type?
a) it will not allocate memory
b) it will allocate memory
c) it will not allocate memory to its variables
d) none of the mentioned
5. Which variable does equals in size with enum variable?
a) int variable
b) float variable
c) string variable
d) none of the mentioned
6. What is the output of this program?
a) If you were cat, you would be 5
b) If you were cat, you would be 2
c) If you were cat, you would be 7
d) none of the mentioned
7. What is the output of this program?
a) 323334
b) 323232
c) 323130
d) none of the mentioned
8. What is the output of this program?
a) 0123456
b) 1111111
c) compile time error
d) runtime error
9. What is the output of this program?
a) 012
b) 123
c) compile time error
d) runtime error
10. What is output of the this program?
a) 01234567891011
b) 123456789101112
c) 34567891011
d) 123456789
a) enumerators are contants
b) enumerators are user defined types
c) enumerators are unchangables.
d) character
Answer:b
2. In which type does the enumerators are stored by the compiler?
a) string
b) integer
c) float
d) none of the mentioned
Answer:b
3. To which of these enumerators can be assigned?
a) integer
b) negative
c) enumerator
d) all of the mentioned
Answer:d
4. What will happen when defining the enumerated type?
a) it will not allocate memory
b) it will allocate memory
c) it will not allocate memory to its variables
d) none of the mentioned
Answer:a
5. Which variable does equals in size with enum variable?
a) int variable
b) float variable
c) string variable
d) none of the mentioned
Answer:a
6. What is the output of this program?
#include <iostream>
using namespace std;
enum cat {
temp = 7
};
int main()
{
int age = 14;
age /= temp;
cout << "If you were cat, you would be " << age << endl;
return 0;
}
b) If you were cat, you would be 2
c) If you were cat, you would be 7
d) none of the mentioned
Answer:b
7. What is the output of this program?
#include <iostream>
using namespace std;
enum test {
A = 32, B, C
};
int main()
{
cout << A << B<< C;
return 0;
}
b) 323232
c) 323130
d) none of the mentioned
Answer:a
8. What is the output of this program?
#include <iostream>
using namespace std;
enum colour {
green, red, blue, white, yellow, pink
};
int main()
{
cout << green<< red<< blue<< white<< yellow<< pink;
return 0;
}
b) 1111111
c) compile time error
d) runtime error
Answer:a
9. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
enum channel {star, sony, zee};
enum symbol {hash, star};
int i = 0;
for (i = star; i <= zee; i++) {
printf("%d ", i);
}
return 0;
}
b) 123
c) compile time error
d) runtime error
Answer:c
10. What is output of the this program?
#include <iostream>
using namespace std;
int main()
{
int i;
enum month {
JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
};
for (i = MAR; i <= NOV; i++)
cout << i;
return 0;
}
b) 123456789101112
c) 34567891011
d) 123456789
Answer:c