Question 7 In the following code, what is the printout for list2? class Test { p
ID: 3566238 • Letter: Q
Question
Question 7
In the following code, what is the printout for list2?
class Test {
public static void main(String[] args) {
int[] list1 = {1, 2, 3};
int[] list2 = {1, 2, 3};
list2 = list1;
list1[0] = 0; list1[1] = 1; list2[2] = 2;
for (int i = 0; i < list2.length; i++)
System.out.print(list2[i] + " ");
}
}
0 1 3
Question 8
What is the minimum index value for the following array?
double[ ] values = new double[12];
Question 9
What is the output of the following code?
double[] myList = {1, 5, 5, 5, 5, 1};
double max = myList[0];
int indexOfMax = 0;
for (int i = 1; i < myList.length; i++) {
if (myList[i] >= max) {
max = myList[i];
indexOfMax = i;
}
}
System.out.println(indexOfMax);
0
Question 10
Given the following statement
- 1 2 3
- 1 1 1
- 0 1 2
0 1 3
Explanation / Answer
Output:
question 7:
Answer: 0 1 2
Question 8:
Answer: 0
Question: 9
Answer: 4
Question:10
Answer: 10
Question 11:
Answer:12
Question:12
Answer: 11
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.