Question Detail

COS 102 If staments Objective Question

Question

Consider the following code from the 'Classroom Activity': age = 14; if age >= 18: print("Adult"). What will be the output?
Options
A Adult
B 14
C Error
D No output
Correct Answer
Correct Answer

Option D is the correct answer.

Detailed Explanation

Page 16, 'Classroom Activity', case 2: age = 14; if age >= 18: print("Adult"). Since 14 is not greater than or equal to 18, the condition is false. The print statement inside the if block will not be executed, resulting in no output.

Hint

The condition 'age >= 18' needs to be true for 'Adult' to be printed.

Question Info