Linear Data Structures: Arrays, Stacks, Queues & Linked Lists: 17 MCQs with answers
All 17 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 6 questions
Q1. Which property defines a linear data structure?
BeginnerShow answer & explanation
Each element has at most one predecessor and one successor.
A linear data structure stores elements in a sequence where each element has at most one predecessor and one successor. Contiguity is an array property, not a requirement for all linear structures.
Q2. Using the formula $\text{Address}(A[i]) = B + i \times w$, what does $w$ represent?
BeginnerShow answer & explanation
The size of each element in bytes
In the array address formula, $B$ is the base address, $i$ is the index, and $w$ is the width or size of each element in bytes.
Q3. A stack follows which order rule?
BeginnerShow answer & explanation
LIFO — Last In, First Out
A stack inserts and deletes only at the top, so the last element pushed is the first one popped — LIFO.
Q4. In a queue, where does insertion take place?
BeginnerShow answer & explanation
At the rear
A queue enqueues at the rear and dequeues from the front, giving FIFO behaviour.
Q5. Which notation places the operator after its operands?
BeginnerShow answer & explanation
Reverse Polish (postfix) notation
Reverse Polish or postfix notation writes the operator after the operands, e.g. $A\,B\,+$. Polish notation is prefix, with the operator first.
Q6. Array element access is $O(1)$ because the address is computed directly as $B + i \times w$.
BeginnerShow answer & explanation
True
Array element access is $O(1)$ because the address is computed directly as $B + i \times w$.
Building up · 6 questions
Q7. A print spooler releases jobs in the exact order they were submitted. Which structure models this?
IntermediateShow answer & explanation
Queue
Print spooling is a fair-order process, so FIFO applies — a queue. A stack would reverse the order, and a priority queue would reorder by importance.
Q8. Why does inserting an element in the middle of an array cost $O(n)$?
IntermediateShow answer & explanation
Elements after the insertion point must be shifted to keep memory contiguous.
Arrays occupy contiguous memory, so making room in the middle requires shifting subsequent elements — an $O(n)$ operation.
Q9. Evaluate the postfix expression $5\;3\;+\;2\;\times$ using a stack.
IntermediateShow answer & explanation
$16$
Push 5 and 3; on $+$ pop 3 and 5, push 8; push 2; on $\times$ pop 2 and 8, push 16. The result is 16.
Q10. A simple array-based queue has had several dequeues, leaving unused slots before the front. Which structure best reuses that space?
IntermediateShow answer & explanation
Circular queue
A circular queue wraps the rear index using modulo arithmetic, so freed slots at the front are reused while enqueue and dequeue stay $O(1)$.
Q11. Which structure should be chosen when the number of elements is fixed and positional access must be instant?
IntermediateShow answer & explanation
Array
An array gives $O(1)$ random access through the address formula, which suits fixed-size, access-heavy workloads. Linked lists need $O(n)$ traversal for access.
Q12. A $1000 \times 1000$ matrix has only 50 non-zero entries. Why is triplet form preferred over a full 2D array?
IntermediateShow answer & explanation
It stores only 50 triples instead of $10^6$ cells.
A sparse matrix wastes memory when stored fully. Triplet form keeps only $(row, column, value)$ for non-zero entries, so 50 triples replace a million cells.
Topper level · 5 questions
Q13. Which operation is $O(1)$ in a linked list but $O(n)$ in an array?
AdvancedShow answer & explanation
Insertion at a known node position
Once the position is known, a linked list inserts in $O(1)$ by relinking pointers, whereas an array must shift elements. Access is the reverse: $O(1)$ for arrays, $O(n)$ for linked lists.
Q14. A system must always process the most urgent task next, regardless of arrival time. Which structure fits best?
AdvancedShow answer & explanation
Priority queue
A priority queue dequeues the highest-priority element rather than the earliest, which matches urgency-based scheduling. A heap implementation keeps dequeue at $O(\log n)$.
Q15. Which statement about the Tower of Hanoi with $n$ disks is correct?
AdvancedShow answer & explanation
It requires $2^n - 1$ moves and mirrors stack push/pop discipline.
The recursive solution to Tower of Hanoi takes $2^n - 1$ moves, and each recursive call pushes a frame on the call stack while each return pops it.
Q16. Which pair of structures can both be restricted to behave like a stack?
AdvancedShow answer & explanation
Deque and linked list
A deque restricted to one end behaves like a stack, and a linked list with insertion and deletion only at the head also behaves like a stack. The other pairs lack this single-end restriction.
Q17. Consider a scenario where you need to implement a system that processes tasks in a specific order: tasks with higher priority should be handled before those with lower priority, but within the same priority level, tasks should be processed in the order they were received. Which data structure would best suit this requirement?
AdvancedShow answer & explanation
Priority Queue
A **Priority Queue** allows for elements to be dequeued based on their priority rather than their arrival time. This meets the requirement of processing higher priority tasks first while maintaining the order of tasks with the same priority.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages