← All PCAP Flashcard Decks

Data Structure Flashcards

11 cards from real PCAP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 11 Data Structure flashcards as text
  1. Which data structure is used to store a sequence of items that are ordered and changeable in Python?

    Answer: List

    Lists in Python are ordered, mutable sequences used to store collections of items.

  2. What is the correct syntax to create a tuple in Python?

    Answer: tuple = (1, 2, 3)

    Tuples in Python are created using parentheses.

  3. Which method would you use to add an item to the end of a list in Python?

    Answer: append()

    The append() method adds an item to the end of a list.

  4. How do you access the value associated with a specific key in a dictionary?

    Answer: dict[key]

    Values in a dictionary are accessed using square brackets with the key inside.

  5. Which data structure does not allow duplicate elements?

    Answer: Set

    Sets in Python do not allow duplicate elements.

  6. What will be the output of the following code?br my_dict = {""name"": ""John"", ""age"": 30}br print(my_dict.get(""address"", ""Not found""))

    Answer: Not found

    The get method returns the specified default value if the key is not found in the dictionary.

  7. Which of the following is true about tuples?

    Answer: Both B and C

    Tuples are immutable and can have duplicate elements.

  8. How can you remove the last item from a list?

    Answer: list.pop()

    The pop() method removes and returns the last item from a list.

  9. What will be the result of the following code?br my_set = {1, 2, 3}br my_set.add(2)br print(my_set)

    Answer: {1, 2, 3}

    Sets do not allow duplicate elements, so adding an existing element does not change the set.

  10. Which method would you use to combine two dictionaries in Python 3.9 or later?

    Answer: dict1 | dict2

    The | operator is used to merge two dictionaries in Python 3.9 and later.

  11. How do you check if a key exists in a dictionary?

    Answer: if key in dict:

    The in keyword is used to check if a key exists in a dictionary

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy

Sources & references

Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy

  1. pythoninstitute.org — Eligibility, fees, retake fee, retake policy, score release, time limit, score validity · verified Nov 2026
  2. home.pearsonvue.com — Test delivery · verified Nov 2026