โ† All Python Flashcard Decks

Data Types and Variables Flashcards

7 cards from real Python practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Data Types and Variables flashcards as text
  1. What is the result of `type(3.0)` in Python?

    Answer:

    3.0 is a floating-point literal, so its type is `float`.

  2. Which statement correctly creates a complex number in Python?

    Answer: z = complex(2, 3)

    `complex(2, 3)` creates the complex number 2+3j; Python uses `j` not `i` in literals.

  3. What does `bool` inherit from in Python's type hierarchy?

    Answer: int

    `bool` is a subclass of `int`, so `True == 1` and `False == 0`.

  4. What is the output of `print(type(None))`?

    Answer:

    Python's `None` is the sole instance of the built-in `NoneType` class.

  5. Which of the following variable names is INVALID in Python?

    Answer: 2count

    Variable names cannot begin with a digit; `2count` is a syntax error.

  6. What is the value of `int('0b1010', 0)` in Python?

    Answer: 10

    Passing base `0` tells `int()` to auto-detect the base from the prefix; `0b1010` is binary 10.

  7. After `x = 5`, which operation changes `x` to a float WITHOUT reassigning explicitly?

    Answer: x /= 1

    True division `/=` always returns a float, so `x /= 1` makes x equal 5.0.

Written and edited by , founder of Practice Test Geeks, with AI assistance. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Editorial policy