HomeSubjectsUniversityBlogAbout

Linear Data Structures

Topic in Data Structures & Algorithms

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

Linear data structures store elements in sequence, each with at most one predecessor and one successor, as in arrays, linked lists, stacks and queues. Questions compare constant-time array indexing with the linear cost of inserting at an arbitrary position, and weigh this against linked lists, which grow easily but lack random access. You will meet singly, doubly and circular linked lists, sentinel nodes, and in-place list reversal. Stack items involve LIFO order, push and pop, and expression evaluation, while queue items cover FIFO order, circular buffers, deques, building a queue from two stacks, and amortised O(1) appends in dynamic arrays.

Below are 30 practice questions from a pool of 210 Linear Data Structures MCQs, one of 12 topics in Data Structures & Algorithms. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

Linear Data StructuresEasy

Q1. What is a stack?

  1. A.A LIFO data structure✓ Correct
  2. B.A FIFO data structure
  3. C.A random access data structure
  4. D.A hierarchical data structure

Explanation

A stack follows the Last-In-First-Out (LIFO) principle where the last element added is the first one removed.

Report an error in this question

Linear Data StructuresEasy

Q2. What is a queue?

  1. A.A sorted data structure
  2. B.A FIFO data structure✓ Correct
  3. C.A LIFO data structure
  4. D.A tree-based data structure

Explanation

A queue follows the First-In-First-Out (FIFO) principle where the first element added is the first one removed.

Report an error in this question

Linear Data StructuresEasy

Q3. Which operation adds an element to the top of a stack?

  1. A.Push✓ Correct
  2. B.Dequeue
  3. C.Enqueue
  4. D.Pop

Explanation

The push operation adds an element to the top of a stack.

Report an error in this question

Linear Data StructuresEasy

Q4. What is a linked list?

  1. A.Nodes where each node points to the next node✓ Correct
  2. B.A hierarchical tree-based data structure
  3. C.Elements stored in contiguous memory locations
  4. D.A hash-based key-value pair structure

Explanation

A linked list is a linear data structure consisting of nodes, where each node contains data and a reference (pointer) to the next node.

Report an error in this question

Linear Data StructuresEasy

Q5. What is the time complexity of inserting an element at the beginning of a singly linked list?

  1. A.O(n^2)
  2. B.O(log n)
  3. C.O(1)✓ Correct
  4. D.O(n)

Explanation

Inserting at the beginning of a linked list only requires updating the head pointer, which takes O(1) time.

Report an error in this question

Linear Data StructuresEasy

Q6. Which data structure is used to evaluate postfix expressions?

  1. A.Array
  2. B.Stack✓ Correct
  3. C.Queue
  4. D.Linked List

Explanation

A stack is used to evaluate postfix expressions by pushing operands and popping them when an operator is encountered.

Report an error in this question

Linear Data StructuresEasy

Q7. What is the main disadvantage of an array?

  1. A.Random access is not possible
  2. B.Fixed size in static arrays✓ Correct
  3. C.It cannot store integers
  4. D.Elements cannot be sorted

Explanation

Static arrays have a fixed size that must be declared at creation time and cannot be changed dynamically.

Report an error in this question

Linear Data StructuresEasy

Q8. What does the 'dequeue' operation do?

  1. A.Adds an element to the front of a queue
  2. B.Removes an element from the front of a queue✓ Correct
  3. C.Adds an element to the rear of a queue
  4. D.Removes an element from the rear of a queue

Explanation

The dequeue operation removes and returns the element at the front of the queue.

Report an error in this question

Linear Data StructuresEasy

Q9. In a singly linked list, the last node points to:

  1. A.The first node
  2. B.NULL (nothing)✓ Correct
  3. C.The middle node
  4. D.Itself (self)

Explanation

In a singly linked list, the last node's next pointer is NULL, indicating the end of the list.

Report an error in this question

Linear Data StructuresEasy

Q10. Which operation removes an element from the top of a stack?

  1. A.Enqueue
  2. B.Push
  3. C.Peek
  4. D.Pop✓ Correct

Explanation

The pop operation removes and returns the element from the top of the stack.

Report an error in this question

Linear Data StructuresMedium

Q11. What is a circular queue?

  1. A.A queue implemented using a linked list
  2. B.A queue where the rear connects back to front✓ Correct
  3. C.A double-ended queue with two pointers
  4. D.A queue that automatically sorts elements

Explanation

A circular queue connects the rear to the front, utilizing the entire array space and avoiding the problem of unused space in linear queues.

Report an error in this question

Linear Data StructuresMedium

Q12. What is a doubly linked list?

  1. A.A list with pointers to both next and previous✓ Correct
  2. B.A list that stores two data values per node
  3. C.A list structure with two separate heads
  4. D.A circular list with bidirectional traversal

Explanation

A doubly linked list has nodes that contain pointers to both the next and the previous nodes, allowing traversal in both directions.

Report an error in this question

Linear Data StructuresMedium

Q13. What is a deque (double-ended queue)?

  1. A.A stack implemented as a queue structure
  2. B.A priority queue with weighted elements
  3. C.A queue allowing deletion from both ends only
  4. D.A structure allowing insert and delete at both ends✓ Correct

Explanation

A deque (double-ended queue) allows insertion and deletion of elements from both the front and rear ends.

Report an error in this question

Linear Data StructuresMedium

Q14. What is the time complexity of deleting a node from the middle of a singly linked list (given a pointer to the previous node)?

  1. A.O(1)✓ Correct
  2. B.O(log n)
  3. C.O(n)
  4. D.O(n^2)

Explanation

If you have a pointer to the previous node, deletion takes O(1) by simply updating the next pointer.

Report an error in this question

Linear Data StructuresMedium

Q15. How can you implement a queue using two stacks?

  1. A.It is not possible to implement using stacks
  2. B.Use both stacks for enqueue operations only
  3. C.Use one stack for enqueue and another for dequeue✓ Correct
  4. D.Merge both stacks into a single combined structure

Explanation

One stack is used for enqueue (push). For dequeue, if the second stack is empty, all elements from the first are popped and pushed to the second, then popped from the second.

Report an error in this question

Linear Data StructuresMedium

Q16. What is the advantage of a linked list over an array?

  1. A.Better CPU cache performance overall
  2. B.Faster random access by index
  3. C.Dynamic size and efficient insertion✓ Correct
  4. D.Less memory usage per element

Explanation

Linked lists can grow or shrink dynamically and allow O(1) insertion/deletion at known positions without shifting elements.

Report an error in this question

Linear Data StructuresMedium

Q17. What is a sentinel node in a linked list?

  1. A.A dummy node to simplify boundary conditions✓ Correct
  2. B.The node containing the maximum data value
  3. C.A node that stores the total list size
  4. D.The last node in the list structure

Explanation

A sentinel (dummy) node is placed at the beginning or end of a linked list to simplify insertion and deletion by eliminating special cases for empty lists or boundary nodes.

Report an error in this question

Linear Data StructuresMedium

Q18. What is the condition for a circular queue being full (array implementation with size N)?

  1. A.front == 0 && rear == N - 1
  2. B.(rear + 1) % N == front✓ Correct
  3. C.rear == N - 1
  4. D.front == rear

Explanation

In a circular queue, the queue is full when the next position of rear equals front: (rear + 1) % N == front.

Report an error in this question

Linear Data StructuresMedium

Q19. What is the time complexity of searching for an element in an unsorted linked list?

  1. A.O(n^2)
  2. B.O(log n)
  3. C.O(1)
  4. D.O(n)✓ Correct

Explanation

In an unsorted linked list, you must traverse the list sequentially, taking O(n) in the worst case.

Report an error in this question

Linear Data StructuresMedium

Q20. Which application commonly uses a stack?

  1. A.Breadth-first graph search traversal
  2. B.Level-order tree traversal processing
  3. C.Function call management (call stack)✓ Correct
  4. D.Round-robin job scheduling system

Explanation

The system uses a call stack to manage function calls, storing return addresses and local variables for each active function.

Report an error in this question

Linear Data StructuresHard

Q21. What is the amortized time complexity of enqueue and dequeue operations when implementing a queue with two stacks?

  1. A.O(1) amortized for both✓ Correct
  2. B.O(1) enqueue, O(n) dequeue
  3. C.O(n) enqueue, O(1) dequeue
  4. D.O(n) for both operations

Explanation

Each element is pushed and popped at most twice (once from each stack), so the amortized cost per operation is O(1).

Report an error in this question

Linear Data StructuresHard

Q22. How can you detect a cycle in a linked list efficiently?

  1. A.By sorting the list nodes first in order
  2. B.By converting the list into an array form
  3. C.Using two nested loops over all nodes
  4. D.Using Floyd's tortoise and hare algorithm✓ Correct

Explanation

Floyd's algorithm uses two pointers moving at different speeds. If they meet, a cycle exists. It runs in O(n) time and O(1) space.

Report an error in this question

Linear Data StructuresHard

Q23. What is the time complexity of reversing a singly linked list iteratively?

  1. A.O(1)
  2. B.O(n^2)
  3. C.O(n)✓ Correct
  4. D.O(n log n)

Explanation

Reversing a singly linked list iteratively requires one pass through the list, taking O(n) time with O(1) extra space.

Report an error in this question

Linear Data StructuresHard

Q24. In a skip list, what is the expected time complexity of search?

  1. A.O(n)
  2. B.O(1)
  3. C.O(log n)✓ Correct
  4. D.O(n log n)

Explanation

A skip list uses multiple levels of linked lists with probabilistic balancing, providing O(log n) expected search time.

Report an error in this question

Linear Data StructuresHard

Q25. What is an XOR linked list?

  1. A.A circular linked list variant with XOR pointers
  2. B.A linked list that stores only odd-valued elements
  3. C.A linked list using XOR for data encryption purposes
  4. D.A doubly linked list using XOR of addresses to save memory✓ Correct

Explanation

An XOR linked list stores the XOR of the previous and next node addresses in a single pointer field, reducing memory usage compared to a standard doubly linked list.

Report an error in this question

Linear Data StructuresHard

Q26. How do you find the starting node of a cycle in a linked list using Floyd's algorithm?

  1. A.Use a hash table to store all visited node addresses
  2. B.Count all nodes in the list and compute the start
  3. C.Reset one pointer to head and move both one step✓ Correct
  4. D.Reverse the entire list and then detect the cycle

Explanation

After detecting the cycle, reset one pointer to head. Move both pointers one step at a time; the node where they meet is the cycle start.

Report an error in this question

Linear Data StructuresHard

Q27. What is the minimum number of stacks needed to implement a deque?

  1. A.1
  2. B.3
  3. C.2✓ Correct
  4. D.4

Explanation

A deque can be implemented using 2 stacks, where each stack handles one end of the deque.

Report an error in this question

Linear Data StructuresHard

Q28. What is the space overhead per node in a doubly linked list compared to a singly linked list?

  1. A.One extra data field
  2. B.No extra overhead
  3. C.Two extra pointers
  4. D.One extra pointer✓ Correct

Explanation

A doubly linked list node has one extra pointer (previous pointer) compared to a singly linked list node.

Report an error in this question

Linear Data StructuresHard

Q29. What is the time complexity of merging two sorted linked lists into one sorted list?

  1. A.O(n × m)
  2. B.O(n + m)✓ Correct
  3. C.O(n log m)
  4. D.O(n^2)

Explanation

Merging two sorted linked lists can be done in O(n + m) time by comparing heads and advancing pointers, where n and m are the lengths.

Report an error in this question

Linear Data StructuresHard

Q30. What is a self-organizing list?

  1. A.A list that reorders based on access patterns✓ Correct
  2. B.A list that balances itself like a tree structure
  3. C.A list that maintains sorted order automatically
  4. D.A list that automatically deletes duplicate items

Explanation

A self-organizing list rearranges its nodes based on access frequency or recency (e.g., move-to-front, transpose) to speed up future accesses.

Report an error in this question

Ready to test yourself on Linear Data Structures?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start Linear Data Structures Quiz