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

Which of the following represents the contents of numbers after the code segment has been executed?
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 numbers after the code segment has been executed?

A

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

B

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

C

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

D

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

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2familarahimli11 0m 00s 100
#3upadhgau00011 0m 00s 100
#4y.seong202711 0m 40s 60
#5geethasailaja12 0m 54s 36
#6psak1211 1m 46s -6
#7singhris00013 6m 53s -333
APFIVE © 2020.
Email: [email protected]|Privacy Policy