Q: How many elements does the array int x[20]; contain?
C
Answer:
C
Explanation:
The declaration:
int x[20];
creates an array that can store 20 elements.
-
The number inside the brackets [20] specifies the total number of elements
-
Array indexing starts from 0
-
Valid indices range from 0 to 19
So even though the last index is 19, the array still contains 20 elements.
Correct Answer: C) 20
Description:
x[20] means the array size is 20, not 19.
Related Topic:
Share Above MCQ