ProgrammingHardGATE CS · Campus placements
enum { A, B = 5, C }; What is the value of C?
- A. 6
- B. 5
- C. 2
- D. 7
Correct answer: A. 6
An enumerator without an explicit value takes the previous value plus one, so C is 5 + 1 = 6. A and B hold 0 and 5.
More C Programming questions
- How many integers from 1 to 100 are divisible by 3 or by 5?
- How many two-digit decimal numbers have digits summing to 9?
- The sorted array is {1, 3, 5, 7, 7, 9}. What is the index of the first element greater than 7?
- int n = 0; reading the expression as C does: What is the value of ~5 + 1?
- int n = 0; while (n++ < 3) ; What is n after the loop?
- unsigned char x = 100; x += 200; What is x?