Conditions & Loops · Question 1 · Easy

An if-elif ladder assigns a grade for 68 marks. What does it print?

marks = 68
if marks >= 75:
    print("A")
elif marks >= 60:
    print("B")
elif marks >= 50:
    print("C")
else:
    print("D")
  1. B
  2. A
  3. C
  4. B C
Answer and explanation

Answer: A. B

Explanation: The conditions are tested from the top and only the first true branch runs. 68 >= 75 is False and 68 >= 60 is True, so B is printed and the remaining branches are skipped, even though 68 >= 50 is also true.

Next: A for loop prints the numbers produced by range(3) on one line. What is the…

Practise conditions & loops

Try a fresh set of conditions & loops questions with an explanation after every answer, free and without signing up: Conditions & Loops practice. Or sit a full placement mock test.

More conditions & loops questions

More python practice

Functions & Scope · Comprehensions & Generators · Classes & Objects · Exceptions & Files · Built-ins & Standard Library · Variables, Types & Operators · Python Strings · Lists & Tuples

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge