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 Late Objects
Quiz 6: Arrays and Arraylists
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 81
Multiple Choice
When an integer literal is added to an array list declared as ArrayList<Integer>, Java performs:
Question 82
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 83
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) ; Names.add("Harry") ;
Question 84
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 85
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 86
Multiple Choice
What is true about the following code snippet? Public static double[] fillWithRandomNumbers(double[] values) { Double[] numbers = new double[values.length]; For (int i = 0; i < numbers.length; i++) { Numbers[i] = Math.random() ; } Return Arrays.copyOf(numbers, numbers.length) ; } Public static void main(String[] args) { Double[] num = new double[20]; Num = fillWithRandomNumbers(num) ; }
Question 87
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 88
Multiple Choice
How many elements can be stored in a two-dimensional 5 by 6 array?
Question 89
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 90
Multiple Choice
Consider the following code snippet: Public static void main(String[] args) { ArrayList<String> names = new ArrayList<String>() ; Names.add("John") ; Names.add("Jerry") ; Names.add("Janet") ; ArrayList<String> names = reverse(names) ; } Public static ArrayList<String> reverse(ArrayList<String> names) { ArrayList<String> result = new ArrayList<String>() ; For (int i = names.size() - 1; i >= 0; i--) { Result.add(names.get(i) ) ; } Return <String>result; } Which statement is true after the main method is executed?
Question 91
Multiple Choice
What is the output of the code snippet below? Int[][] numarray = { { 8, 7, 6 }, { 0, 0, 0 } }; System.out.print(numarray[0][0]) ; System.out.print(numarray[1][0]) ;
Question 92
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") ;