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

For Loop Execution Trace

Mark
< 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 is executed?

A

15

B

17

C

22

D

10

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.

AI Tutor

How can I help?

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