
Java ArrayList
Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Wendy Dyer
Used 10+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to set the second value in an array called nums to 5?
nums[1] = 5;
nums[5] = 1;
nums[0] = 5;
nums[5] = 0;
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which index is the last element in a list called nums at?
nums.size- 1
nums.size()
nums.size
nums.size() - 1
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to add 2 between the 1 and 3 in the following list nums =[1,3,4]?
nums.add(0, 2);
nums.add(2, 1);
nums.add(1, 2);
nums.add(2, 0);
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will print when the following code executes?
List<Integer> list1 = new ArrayList<Integer>();
list1.add(new Integer(1));
list1.add(new Integer(2));
list1.add(new Integer(3));
list1.remove(1);
System.out.println(list1);
[1, 2]
[1, 3]
[1, 1]
[2, 3]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to get the second value in a list called nums?
nums.get(0)
nums.get(2)
nums.get(3)
nums.get(1)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is printed as a result of executing the following code segment?
List<Integer> list1 = new ArrayList<Integer>();
list1.add(new Integer(1));
list1.add(new Integer(2));
list1.add(new Integer(3));
list1.set(2, new Integer(4));
list1.add(2, new Integer(5));
list1.add(new Integer(6));
System.out.println(list1);
[1, 2, 5, 4, 6]
[1, 2, 3, 4, 6]
[1, 2, 4, 5, 6]
[1, 2, 3, 4, 5, 6]
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to set the second value in a list called nums to 5?
nums.add(1, 5);
nums.add(2, 5);
nums.set(1, 5);
nums.set(2, 5);
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Cyber Security
Quiz
•
1st - 10th Grade
14 questions
BÀI 14- THUẬT TOÁN TÌM KIẾM TUẦN TỰ
Quiz
•
6th Grade - University
10 questions
Tin học 9 Bài 7: Phần mềm trình chiếu
Quiz
•
9th Grade
10 questions
Inspire - AI Trivia
Quiz
•
11th Grade
10 questions
Empowerment Technologies Quiz 2
Quiz
•
11th Grade
15 questions
PRUEBA CORTA I - SISTEMA E INSTALACIÓN DE SOFTWARE I - U4
Quiz
•
9th - 12th Grade
10 questions
Unit 4 Advanced AP CSP
Quiz
•
9th - 12th Grade
12 questions
Spreadsheet Starter
Quiz
•
7th Grade - University
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade
