AP Computer Science Ahardmcq1 pt

Which code reverses an ArrayList<Integer> list in place?

A.swap get(i) and get(size - 1 - i) with a temp through the first half
B.iterate forward calling add(get(i))
C.call list.reverse()
D.remove and re-add only the first element

Explanation

Core Concept

Mirror swaps reverse the list.

Correct Answer

Aswap get(i) and get(size - 1 - i) with a temp through the first half

More Unit 7: ArrayList practice questions

Try a random question →

Practice more AP Computer Science A questions with full explanations

Practice Unit 7: ArrayList Questions →