placeholder image to represent content

Python Programming (1)

Quiz by Starter quizzes

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

Correct quiz answers unlock more play!

New Quizalize solo game modes
15 questions
Show answers
  • Q1

    Which of the following is not a valid data type in Python?

    tuple

    set

    string

    list

    integer

    30s
  • Q2

    What is the output of this code?

    Question Image

    [2, 3]

    [2, 3, 4]

    [1, 2]

    [1, 2, 3]

    30s
  • Q3

    Which of the following statements is true regarding Python functions?

    A function can only be defined within a class.

    A function can only take one argument.

    A function cannot be called from within another function.

    A function can have multiple return statements.

    30s
  • Q4

    A function can only be defined within a class.

    Question Image

    The sum of x and y is 5+3

    The sum of x and y is 8

    The sum of {} and {} is {}

    The sum of 5 and 3 is 8

    30s
  • Q5

    Which of the following is a valid way to open a file in Python for reading?

    file = open("file.txt", "a+")

    file = open("file.txt", "x")

    file = open("file.txt", "w")

    file = open("file.txt", "r+")

    30s
  • Q6

    What is the output of the following code?

    Question Image

    a is greater than b

    None of the above

    a is equal to b

    a is less than b

    30s
  • Q7

    Which of the following is a correct way to create a function in Python?

    function my_function:

    def my_function:

    function my_function():

    def my_function():

    30s
  • Q8

    What is the output of the following code?

    Question Image

    1 2 3

    1 2

    0 1 2 3

    0 1 2

    30s
  • Q9

    What is the output of the following code?

    Question Image

    [1, 4, 9, 16]

    [2, 4, 6, 8]

    [4, 16]

    [1, 3]

    30s
  • Q10

    Which of the following data types is immutable in Python?

    Dictionary

    Set

    Tuple

    List

    30s
  • Q11

    What is the output of the following code?

    Question Image

    "x + y = 3 + 5"

    "x + y = 8"

    "x + y = 35"

    "x + y = 3+5"

    30s
  • Q12

    What does the “range()” function in Python do?

    It returns a list of numbers starting from 0 to a specified number

    It returns a list of numbers starting from 1 to a specified number

    It returns a list of numbers starting from a specified number to the end of the range

    It returns a list of numbers starting from a specified number and ending at a specified number

    30s
  • Q13

    What is the difference between “append()” and “extend()” methods in Python?

    “extend()” adds an element to the end of a list, while “append()” concatenates two lists

    “append()” adds an element to the beginning of a list, while “extend()” adds it to the end

    There is no difference between them

    “append()” adds an element to the end of a list, while “extend()” concatenates two lists

    30s
  • Q14

    What does the “try-except” block in Python do?

    It executes a block of code only if a condition is met

    It handles exceptions and errors in code

    It executes a block of code except in certain situations

    It tries to execute a block of code if a condition is met

    30s
  • Q15

    What is the output of the following code?

    Question Image

    [2, 3, 5]

    {"apple": 2, "banana": 3, "cherry": 5}

    10

    "applebanana5cherry"

    30s

Teachers give this quiz to your class