Олимпиадный тренинг

Задача . 33726


Задача

Темы:
A teacher put three bonus questions on a test and awarded 5 extra points to anyone who answered all three bonus questions correctly and no extra points otherwise. Assume that the boolean variables bonusOne, bonusTwo, and bonusThree indicate whether a student has answered the particular question correctly. Each variable was assigned true if the answer was correct and false if the answer was incorrect.

Which of the following code segments will properly update the variable grade based on a student’s performance on the bonus questions?

1) 
if (bonusOne && bonusTwo && bonusThree)
    grade += 5;

2)
if (bonusOne || bonusTwo || bonusThree)
    grade += 5;

3)
if (bonusOne)
    grade += 5;
if (bonusTwo)
    grade += 5;
if (bonusThree)
    grade += 5;

A) I only
B) II only
C) III only
D) I and III
E) II and III

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя