score = 45
if score >= 80:
print("A")
elif score >= 60:
print("B")
else:
print("C")Predict the output when Prasath runs this code with score = 45?
A
B
C
No output
Show answer & explanationAnswer
Correct answer
C
Explanation
The score 45 fails the first condition (>=80) and the second condition (>=60), so the else block executes and prints 'C'.
Written by ExamHoot EditorialPublished · Updated
All 40 Conditional Statements: if, elif, else questions
- 1.What is the purpose of the if statement in Python?
- 2.What does the elif keyword stand for in Python conditional statements?
- 3.What will be the output of the following code snippet?
- 4.How many times can you use elif in a single if-elif-else chain?
- 5.What is the output when Hari runs the following code?
- 6.What is the difference between = and == in conditional statements?
- 7.What will Prasath see as output from this code?
- 8.What is the correct syntax for an if statement in Python?
- 9.What will be printed when Ravi executes the following code?
- 10.What does the else statement do in a conditional chain?
- 11.What is the output of the following code executed by Ananya?
- 12.Which operator is used to check if two values are equal in a conditional statement?
- 13.What will Deepak observe as the output of this code?
- 14.What is the purpose of indentation in Python conditional statements?
- 15.What will be the output when Neha runs the following code?
- 16.What will be the output when Hari executes the following code with input value 15?
- 17.What is the purpose of the elif statement in Python conditional logic?
- 18.Predict the output when Prasath runs this code with score = 45?
- 19.What will be the output of this code snippet when Vikram sets x = 10?
- 20.How does the else clause function in a conditional statement structure?
- 21.What will this code print when Arjun provides the input 'cold'?
- 22.Identify what will be the output when Deepak executes this code with num = 0?
- 23.What is the correct syntax for writing multiple conditions in a single if statement?
- 24.What will be printed when Ravi runs this code with temperature = 25?
- 25.Predict the output when Sneha executes this code with age = 20 and has_license = True?
- 26.What will be the output when Karthik executes this nested conditional code with x = 5 and y = 10?
- 27.Debug the logic error in Aditya's code that determines the largest of three numbers a = 10, b = 20, c = 15?
- 28.What is the output when Meera runs this code with marks = 85 and attendance = 80?
- 29.Predict what will be printed when Rohit executes this code with day = 'Saturday'?
- 30.What does this code print when Ananya executes it with num = 7 and is_even = False?
- 31.Identify the output when Naveen runs this code with score = 92 and bonus = True?
- 32.What will be the output when Chirag executes this code with x = 15, y = 20, z = 10?
- 33.What will this code print when Harini executes it with age = 17 and has_permission = True?
- 34.Predict the output when Sanjay executes this code with price = 500 and is_member = True?
- 35.What will be the output when Pooja executes this code with status = 'active' and credit_score = 750?
- 36.What will be the output of the following code when Hari enters the value 15 for age?
- 37.Predict the output of the following code when Prasath runs it with the input value 25?
- 38.What is the logical difference between using multiple elif statements versus nested if statements in conditional logic?
- 39.Find the bug in Vikram's code and predict what will happen when he enters 50 as the temperature?
- 40.Predict the output when Ananya executes the following code with input value 0?
