Page 590 - AP Computer Science A, 7th edition
P. 590
(A) I only
(B) II only
(C) III only
(D) II and III only (E) I, II, and III
10. Refer to the following program segment. for (int n = 50; n > 0; n = n / 2)
System.out.println(n);
How many lines of output will this segment produce?
(A) 50 (B) 49 (C) 7 (D) 6 (E) 5
11. Let list be an ArrayList<String> containing only these elements:
“John”, “Mary”, “Harry”, “Luis”
Which of the following statements will cause an error to occur?
I II
III
list.set(2, “6”); list.add(4, “Pat”); String s = list.get(4);
(A) I only
(B) II only
(C) III only
(D) II and III only (E) I, II, and III
12. Consider the following static method.