โ† 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 keyword is used to define a function in Python?

    Answer: def

    The `def` keyword is used to define a function in Python.

  2. What is the output of `print(2 ** 3)` in Python?

    Answer: 8

    The `**` operator is exponentiation, so `2 ** 3` equals 2 to the power of 3, which is 8.

  3. Which Python built-in function converts a string to an integer?

    Answer: int()

    `int()` converts a compatible string or float to an integer value.

  4. What is the correct way to write a single-line comment in Python?

    Answer: # This is a comment

    Single-line comments in Python begin with the `#` symbol.

  5. What is the output of `print(round(3.567, 2))`?

    Answer: 3.57

    `round(3.567, 2)` rounds to 2 decimal places, giving 3.57 because the third decimal is 7.

  6. In Python, which of the following correctly creates a multi-line string?

    Answer: """line1\nline2"""

    Triple quotes (`"""..."""` or `'''...'''`) allow multi-line strings in Python.

  7. What does the `input()` function return in Python 3?

    Answer: str

    `input()` always returns user input as a string in Python 3, regardless of what the user types.