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
What is the result of `isinstance(True, int)`?
Answer: True
Since `bool` is a subclass of `int`, `isinstance(True, int)` returns `True`.
Which Python built-in returns the memory address of an object?
Answer: id()
`id()` returns the unique integer identity (memory address) of an object.
What happens when you assign `a = b = c = 10` in Python?
Answer: All three variables point to the same object 10
Chained assignment makes all three names reference the same integer object 10.
What is the output of `x = 10; del x; print(x)`?
Answer: NameError
`del x` removes the name binding, so accessing `x` afterwards raises `NameError`.
Which expression uses augmented assignment to add 5 to variable `n`?
Answer: n += 5
`n += 5` is the augmented assignment operator that adds 5 to `n` in place.
What does `float('inf')` represent in Python?
Answer: Positive infinity as a float
`float('inf')` produces the IEEE 754 positive infinity float value.
In Python, which of the following is a mutable data type?
Answer: list
Lists are mutable — their elements can be changed after creation; int, tuple, and str are immutable.