| preferred AP College board partner for AP classes
AP Computer Science A/Unit 2: Using Objects
Start Practice TestPractice Test
Share
About Exam
medium Solved by 4 students
Object Reference Variable Aliasing
< Prev
Next >

Develop code to declare variables to store reference types.

Consider this code segment that declares and initializes reference variables:

ArrayList<String> list1 = new ArrayList<String>();
ArrayList<String> list2 = new ArrayList<String>();
ArrayList<String> list3 = list1;

list1.add("Java");
list2.add("Python");
list3.add("C++");

After this code executes, what is the size of the ArrayList referenced by list1?

A

1

B

3

C

2

D

0

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki12 0m 00s 90
#2ntgamja122 1m 50s 90
#3bommasam00013 1m 15s 5
#4richa.tuli01 0m 13s -23
#5jaimonjosh01 1m 40s -110
#6lsj0803092212 16m 26s -896
Items per page:
10
1 – 6 of 6

AI Tutor

How can I help?

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