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

What is printed when the following code segment is executed?

import java.util.ArrayList;
public class Test {
    public static void main(String[] args) {
       ArrayList<String> animals = new ArrayList<>();
       animals.add("Cat");
       animals.add("Dog");
       animals.add("Bird");
       animals.set(0, "Fish");
       animals.set(2, "Lizard");
       System.out.println(animals);
    }
}
A

[Fish, Lizard, Bird]

B

[Fish, Dog, Lizard]

C

[Fish, Dog, Bird]

D

[Cat, Dog, Lizard]

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
#1y.seong202722 1m 29s 111
#2ganguhas00011 0m 00s 100
#3kaisuki11 0m 00s 100
#4singh.advik1311 0m 21s 79
#5singhris00022 9m 22s -362
Items per page:
10
1 – 5 of 5
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy