COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
I only
|
|
I and II only
|
|
I, II, and III
|
|
I and III
|
Detailed explanation-1: -Which of the following correctly declares an array? a)int array[10]; b)int array; c)array10; d)array array[10]; Correct answer is option ‘A’.
Detailed explanation-2: -Which of the following choices is the correct syntax for declaring/initializing an array of ten integers? int[] a = new int[10];
Detailed explanation-3: -To create an array, define the data type (like int ) and specify the name of the array followed by square brackets []. To insert values to it, use a comma-separated list, inside curly braces: int myNumbers[] = 25, 50, 75, 100; We have now created a variable that holds an array of four integers.
Detailed explanation-4: -2. What is the index number of the last element of an array with 9 elements? Explanation: Because the first element always starts at 0. So it is on 8 position.