. In an array, every element has the same a. subscript b. data type c. memory lo
ID: 3708384 • Letter: #
Question
. In an array, every element has the same a. subscript b. data type c. memory location d. all of the above 2. The operator used to create objects is C. new d. create 3. Which of the following correctly declares an array of six integers? a. int array[6] b. int[] array6; C. int[6] array; d. int array - new int [6] 4. The value placed within square brackets after an array name IS a. a subscript b. an index c. always an integer d. all of these 5. If you define an array to contain ten elements, then the highest array subscript you can use is b. 10 C. 9 d. 8Explanation / Answer
Answers:
1. b
Array is for holding elements of same data type. So, every element has the same data type.
2. c
In c++ or java, "new" operator is used to create an object.
3. a
The syntax for declaring array with size N is
<datatype> name_of_array [<size>] ;
So, based on the syntax, the below one is valid
int array[6];
4. d
To access the element of an array, need to specify subscript (index or expression) of integer type within the square brackets.
subscript can be index or expression (evalutation gives integer value) and the type of subscript should be integer. So all the options are valid answers.
5. c
Array of N elements can indexed from 0 to (N-1). Therefore, array of 10 ten elements can be indexed of 0-9. The highiest array subscript will be 9.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.