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 61
Multiple Choice
Consider the following code snippet: ArrayList<Integer> arrList = new ArrayList<Integer>() ; For (int i = 0; i < arrList.size() ; i++) { ArrList.add(i + 3) ; } What value is stored in the element of the array list at index 0?
Question 62
Multiple Choice
Consider the following code snippet: ArrayList<Double> somedata = new ArrayList<Double>() ; Somedata.add(10.5) ; What is the size of the array list somedata after the given code snippet is executed?
Question 63
Multiple Choice
Your program needs to store a sequence of integers of unknown length. Which of the following is most suitable to use?
Question 64
Multiple Choice
What is the value of the cnt variable after the execution of the code snippet below? ArrayList<Integer> somenum = new ArrayList<Integer>() ; Somenum.add(1) ; Somenum.add(2) ; Somenum.add(1) ; Int cnt = 0; For (int index = 0; index < somenum.size() ; index++) { If (somenum.get(index) % 2 == 0) { Cnt++; } }
Question 65
Multiple Choice
What is the result of the following definition of an array list? ArrayList<Double> points;
Question 66
Multiple Choice
Consider the following code snippet: Public static void check(ArrayList<Integer> chknum1) { Int cnt = 0; For(int i = 0; i < chknum1.size() ; i++) { If(chknum1.get(i) == 0) { Cnt++; } } System.out.println("The total 0 values in the list are: " + cnt) ; } Which one of the following is true about the check method in the given code snippet?
Question 67
Multiple Choice
Consider the following line of code for calling a method named func1: Func1(listData, varData) ; Which one of the following method headers is valid for func1, where listData is an integer array list and varData is an integer variable?
Question 68
Multiple Choice
What is the value of myArray[1][2] after this code snippet is executed? Int count = 0; Int[][] myArray = new int[4][5]; For (int i = 0; i < 5; i++) { For (int j = 0; j < 4; j++) { MyArray[j][i] = count; Count++; } }
Question 69
Multiple Choice
Consider the following code snippet: Int[][] arr = { { 1, 2, 3 }, { 4, 5, 6 } }; Int val = arr[0][2] + arr[1][2]; System.out.println(val) ; What is the output of the given code snippet on execution?
Question 70
Multiple Choice
Which one of the following is the correct code snippet for calculating the largest value in an integer array list arrList of size 10?
Question 71
Multiple Choice
What is the output of the following code snippet? ArrayList<Integer> num; Num) add(4) ; System.out.println(num.size() ) ;
Question 72
Multiple Choice
Which one of the following is a correct declaration for a method named passAList that has as arguments an array list myList of size 10 and an integer array intArr of size 20, and that modifies the contents of myList and intArr?