18 questions · untimed

Python first steps: Printing and error messages

Pick an option and check it. The explanation shows after each answer. Take as long as you like; nothing is timed and nothing is sent.

18 questions

Question 1 · easy

What does this program print?

print("Masala chai")
print(20)

Question 2 · easy

Ravi prints his score. What does this program print?

print("Runs:", 87)

Question 3 · easy

In a Python program, what happens to a line that starts with #?

Question 4 · easy

Nisha runs a program and a long error message fills the screen. Which part should she read first?

Question 5 · easy

What does this program print?

print("Sameer")
# he batted at number 3
print(56)

Question 6 · easy

Arjun runs this program. Which error does Python show?

pritn("Happy Diwali")

Question 7 · medium

A restaurant prints a short bill. What does this program print?

print("Bill for table", 4)
print("Dosa", 2, "plates")
print("Total", "₹", 140)

Question 8 · medium

What does this program print?

print("100")
print(100)
print("Pin code", "751001")

Question 9 · medium

Which of these lines stops with a NameError?

Question 10 · medium

Priya runs this program. What happens?

print("Asha", 91)
print("Ravi", 78)
print("Priya", 85))

Question 11 · medium

Python stops with a SyntaxError on line 2. Sameer wants the screen to show Biscuit: 5. Compare line 2 with line 1, which works. Which new line 2 fixes it?

print("Chai:", 12)
print("Biscuit:" 5)

Question 12 · medium

Asha runs this program in Python 3.12. Which line does the error message name?

print("Auto fare:", 40
print("Bus fare:", 15)

Question 13 · hard

Nisha runs this program. What does she see?

print("Platform", 2)
print("Train to", "Bhubaneswar")
print(Departs, "at 10")
print("Have a safe journey")

Question 14 · hard

What does this program print?

print("Tea, coffee", "and", 2, "samosas")

Question 15 · hard

Ravi writes his chai recipe as a program. What does it print?

print("Step 1: boil water")
# print("Step 2: add tea leaves")
print("Step 3: add milk")  # and sugar
#print("Step 4: serve")

Question 16 · easy

A canteen board in Bhubaneswar is printed by this program. What does it print?

print("Today's special:", "Pakhala")
print('Republic', "Day")

Question 17 · medium

Priya prints her train details. What does this program print?

print("Platform #3")  # Puri Express
print("Coach", "#B2")
# print("Seat 41")

Question 18 · hard

Nisha runs this program. What does she see?

print("Match day")
print(Toss)
print("Overs:", 20

Next: Values, operators and variables