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

Consider the following code segment.

double[] arr = {9.05, 6.13, 4.20, 2.25, 7.28};
for (int i = arr.length - 1; i > 0; i--) {
    arr[i] = arr[i - 1];
}
for (double element : arr) {
    System.out.print(element + " ");
}

What output is produced when the code segment is executed?

A

9.05 6.13 4.20 2.25 7.28

B

9.05 9.05 6.13 4.20 2.25

C

7.28 2.25 4.20 6.13 9.05

D

6.13 4.20 2.25 7.28 7.28

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
#1kaisuki11 0m 00s 100
#2bommasam00012 0m 48s 42
#3singhris00011 2m 01s -21
#4y.seong202713 9m 10s -470
#5geethasailaja13 10m 02s -522
#6psak1201 21m 31s -1,301
Items per page:
10
1 – 6 of 6
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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