โ† All PCEP Flashcard Decks

Fundamentals of Python Programming Flashcards

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

Read the first 7 Fundamentals of Python Programming flashcards as text
  1. What is the output of `print(bool(0))` in Python?

    Answer: False

    Zero is falsy in Python, so `bool(0)` evaluates to `False`.

  2. Which of the following is the correct way to assign multiple variables in one line in Python?

    Answer: x, y, z = 1, 2, 3

    Python supports tuple unpacking, so `x, y, z = 1, 2, 3` assigns values simultaneously.

  3. What is the result of `abs(-7)` in Python?

    Answer: 7

    `abs()` returns the absolute value of a number, so `abs(-7)` is 7.

  4. Which statement about Python's `None` is correct?

    Answer: None is its own type (NoneType)

    `None` is a singleton object of type `NoneType` and is not equal to 0, False, or an empty string.

  5. What is the output of `print('Python'[1])`?

    Answer: y

    String indexing starts at 0, so index 1 returns the second character `'y'`.

  6. What will `print(3 == 3.0)` output in Python?

    Answer: True

    Python compares values across numeric types, and 3 and 3.0 are numerically equal, so it returns `True`.

  7. What is the output of `print("Hello" * 2)`?

    Answer: HelloHello

    String repetition with `*` repeats the string the given number of times, producing `'HelloHello'`.