1. Home
  2. Federal Board of Intermediate and Secondary Education (FBISE)
  3. Computer Science FBISE Class 10
  4. In an array declared as int a[5];, the valid indices are:

Added 16 Nov 2026

In an array declared as int a[5];, the valid indices are:

  1. 1 to 5
  2. 0 to 4 Correct answer
  3. 0 to 5
  4. 1 to 4

Correct answer

B. 0 to 4

11 views

MCQSEXAM

Explanation

Array indices start at 0, so a 5-element array has indices 0, 1, 2, 3, 4. Using index 5 would go out of bounds and cause undefined behaviour. This off-by-one error is very common.

Reference

Asked in: Matric,FBISE

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Computer Science FBISE Class 10 MCQs

Practise all Computer Science FBISE Class 10 MCQs

Similar MCQs