โ† All PCEP Flashcard Decks

Data Structures 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 Data Structures flashcards as text
  1. What is the result of `[1, 2, 3] + [4, 5]`?

    Answer: [1, 2, 3, 4, 5]

    The `+` operator concatenates two lists into a single list.

  2. Which method removes and returns the last element of a list?

    Answer: pop()

    `pop()` without arguments removes and returns the last element of the list.

  3. What does `len({'a': 1, 'b': 2, 'c': 3})` return?

    Answer: 3

    `len()` on a dictionary returns the number of key-value pairs.

  4. What is the output of `(1, 2, 3)[1:3]`?

    Answer: (2, 3)

    Slicing `[1:3]` on a tuple returns elements at index 1 and 2.

  5. Which of the following creates an empty set?

    Answer: set()

    `{}` creates an empty dict, so `set()` is the only way to create an empty set.

  6. What happens when you try to change a value in a tuple?

    Answer: A TypeError is raised

    Tuples are immutable; attempting to assign to an index raises a TypeError.

  7. What is the result of `list(range(0, 10, 3))`?

    Answer: [0, 3, 6, 9]

    `range(0, 10, 3)` generates 0, 3, 6, 9 โ€” stopping before 10.

Data Structures Flashcards โ€” PCEP Study Cards with Answers