Question 1 of 27 1.0 Points In an array, we can have a mix of integers and Strin
ID: 3786618 • Letter: Q
Question
Question 1 of 27 1.0 Points In an array, we can have a mix of integers and Strings. True False
Reset Selection
Question 2 of 27 1.0 Points When declaring an array, we use a set of square brackets. True False
Reset Selection
Question 3 of 27 1.0 Points We can instantiate an array by assigning values when the array is declared. True False
Reset Selection
Question 4 of 27 1.0 Points We cannot combine the declaration and instantiation of an array into one statement. True False
Reset Selection
Question 5 of 27 1.0 Points It is possible to have an array of objects. True False
Reset Selection
Question 6 of 27 1.0 Points Where is the error in the array declaration int [5] numbers; A. There is no error B. The square brackets should be empty C. There should be no space between int and [ D. It should be int numbers[5];
Reset Selection
Question 7 of 27 1.0 Points To access the element at index i of an array named grades, we use _________________ . A. grades B. grades[ i ] C. grades( i ) D. grades{ i }
Reset Selection
Question 8 of 27 1.0 Points If an array has n elements, then the last index is ______. A. n B. n+1 C. n-1
Reset Selection
Question 9 of 27 1.0 Points To access the number of elements in an array named grades, we use _________________ . A. grades B. grades.size() C. grades.length D. grades.length()
Reset Selection
Question 10 of 27 1.0 Points To process all the elements of an array, we use a loop. True False
Reset Selection
Question 11 of 27 1.0 Points To compare two arrays for equality, you call the equals method with the first array and pass the second array as the argument. True False
Reset Selection
Question 12 of 27 1.0 Points An array can be an instance variable of a class. True False
Reset Selection
Question 13 of 27 1.0 Points A method cannot return an array. True False
Reset Selection
Question 14 of 27 1.0 Points We can pass an array parameter to a method. True False
Reset Selection
Question 15 of 27 1.0 Points When declaring a two-dimensional array, we use two sets of square brackets. True False
Reset Selection
Question 16 of 27 1.0 Points We can instantiate a two-dimensional array by assigning values when the array is declared.
True False
Reset Selection Question 17 of 27 1.0 Points In a two-dimensional array, the number of elements in each row must be the same for every row. True False
Reset Selection
Question 18 of 27 1.0 Points We cannot combine the declaration and instantiation of a multidimensional array. True False
Reset Selection
Question 19 of 27 1.0 Points To process all the elements of a two-dimensional array, we use a double loop True False
Reset Selection
Question 20 of 27 1.0 Points We can pass a two-dimensional array parameter to a method. True False
Reset Selection
Question 21 of 27 1.0 Points A method cannot return a two-dimensional array parameter. True False
Reset Selection
Question 22 of 27 1.0 Points Three-dimensional arrays are not allowed in Java. True False
Reset Selection
Question 23 of 27 1.0 Points We can store primitive data types in an ArrayList object. True False
Reset Selection
Question 24 of 27 1.0 Points To access the element at row i and column j of a two-dimensional array named grades, we use _________________ . A. grades B. grades[ i ][ j ] C. grades[ j ][ i ] D. grades( i )( j ) E. grades( j )( i )
Reset Selection
Question 25 of 27 1.0 Points To access the number of rows in a two-dimensional array named grades, we use _________________ . A. grades B. grades.size( ) C. grades.size D. D. grades.length( ) E. grades.length
Reset Selection
Question 26 of 27 1.0 Points To access the number of columns in row i of a two-dimensional array named grades, we use _________________ . A. grades.length B. grades[ i ].length C. grades( i ).length D. grades( i ).size E. grades{ i }.length
Reset Selection
Question 27 of 27 1.0 Points When processing all the elements of row i of a two-dimensional array named grades using a for loop with variable j, what is the condition of the for loop? _________________ . A. j < length B. j < grades.length C. j <= grades.length D. j < grades[i].length E. j <= grades[i].length
Reset Selection
Explanation / Answer
Answering only first six questions:
1.False.
Explanation:We cannot have more than one datatype in a single array.
2.True
Explanation:While declaring array we specify the no.of elements the array should contain in square brackets.
3.True
Explanation:While declaring array we can initialize them.
Ex:int arr[4]={1,2,3,4};
4.False
Explanation:We can declare and initialize array in one statement as in previous example.
5.True.
Explanation:We can have an array of objects.suppose for a class abc,we can declare array of objects as
abc a[10];
6.d
Explanation:We declare array by following way.
datatype name_of_array [no_of_elements].
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.