MCQs
Total Questions : 50
| Page 1 of 5 pages
Answer: Option B. -> B,C
Option A is incorrect because array cannot be declared using Parentheses but square brackets.
Answer: Option A. -> 1, 2, 4
Answer: Option B. -> int [] a = {23,22,21,20,19};
Option B is the legal way to declare and initialize an array with five elements.
Answer: Option D. -> (B), (D) & (E)
Answer: Option C. -> (B) & (C)
Answer: Option A. -> 10 5
Arrays in java are implemented as objects, they contain an attribute that is length which contains
the number of elements that can be stored in the array.
Answer: Option B. -> 1 2 3
arr.length() is 5, so the loop is executed for three times.
Answer: Option D. -> 1
Array arr contains 10 elements. n contains 6 thus in next line n is given value 2 printing
arr[2]/2 i:e 2/2 = 1.
Answer: Option D. -> i i i i i i i i i i