Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 6: Array
Start Practice TestPractice Test
About Exam
hard Solved by 2 students

Array Indexing with Pre-Increment

Mark
< Prev
Next >

Consider the following code segment. What is printed when it is executed?

public class ComplexIndex {
    public static void main(String[] args) {
        int[] values = {3, 6, 9, 12};
        int index = 1;
        values[index] = values[index] + values[++index];
        System.out.println(values[1]);
    }
}
A

9

B

18

C

12

D

15

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1lightingstrikes134222 0m 00s 200
#2j4949794911 0m 00s 100
#3busemagngr01 0m 38s -48
#4demosolasis101 0m 56s -66
Items per page:
10
1 – 4 of 4

AI Tutor

How can I help?

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