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?

Beginner
A Elements are always stored in contiguous memory. B Elements are always ordered by priority. C Each element has at most one predecessor and one successor. D Each element can have many predecessors and successors.
Show 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?

Beginner
A The base address of the array B The index of the element C The size of each element in bytes D The total number of elements
Show 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?

Beginner
A Random order B Highest priority first C FIFO — First In, First Out D LIFO — Last In, First Out
Show 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?

Beginner
A At the front B At the rear C At both ends simultaneously D At the top
Show 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?

Beginner
A Reverse Polish (postfix) notation B Polish (prefix) notation C Infix notation D Triplet notation
Show 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$.

Beginner
A True B False
Show 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?

Intermediate
A Priority queue B Queue C Stack D Doubly linked list
Show 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)$?

Intermediate
A Elements after the insertion point must be shifted to keep memory contiguous. B A new node must be allocated and linked. C The base address must be recomputed for every element. D The array must be sorted before insertion.
Show 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.

Intermediate
A $30$ B $11$ C $16$ D $13$
Show 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?

Intermediate
A Sparse matrix B Circular queue C Stack D Priority queue
Show 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?

Intermediate
A Singly linked list B Stack C Array D Queue
Show 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?

Intermediate
A It removes the need to store matrix dimensions. B It makes matrix multiplication faster in all cases. C It stores only 50 triples instead of $10^6$ cells. D It allows $O(1)$ access to any element by index.
Show 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?

Advanced
A Computing the array address B Reading the first element C Insertion at a known node position D Accessing the element at index $i$
Show 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?

Advanced
A Stack B Deque C Circular queue D Priority queue
Show 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?

Advanced
A It requires $n!$ moves and uses a linked list. B It requires $2^n - 1$ moves and mirrors stack push/pop discipline. C It requires $2n$ moves and uses a deque. D It requires $n^2$ moves and uses a queue.
Show 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?

Advanced
A Circular queue and heap B Array and priority queue C Deque and linked list D Queue and sparse matrix
Show 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?

Advanced
A Stack B Priority Queue C Linked List D Array
Show 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.

Make your own

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