| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
Share
About Exam
medium
Java While Loop Logic
< Prev
Next >

What will val3 contain after the code segment is executed?

Consider the following code segment.

int val1 = 2, val2 = 22, val3 = 78;
while (val2 % val1 == 0 || val2 % 3 == 0)
{
   val3++;
   val2--;
}

What will val3 contain after the code segment is executed?

A

79

B

None of the above

C

77

D

80

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

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

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