| preferred AP College board partner for AP classes
AP Computer Science A/Unit 7: ArrayList
Start Practice TestPractice Test
About Exam
medium Solved by 14 students
ArrayList Method Execution
< Prev
Next >

Consider the following code segment.

ArrayList<String> numbers = new ArrayList<String>();
numbers.add("one");
numbers.add("two");
numbers.add(0, "three");
numbers.set(2, "four");
numbers.add("five");
numbers.remove(1);

Which of the following represents the contents of the numbers ArrayList after the code segment is executed?

A

[“one”, “four”, “five”]

B

[“one”, “two”, “three”, “four”, “five”]

C

[“three”, “four”, “five”]

D

[“three”, “two”, “five”]

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1upadhgau00011 0m 00s 100
#2familarahimli11 0m 00s 100
#3kaisuki11 0m 00s 100
#4y.seong202711 0m 40s 60
#5bommasam00011 0m 44s 56
#6geethasailaja12 0m 54s 36
#7psak1211 1m 46s -6
#8singhris00013 6m 53s -333
Items per page:
10
1 – 8 of 8
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy