MCQ Single Best Answer Easy

QA single dimensional array has 50 elements, which of the following is the correct statement to initialize the last element to 100.

ID: #24264 ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER 53 views
Question Info
#24264Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A x[51] = 100
  • B x[48] = 100
  • C x[49] = 100
  • D x[50] = 100
Correct Answer: Option C

Explanation

Given:

  • A single-dimensional array has 50 elements.

  • In Java, array indexing starts from 0.


Step 1: Determine last index

  • First element → x[0]

  • Second element → x[1]

  • Last (50th) element → x[49]

Remember: last index = total elements − 1


Step 2: Match with options

(a) x[51] = 100 → ❌ Out of bounds
(b) x[48] = 100 → ❌ 49th element, not last
(c) x[49] = 100 → ✅ Correct, last element
(d) x[50] = 100 → ❌ Out of bounds


Answer: (c) x[49] = 100

Share This Question

Challenge a friend or share with your study group.