Skip to content

This textbook is in beta – content is actively being refined. Report issues or suggestions

03.04 Data Structures Overview - Quiz

Check your understanding

  1. What is a data structure?

    • A way of writing Python code more efficiently
    • A method for organizing and storing data so it can be accessed and modified efficiently { data-correct }
    • A type of algorithm for sorting data
    • A programming language feature for creating variables
  2. In Python, which data structure is used to represent single-dimensional arrays?

    • Tuples
    • Sets
    • Lists { data-correct }
    • Dictionaries
  3. How do you access the first element in a Python list called grades?

    • grades[1]
    • grades[0] { data-correct }
    • grades.first()
    • grades[-1]
  4. What would be the result of grades[1][2] if grades = [[85, 92, 78], [91, 87, 94]]?

    • 85
    • 92
    • 94 { data-correct }
    • 87
  5. Which data structure is best for grouping related information like a student’s name, age, and grade?

    • List
    • Dictionary (Record) { data-correct }
    • Stack
    • CSV file
  6. In a stack data structure, which principle does it follow?

    • First In, First Out (FIFO)
    • Last In, First Out (LIFO) { data-correct }
    • Random Access
    • Alphabetical Order
  7. Which Python operation is used to add an element to the top of a stack (implemented as a list)?

    • insert()
    • add()
    • append() { data-correct }
    • push()
  8. What is the main advantage of using a hash table (Python dictionary) for a phone book?

    • It automatically sorts names alphabetically
    • It provides instant lookup by name { data-correct }
    • It uses less memory than other data structures
    • It can store more phone numbers
  9. Which data structure would be most appropriate for representing a family tree?

    • List
    • Stack
    • Tree { data-correct }
    • CSV file
  10. In CSV files, what does CSV stand for?

    • Computer Separated Values
    • Comma Separated Values { data-correct }
    • Character Separated Variables
    • Column Separated Variables
  11. If you need to implement an “undo” function in a text editor, which data structure would be most appropriate?

    • List with random access
    • Dictionary
    • Stack { data-correct }
    • Tree
  12. Which of the following is the best use case for a 2D list (multidimensional array)?

    • Storing a single student’s grades
    • Representing a game board or seating chart { data-correct }
    • Implementing a phone book lookup
    • Creating an undo function