Array in C++ Array in C++ MCQ Details
MCQ Practice Single Best Answer Topic: Array in C++

Q How many elements does the array int x[20]; contain?

Question ID
#24493
Subchapter
Array in C++
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 19
  • B 21
  • C 20
  • D 0
Correct 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.

Share This Question

Share this MCQ with your friends or study group.