(A) Isolde John Greg Maria Heidi (B) Isolde John Greg Maria Heidi Qwerty ### (C) Qwerty Qwerty Qwerty Qwerty Qwerty (D) Program crashes during execution with an exception error. 25. Consider the following program segment. ArrayList<String> = new ArrayList<String>(); names.add("Isolde"); names.add("John"); names.add("Greg"); names.add("Maria"); names.add("Heidi"); for (String name : names) name = "Qwerty"; System.out.println(names); What is the output as a result of executing the program segment? ### (A) [Isolde, John, Greg, Maria, Heidi] (B) [Isolde, John, Greg, Maria, Heidi, Qwerty] (C) [Qwerty, Qwerty, Qwerty, Qwerty, Qwerty] (D) Program crashes during execution with an exception error. 26. Consider the following program segment. int[] list1 = {1,2,3,4,5,6,7,8,9}; ArrayList<Integer> list2 = new ArrayList<Integer>(); Which of the following code segments copies the elements from list1 into list2? I. for (int k = 0; k < k++) II. for (Integer number : list2) list1.add(number); III. for (int number : list1) (A) I only
(A) Isolde John Greg Maria Heidi (B) Isolde John Greg Maria Heidi Qwerty ### (C) Qwerty Qwerty Qwerty Qwerty Qwerty (D) Program crashes during execution with an exception error. 25. Consider the following program segment. ArrayList<String> = new ArrayList<String>(); names.add("Isolde"); names.add("John"); names.add("Greg"); names.add("Maria"); names.add("Heidi"); for (String name : names) name = "Qwerty"; System.out.println(names); What is the output as a result of executing the program segment? ### (A) [Isolde, John, Greg, Maria, Heidi] (B) [Isolde, John, Greg, Maria, Heidi, Qwerty] (C) [Qwerty, Qwerty, Qwerty, Qwerty, Qwerty] (D) Program crashes during execution with an exception error. 26. Consider the following program segment. int[] list1 = {1,2,3,4,5,6,7,8,9}; ArrayList<Integer> list2 = new ArrayList<Integer>(); Which of the following code segments copies the elements from list1 into list2? I. for (int k = 0; k < k++) II. for (Integer number : list2) list1.add(number); III. for (int number : list1) (A) I only
Test12Key.docx