Question: Question 1 What data structure might you use to store a the name of Supreme Court Justices? The name of the justices can change, but
Question 1
What data structure might you use to store a the name of Supreme Court Justices? The name of the justices can change, but there will always be 9 justices at a time. Pick the best choice.
Question 1 options:
| ArrayList | |
| 2D Array | |
| Binary Search Tree | |
| array |
Question 2
How do you create an array of 10 Strings?
Question 2 options:
| String[] myarray = new String[11]; | |
| String[] myarray = new String[10]; | |
| String myarray = new String[10]; | |
| String myarray = new String[11]; |
Question 3
Given the following array declaration:
int[] myarray = new int[variable];
How do you determine how many elements are in myarray?
Question 3 options:
| myarray.length | |
| myarray.size | |
| myarray.size() | |
| myarray.length() |
Question 4
The number of elements in an array can change.
Question 4 options:
| True | |
| False |
Question 5
What is the output of this code?
int[] myarray = {0,10,20,30,40,50}; for(int i = 0; i < myarray.length; i = i + 2){ System.out.print(" " + myarray[i]) } Question 5 options:
| 0 1 2 3 4 5 | |
| 0 2 4 | |
| 0 10 20 30 40 50 | |
| 0 20 40 |
Question 6
Which of the following is true of both arrays and ArrayLists?
Question 6 options:
| Both arrays and ArrayLists are objects. | |
| Neither arrays nor ArrayLists are object. | |
| Arrays are objects, but ArrayLists are not. | |
| ArrayLists are objects, but arrays are not. |
Question 7
The elements in an ArrayList are mutable.
Question 7 options:
| True | |
| False |
Question 8
How do you create an ArrayList of ints?
Question 8 options:
ArrayList | |
| None of the above, you can not make an ArrayList of ints. | |
List | |
int[] list = new int[]; | |
ArrayList |
Question 9
If implementing the List interface, which of the following must you implement?
Question 9 options:
| get | |
| only get and contains | |
| only contains and add | |
| contains, add, and get | |
| contains | |
| add |
Question 10
ArrayList implements the List interface.
Question 10 options:
| True | |
| False |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
