| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
About Exam
hard
Java For Loop Execution Trace
< Prev
Next >

Consider the following code segment:

int x = 10;
int y = 3;
boolean b = true;
for (int i = 0; i < 15; i += 5)
{
   x = x + y;
   b = (x % y == 2);
   if (!b)
   {
      y++;
      i += 5; 
   }
}

What is the value of x after the code segment executes?

A

15

B

17

C

10

D

22

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

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

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