Python Practice Test: Variables and Data Types

  • Variables and Data Types
  • 10 questions
  • 13 minutes

Ten short questions on how Python stores and converts values. Tip: work out the type of each value before you work out the result.

Tap an option to mark your answer. You can change your mind, or tap the same option again to leave the question blank. The correct answers and explanations appear when you finish the test.Tap an option to answer; tap it again to leave the question blank.

Advertisement
Advertisement
  1. Question 1

    print(type(3 / 2))

    What does the code print?

  2. Question 2

    x = "5"
    y = 3
    print(x * y)

    What does the code print?

  3. Question 3

    print(10 // 3, 10 % 3)

    What does the code print?

  4. Question 4

    Which of these is a valid Python variable name?

  5. Question 5

    print(int("7") + 2.5)

    What does the code print?

  6. Question 6

    a = [1, 2]
    b = a
    b.append(3)
    print(a)

    What does the code print?

  7. Question 7

    print(bool(""), bool("False"))

    What does the code print?

  8. Question 8

    print(round(2.5), round(3.5))

    What does the code print?

  9. Question 9

    x = 5
    x += 2
    x *= 3
    print(x)

    What does the code print?

  10. Question 10

    print(2 ** 3 ** 2)

    What does the code print?

Questions you leave blank are not counted as wrong.

Advertisement

More Python tests

All Python Programming tests
13:00

Do you want to finish the test?