Practice set for DSA Lecture. Read the full lesson first: Data Structures and Abstract Data Types (ADT) Explained Simply on eLecturesAI.
Reading a topic and knowing a topic are two different things. The quickest way to find out which one you have is to answer questions without looking at your notes.
This page has 20 MCQs, 5 short questions and a score guide, all based on DSA Lecture: data structures, Abstract Data Types (ADT), the Stack ADT, and linear vs non-linear structures.
- Click the option you think is correct. It turns green if you are right and red if you are wrong.
- Read the explanation that opens under the question.
- If you got it wrong, use the Revise link to go back to that exact part of the lesson.
- Check your score at the end and follow the guide.
Section 1: Data structure basics
Q1A data structure is best described as:
Show answer
Answer: B. A data structure is about organizing and storing data so that we can use it efficiently. It is not a language, hardware or a file.
Revise: What is a data structure?
Q2The same books are kept once in a pile on the floor and once on shelves sorted by subject. What does this example show?
Show answer
Answer: C. The books (data) are identical. Only the arrangement changed, and that decides the speed of searching.
Revise: What is a data structure?
Q3A phone has 1,000,000 contacts stored in random order. In the worst case, how many contacts may you have to check to find one name?
Show answer
Answer: D. With no order, you may have to check every contact one by one. (A sorted list searched with the “dictionary trick”, binary search, needs only about 20 checks.)
Section 2: Abstract Data Type (ADT)
Q4An Abstract Data Type (ADT) describes:
Show answer
Answer: C. An ADT is the “what”: a list of operations, like a contract. The “how” belongs to the implementation.
Q5In the TV remote example, the buttons you can press correspond to:
Show answer
Answer: D. You know what each button does, but not the circuit inside. Buttons are the operations (ADT). The circuit is the implementation.
Q6Fill in the blanks: “The ADT is the ______ and the implementation is the ______.”
Show answer
Answer: A. ADT = WHAT can be done. Implementation = HOW it is done inside.
Q7If the implementation of an ADT is changed (for example, array to linked list), the code that only uses the ADT operations:
Show answer
Answer: B. This is the whole point of an ADT. The user code depends only on the operations (the contract), not on the inside.
Revise: One ADT, two implementations
Q8Which statement is correct?
Show answer
Answer: C. They are related, not equal. A is the most common mistake in exams. D reverses the idea.
Revise: Data structure vs ADT
Q9For a bank ATM, which of these is the ADT-style description?
Show answer
Answer: A. The ADT lists what the user can do. How the bank stores accounts is the hidden implementation.
Section 3: The Stack ADT
Q10A stack removes items in which order?
Show answer
Answer: B. The last item pushed is the first one popped, like the top plate in a pile of plates. (First in, first out is a queue.)
Revise: Example: the Stack ADT
Q11Which Stack operation adds an item on top?
Show answer
Answer: C. push(x) adds x on top. pop removes, peek looks, isEmpty checks.
Revise: Example: the Stack ADT
Q12Items 10, 20 and 30 are pushed in this order. Then pop() is called once. What is returned and what is the new top?
Show answer
Answer: D. The stack (bottom to top) is 10, 20, 30. pop() removes and returns the top, 30. Now the top is 20.
Revise: One ADT, two implementations
Q13What does peek() do?
Show answer
Answer: A. peek() only looks at the top. The stack stays unchanged.
Revise: Example: the Stack ADT
Q14On an empty stack the following is run: push(5); push(8); pop(); pop(); What does isEmpty() return now?
Show answer
Answer: B. Two items were pushed and two were popped, so nothing is left. isEmpty() returns true.
Revise: Example: the Stack ADT
Q15A Stack ADT can be implemented using:
Show answer
Answer: C. Both work. The user code stays the same, which is the strength of an ADT.
Revise: One ADT, two implementations
Q16Which of these behaves like a stack in real life?
Show answer
Answer: D. The last page you opened is the first one you go back to. The bank line is a queue. The family tree is a tree.
Revise: Example: the Stack ADT
Section 4: Linear and non-linear data structures
Q17Which of these is a linear data structure?
Show answer
Answer: A. Array, linked list, stack and queue are linear. Tree and graph are non-linear.
Revise: Types of data structures
Q18A road network where each city connects to many other cities is best modelled as a:
Show answer
Answer: D. Many-to-many connections between places make a graph. (This is how Google Maps thinks of roads.)
Revise: Types of data structures
Q19“Linear” in a data structure means:
Show answer
Answer: B. Linear refers to the sequence, not to the memory layout. A linked list is linear even though its nodes can be scattered in memory.
Revise: Common mistakes students make
Q20A tree is called non-linear because:
Show answer
Answer: C. In a tree, one item (a parent) can connect to several others (children), so the items do not form a single line.
Revise: Types of data structures
Short questions (write the answers in your own words)
Don’t just read these. Write each answer on paper in 2-3 lines, then compare.
S1. Explain the difference between a data structure and an ADT with one example.
Show model answer
An ADT lists what operations are available. A data structure is how the data is actually stored so those operations work. Example: Stack is an ADT with push, pop, peek and isEmpty. An array or a linked list can be the data structure that implements it.
S2. Name the four operations of the Stack ADT and say what each one does.
Show model answer
push(x) adds x on top. pop() removes and returns the top item. peek() returns the top item without removing it. isEmpty() tells whether the stack has no items.
S3. Why can the same Stack be built with an array or with a linked list without changing the user code?
Show model answer
Because the user code only calls the ADT operations (push, pop, peek, isEmpty). It never depends on how the items are stored inside. As long as the operations behave the same, the inside can be swapped.
S4. Give one linear and one non-linear example from daily life, and say why each is linear or non-linear.
Show model answer
Linear: a queue at a bank. Everyone has exactly one person in front and one behind, so the items form a single line. Non-linear: a family tree. One person connects to several children, who connect to more, so the items branch.
S5. Trace this and write the final stack (bottom to top) and the value returned by the last call:
push(4); push(7); push(9); pop(); push(2); peek();
Show model answer
After push(4); push(7); push(9) the stack is 4, 7, 9. pop() removes 9, leaving 4, 7. push(2) gives 4, 7, 2. peek() returns 2. Final stack, bottom to top: 4, 7, 2.
Check your score
Count your correct MCQs (out of 20):
| Score | What it means | What to do next |
|---|---|---|
| 18 – 20 | Excellent. The concepts are solid. | Move on to the next lecture. |
| 14 – 17 | Good, with a few gaps. | Re-read only the sections linked under the questions you missed. |
| 10 – 13 | Half-way there. | Read the lesson again slowly, then retry this quiz tomorrow. |
| Below 10 | The basics are not settled yet. | Read the full lesson once more, type out the Stack code, then retake the quiz. |
Go back to the full lesson: Data Structures and ADT Explained Simply →
Frequently asked questions
Are these MCQs enough for the exam?
They cover the whole of Lecture, but real exams also ask you to write short answers and trace code. Practice the five short questions above as well.
What is the best way to use an MCQ quiz?
Answer first, check later. Reading the answer without trying the question gives a false feeling of knowing it.
Where do I learn the topic if I got most answers wrong?
Start with the lesson on eLecturesAI: Data Structures and Abstract Data Types (ADT) Explained Simply. Each question above also links to the exact section to revise.
Written by Engnr.Dr.Muhammad Tahir Dlbar.
Leave a Reply