Types: Linear vs Non-Linear # MCQs Practice set

Q.1 Which of the following is a linear data structure?

Tree
Graph
Queue
Binary Search Tree
Explanation - A linear data structure stores data in a sequential manner. Queue is a linear data structure because elements are stored in a sequence.
Correct answer is: Queue

Q.2 Which data structure organizes data hierarchically?

Array
Linked List
Tree
Stack
Explanation - A tree is a non-linear data structure that arranges data hierarchically with a root and child nodes.
Correct answer is: Tree

Q.3 Which of the following is non-linear in nature?

Stack
Queue
Graph
Array
Explanation - Graph is a non-linear data structure where data elements are connected through edges, not sequentially.
Correct answer is: Graph

Q.4 In which data structure does each element point to the next element?

Array
Linked List
Binary Tree
Graph
Explanation - A linked list is a linear data structure where each node contains data and a pointer to the next node.
Correct answer is: Linked List

Q.5 Which data structure is suitable for implementing recursion?

Stack
Queue
Graph
Tree
Explanation - Stacks follow LIFO order, which aligns with the execution of recursive function calls.
Correct answer is: Stack

Q.6 Which of the following allows insertion and deletion at both ends?

Queue
Deque
Stack
Array
Explanation - Deque (Double Ended Queue) allows insertion and deletion at both the front and rear ends.
Correct answer is: Deque

Q.7 Which data structure can be represented using adjacency list or adjacency matrix?

Stack
Queue
Graph
Linked List
Explanation - Graphs can be represented using adjacency lists or adjacency matrices depending on the connections between nodes.
Correct answer is: Graph

Q.8 Which data structure is used for breadth-first traversal?

Stack
Queue
Linked List
Array
Explanation - Breadth-first traversal of trees and graphs uses a queue to process nodes level by level.
Correct answer is: Queue

Q.9 Which data structure is primarily hierarchical?

Stack
Queue
Tree
Array
Explanation - Trees store elements in a hierarchy with parent-child relationships.
Correct answer is: Tree

Q.10 Which data structure does not store elements in sequential order?

Array
Linked List
Graph
Queue
Explanation - Graphs store elements in a network of nodes and edges, not in a sequence.
Correct answer is: Graph

Q.11 Which of the following is a linear collection of elements?

Graph
Stack
Tree
Heap
Explanation - Stack is a linear data structure with elements arranged sequentially and accessed via LIFO order.
Correct answer is: Stack

Q.12 Which is an example of a non-linear data structure?

Array
Linked List
Queue
Binary Tree
Explanation - A binary tree is non-linear because each node can have multiple child nodes, creating a hierarchical structure.
Correct answer is: Binary Tree

Q.13 In which data structure do elements follow FIFO principle?

Stack
Queue
Graph
Tree
Explanation - Queue follows First In First Out (FIFO) order, where elements are processed in the order they arrive.
Correct answer is: Queue

Q.14 Which of the following data structures is non-linear?

Array
Linked List
Heap
Stack
Explanation - Heap is a non-linear tree-based structure used for priority management.
Correct answer is: Heap

Q.15 Which linear data structure allows deletion only from one end?

Stack
Queue
Deque
Linked List
Explanation - Stack allows deletion only from the top, following LIFO order.
Correct answer is: Stack

Q.16 Which data structure is best for hierarchical relationships?

Stack
Queue
Tree
Array
Explanation - Trees are ideal for representing hierarchical data like organization charts or file systems.
Correct answer is: Tree

Q.17 Which of the following is suitable for implementing undo operations in editors?

Queue
Stack
Tree
Graph
Explanation - Undo operations follow LIFO order, making stack the ideal choice.
Correct answer is: Stack

Q.18 Which data structure represents a collection of nodes connected by edges?

Stack
Queue
Graph
Array
Explanation - Graphs are non-linear structures where nodes (vertices) are connected by edges.
Correct answer is: Graph

Q.19 Which linear data structure is used for breadth-first search?

Stack
Queue
Tree
Graph
Explanation - Breadth-first search uses a queue to process nodes level by level.
Correct answer is: Queue

Q.20 Which data structure allows efficient insertion, deletion, and searching in hierarchical data?

Array
Stack
Tree
Queue
Explanation - Tree structures allow efficient hierarchical operations like insertion, deletion, and search in logarithmic time in many cases.
Correct answer is: Tree