Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Binder Early Objects
Quiz 7: Arrays and Array Lists
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 81
Multiple Choice
What is the output of the following statements? ArrayList<String> names = new ArrayList<String>() ; Names.add("Bob") ; Names.add(0, "Ann") ; Names.remove(1) ; Names.add("Cal") ; Names.set(2, "Tony") ; For (String s : names) { System.out.print(s + ", ") ; }
Question 82
Multiple Choice
What is the output of the following statements? ArrayList<String> names = new ArrayList<String>() ; Names.add("Bob") ; Names.add(0, "Ann") ; Names.remove(1) ; Names.add("Cal") ; Names.set(1, "Tony") ; For (String s : names) { System.out.print(s + ", ") ; }
Question 83
Multiple Choice
What is the output of the code snippet below? Int[][] arr = { { 1, 2, 3, 0 }, { 4, 5, 6, 0 }, { 0, 0, 0, 0 } }; Int val = arr[1][2] + arr[1][3]; System.out.println(val) ;
Question 84
Multiple Choice
Consider the following code snippet: Int[][] arr = { { 1, 2, 3, 0 }, { 4, 5, 6, 0 }, { 0, 0, 0, 0 } }; Int[][] arr2 = arr; System.out.println(arr2[2][1] + arr2[1][2]) ; What is the output of the given code snippet on execution?
Question 85
Multiple Choice
What is the output of the following code? Int[][] counts = { { 0, 0, 1 }, { 0, 1, 1, 2 }, { 0, 0, 1, 4, 5 }, { 0, 2 } }; System.out.println(counts[3].length) ;
Question 86
Multiple Choice
Which statement is true about the code snippet below? ArrayList<String> names = new ArrayList<String>() ; Names.add("John") ; Names.add("Jerry") ; ArrayList<String> friends = new ArrayList<String>(names) ; Friends.add("Harry") ;
Question 87
Multiple Choice
Consider the following code snippet, where the array lists contain elements that are stored in ascending order: ArrayList<Integer> list1 = new ArrayList<Integer>() ; ArrayList<Integer> list2 = new ArrayList<Integer>() ; ) . . Int count = 0; For (int i = 0; i < list1.size() && i < list2.size() ; i++) { If (list1.get(i) == list2.get(i) ) { Count++; } } Which one of the following descriptions is correct for the given code snippet?
Question 88
Multiple Choice
Which statement is true about the code snippet below? public static void main(String[] args) { Scanner in = new Scanner(System.in) ; ArrayList<Double> inputs = new ArrayList<Double>() ; Int ind = 0; While (in.hasNextDouble() ) { Inputs.set(ind, in.nextDouble() ) ; Ind++; } }
Question 89
Multiple Choice
Assume the following variable has been declared and given a value as shown: Int[] numbers = {9, 17, -4, 21 }; Which is the value of numbers.length?
Question 90
Multiple Choice
What is the output of the following statements? ArrayList<String> cityList = new ArrayList<String>() ; CityList.add("London") ; CityList.add("New York") ; CityList.add("Paris") ; CityList.add("Toronto") ; CityList.add("Hong Kong") ; CityList.add("Singapore") ; System.out.print(cityList.size() ) ; System.out.print(" " + cityList.contains("Toronto") ) ; System.out.print(" " + cityList.indexOf("New York") ) ; System.out.println(" " + cityList.isEmpty() ) ;
Question 91
Multiple Choice
When an integer literal is added to an array list declared as ArrayList<Integer>, Java performs:
Question 92
Multiple Choice
Assume the variable numbers has been declared to be an array that has at least one element. Which is the following represents the last element in numbers?
Question 93
Multiple Choice
Which one of the following is the correct code snippet for calculating the largest value in an integer array list aList?
Question 94
Multiple Choice
Which statement is true about the code snippet below? ArrayList<String> names = new ArrayList<String>() ; Names.add("John") ; Names.add("Jerry") ; ArrayList<String> friends = names; Friends.add("Harry") ;