placeholder image to represent content

Python

Quiz by Hardik Vedikin

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

Correct quiz answers unlock more play!

New Quizalize solo game modes
60 questions
Show answers
  • Q1
    Which of the following is a built-in data type in Python?
    dictionary
    list
    array
    tuple
    30s
  • Q2
    What does the 'len()' function do in Python?
    returns the sum of all elements in a list
    returns the length of a string, list, or tuple
    checks if a value exists in a dictionary
    converts a string to lowercase
    30s
  • Q3
    What is the output of the following code snippet?x = 5y = 2result = x // yprint(result)
    5
    2.0
    2.5
    2
    30s
  • Q4
    What is the result of the following expression?7 + 3 * 2 - 4
    16
    8
    10
    12
    30s
  • Q5
    What is the correct way to open a file named 'data.txt' in read mode in Python?
    open('data.txt', 'r')
    open(file='data.txt', mode='r')
    open(file='data.txt', mode='read')
    open('data.txt')
    30s
  • Q6
    What is the output of the following code snippet?x = [1, 2, 3]print(x[-1])
    1
    3
    2
    IndexError: list index out of range
    30s
  • Q7
    Which of the following is the correct way to comment a single line of code in Python?
    // This is a comment
    /* This is a comment */
    # This is a comment
    <!-- This is a comment -->
    30s
  • Q8
    What is the correct syntax for defining a function in Python?
    function my_function():
    def my_function():
    def my_function():
    def my_function::
    30s
  • Q9
    Which of the following is a valid way to check if two variables refer to the same object in Python?
    variable1 == variable2
    variable1 is not variable2
    variable1 is variable2
    variable1 != variable2
    30s
  • Q10
    What is the correct way to check if a key exists in a dictionary in Python?
    key not in my_dict
    key in my_dict
    my_dict[key]
    my_dict.get(key)
    30s
  • Q11
    Which of the following is a built-in function in Python?
    print()
    System.out.println()
    document.write()
    console.log()
    30s
  • Q12
    What is the correct syntax for declaring a variable in Python?
    5 = x
    x = 5
    x := 5
    variable x = 5
    30s
  • Q13
    What does the 'len()' function do in Python?
    Return the length of a sequence
    Sort a dictionary
    Generate a random number
    Append elements to a list
    30s
  • Q14
    What is the output of the following code?x = (1, 2, 3)print(x[1])
    2
    TypeError
    1
    3
    30s
  • Q15
    What is the correct way to write a comment in Python?
    /* This is a comment */
    <!-- This is a comment -->
    // This is a comment
    # This is a comment
    30s

Teachers give this quiz to your class