placeholder image to represent content

Variables, Errors and Input

Quiz by Paul Cummins

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
10 questions
Show answers
  • Q1
    What is the output of the following code: a = int(input('Enter a number: ')); print(a * 2) if a = 5?
    15
    10
    25
    5
    30s
  • Q2
    What will the output be when the following code is run: value = int(input('Enter a number: ')); print(value + 10) if value == 10?
    20
    30
    None
    10
    30s
  • Q3
    What will the following code output if the user inputs '7': a = int(input('Enter a number: ')); print(a + 5)?
    7
    12
    5
    10
    30s
  • Q4
    What will be the output of the following code if the input is '3': x = int(input('Enter a number: ')); print(x * x)?
    9
    6
    3
    12
    30s
  • Q5
    What is a valid variable name in Python?
    my_variable1
    my-variable
    1st_variable
    my variable
    30s
  • Q6
    What is the primary rule for naming variables in most programming languages?
    Variable names can include special characters like @ and #
    Variable names must be longer than 10 characters
    Variable names can start with a number
    Variable names should not contain spaces
    30s
  • Q7
    What is a runtime error?
    An error that is identified during the writing of the code
    An error that prevents the program from compiling
    An error due to incorrect spelling in the code
    An error that occurs while the program is running
    30s
  • Q8
    What is a syntax error?
    An error in the code that occurs when the rules of the programming language are not followed
    An error that occurs during the execution of the program
    A logical error that produces incorrect results
    An error related to the hardware of the computer
    30s
  • Q9
    Which of the following is an example of a syntax error?
    Forgetting a closing bracket in a function
    Using an undefined variable in the calculation
    Trying to access an element from an empty list
    Dividing a number by zero
    30s
  • Q10
    What happens when a syntax error is present in the code?
    The error is ignored and the program completes execution
    The program runs but produces incorrect output
    The program will not run until the error is fixed
    The program runs but crashes at some point
    30s

Teachers give this quiz to your class