03.04 Data Structures Overview - Quiz¶
Check your understanding
-
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
-
In Python, which data structure is used to represent single-dimensional arrays?
- Tuples
- Sets
- Lists { data-correct }
- Dictionaries
-
How do you access the first element in a Python list called
grades?grades[1]grades[0]{ data-correct }grades.first()grades[-1]
-
What would be the result of
grades[1][2]ifgrades = [[85, 92, 78], [91, 87, 94]]?- 85
- 92
- 94 { data-correct }
- 87
-
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
-
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
-
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()
-
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
-
Which data structure would be most appropriate for representing a family tree?
- List
- Stack
- Tree { data-correct }
- CSV file
-
In CSV files, what does CSV stand for?
- Computer Separated Values
- Comma Separated Values { data-correct }
- Character Separated Variables
- Column Separated Variables
-
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
-
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