ICSE Class 10 Computer Applications Question 20 of 30

Solved Sample Paper 3 — Question 20

Back to all questions
20
Question

Question 1(xx)

Correct statement to declare an integer array of 10 elements.

  1. int[ ] arr = new int[10];
  2. int arr;
  3. int arr (10);
  4. int ( ) arr = new int (10);
Answer

int[ ] arr = new int[10];

Reason — The correct syntax to declare an array is as follows:

datatype[ ] array_name = new datatype[size];

The statement int[ ] arr = new int[10]; follows the correct syntax of array declaration.