Hands-on Computer Science
My learning DE

Quiz10 min

Quiz: Decisions

Eight questions on truth values, comparisons, and, or and not and on decisions with if, elif and else in Python.

Topics:Programming with Python

What type does the value of 5 > 3 have?

  • int
  • str
  • bool

What is the difference between x = 5 and x == 5?

  • x = 5 gives x the value 5, x == 5 asks whether x is equal to 5.
  • x = 5 asks whether x is equal to 5, x == 5 gives x the value 5.
  • There is none, both ways of writing mean the same.

What does print("Yes" == "yes") print?

  • True
  • False
  • An error message, because texts cannot be compared

What does this program print?

age = 15
student = True
print(age >= 18 or student, not student)
  • True False
  • False False
  • True True
  • False True

Which conditions are true if number = 12? (several are right)

  • number % 2 == 0
  • number > 12
  • 10 < number and number < 20
  • not number == 12
  • number in [4, 8, 12]

What does this program print?

temperature = 25

if temperature >= 10:
    print("mild")
elif temperature >= 20:
    print("warm")
else:
    print("cold")
  • mild
  • warm
  • mild and below it warm
  • cold

What does this program print?

answer = "no"

if answer == "yes" or "y":
    print("Agreed.")
else:
    print("Declined.")
  • Agreed.
  • Declined.
  • An error message

What does this program print?

def size(number):
    if number > 10:
        return "large"
    if number > 5:
        return "medium"
    return "small"


print(size(8), size(20))
  • medium large
  • medium medium
  • small large
  • large medium

Download with answers: CSV Anki

Back
More on this
Details
Level
Beginner
Modules
Digitization and Programming
In learning paths
Python for beginners
Code
3442
Updated
1 November 2026
Status
published

    A four-digit code takes you straight to the item.