Enumerations

1

What is output of the this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        int i;
6.        
        enum month {
7.        
            JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
8.            
        };
9.        
        for (i = MAR; i <= NOV; i++)
10.        
            cout << i;
11.            
        return 0;
12.        
    }
A. 01234567891011
B. 123456789101112
C. 34567891011
D. 123456789

2

What is the output of this program?

  
1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        enum channel {star, sony, zee};
6.        
        enum symbol {hash, star};
7.        
        int i = 0;
8.        
        for (i = star; i <= zee; i++) {
9.        
            printf("%d ", i);
10.            
        }
11.        
        return 0;
12.        
    }

A. 012
B. 123
C. compile time error
D. runtime error

3

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    enum colour {
4.    
        green, red, blue, white, yellow, pink
5.        
    };
6.    
    int main()
7.    
    {
8.    
        cout << green<< red<< blue<< white<< yellow<< pink;
9.        
        return 0;
10.        
    }
A. 012345
B. 123456
C. compile time error
D. runtime error

4

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    enum test {
4.    
        A = 32, B, C
5.        
    };
6.    
    int main()
7.    
    {
8.    
        cout << A << B<< C;
9.        
        return 0;
10.        
    }
A. 323334
B. 323232
C. 323130
D. none of the mentioned

5

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    enum  cat {
4.    
        temp = 7
5.        
    };
6.    
    int main()
7.    
    {
8.    
        int age = 14;
9.        
        age /= temp;
10.        
        cout << "If you were cat, you would be " << age << endl;
11. 
        return 0;
12.        
    }

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