Question Detail

COS 102 If staments Objective Question

Question

What will be the output of the following code snippet from the 'Classroom Activity'?
Options
A Adult
B No output
Correct Answer
C Error
D 14
Correct Answer

Option B is the correct answer.

Detailed Explanation

Page 16, 'Classroom Activity' lists: '2. age = 14; if age >= 18: print("Adult")'. Here, age is 14. The condition age >= 18 (14 >= 18) is False. Since there is no else block, nothing is printed.

Hint

Check if the condition for printing 'Adult' is met given the value of 'age'.

Question Info