1.
Q1: A game has a series of three levels, but you only get the bonus points if you pass all three levels on the first try. Assume the following declarations:
boolean level1, level2, level3;
The variables indicate whether the level was passed on the first try (
true
indicates yes, false
indicates no).Which of the following code segments will properly update the
points
variable?if (level1 && level2 && level3) points += 5;
if (level1 || level2 || level3) points += 5;
if (level1) points += 5; if (level2) points += 5; if (level3) points += 5;
- I only
- II only
- III only
- I and III
- II and III