What is a non-linear data structure?
A) Data elements are arranged in a sequential manner
B) Data elements are arranged in a hierarchical manner
C) Data elements are not arranged in a sequence
D) None of the above
Answer: C) Data elements are not arranged in a sequence
Which of the following is an example of a non-linear data structure?
A) Array
B) Stack
C) Tree
D) Queue
Answer: C) Tree
What type of tree has a maximum of two children per node?
A) Binary Tree
B) AVL Tree
C) B-Tree
D) Red-Black Tree
Answer: A) Binary Tree
What is the time complexity of searching for an element in a balanced binary search tree?
A) O(n)
B) O(log n)
C) O(n log n)
D) O(1)
Answer: B) O(log n)
Which of the following traversal methods is used for trees?
A) Linear Search
B) Pre-order
C) Random Access
D) None of the above
Answer: B) Pre-order
What is the height of a binary tree with n nodes in the worst case?
A) O(log n)
B) O(n)
C) O(n log n)
D) O(1)
Answer: B) O(n)
In a binary search tree, the left subtree of a node contains only nodes with values…
A) Greater than the node
B) Equal to the node
C) Less than the node
D) None of the above
Answer: C) Less than the node
Which of the following trees is self-balancing?
A) Binary Tree
B) B-Tree
C) AVL Tree
D) None of the above
Answer: C) AVL Tree
What is the primary characteristic of a heap?
A) Every node has at most two children
B) It is a complete binary tree
C) The parent node is always larger than its children (Max Heap)
D) All of the above
Answer: D) All of the above
What is the time complexity for inserting an element in a binary heap?
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: B) O(log n)
What is the maximum number of nodes at level k in a binary tree?
A) k
B) 2^k
C) 2^(k-1)
D) 2k
Answer: B) 2^k
Which of the following is a characteristic of a B-Tree?
A) Nodes can have multiple children
B) It is always a binary tree
C) It is unbalanced
D) None of the above
Answer: A) Nodes can have multiple children
What type of tree allows for efficient searching and insertion in logarithmic time?
A) Binary Tree
B) Binary Search Tree
C) AVL Tree
D) All of the above
Answer: D) All of the above
What is the primary purpose of a trie data structure?
A) Storing integers
B) Storing strings efficiently
C) Sorting numbers
D) None of the above
Answer: B) Storing strings efficiently
What is the worst-case time complexity for searching in a binary search tree?
A) O(log n)
B) O(n)
C) O(n log n)
D) O(1)
Answer: B) O(n)
Which traversal method visits all nodes of a binary tree?
A) Pre-order
B) In-order
C) Post-order
D) All of the above
Answer: D) All of the above
What is the main difference between a binary tree and a binary search tree?
A) Number of children per node
B) Order of elements
C) Height
D) None of the above
Answer: B) Order of elements
What is the average-case time complexity for deleting a node from a binary search tree?
A) O(n)
B) O(log n)
C) O(n log n)
D) O(1)
Answer: B) O(log n)
In a red-black tree, what is the maximum height relative to the number of nodes?
A) log n
B) 2 log n
C) n
D) n log n
Answer: B) 2 log n
What type of tree is used in databases to allow fast data retrieval?
A) Binary Tree
B) B-Tree
C) AVL Tree
D) Red-Black Tree
Answer: B) B-Tree
What is the primary characteristic of a leaf node in a tree?
A) It has no children
B) It has two children
C) It can only have one child
D) None of the above
Answer: A) It has no children
Which data structure is best suited for implementing priority queues?
A) Stack
B) Queue
C) Heap
D) Linked List
Answer: C) Heap
What is the main advantage of a self-balancing binary search tree?
A) Faster insertion
B) Lower memory usage
C) Maintains O(log n) height
D) Simplicity
Answer: C) Maintains O(log n) height
Which of the following is true for a full binary tree?
A) All nodes have zero or two children
B) All nodes have one child
C) It has a height of n
D) None of the above
Answer: A) All nodes have zero or two children
What is the depth of a binary tree?
A) Number of nodes
B) Number of edges from the root to the deepest leaf
C) Number of leaves
D) None of the above
Answer: B) Number of edges from the root to the deepest leaf
In a binary search tree, the in-order traversal will yield elements in…
A) Random order
B) Descending order
C) Ascending order
D) None of the above
Answer: C) Ascending order
Which of the following is NOT a property of a binary search tree?
A) The left child is less than the parent
B) The right child is greater than the parent
C) All children must be leaf nodes
D) Both A and B
Answer: C) All children must be leaf nodes
What is the time complexity of a level-order traversal of a binary tree?
A) O(n)
B) O(log n)
C) O(n log n)
D) O(n^2)
Answer: A) O(n)
Which of the following trees is used for efficient searching, insertion, and deletion?
A) Binary Tree
B) AVL Tree
C) Red-Black Tree
D) Both B and C
Answer: D) Both B and C
What is the maximum number of edges in a binary tree with n nodes?
A) n
B) n-1
C) 2n
D) 2n-1
Answer: B) n-1
In a trie, each node represents…
A) A character
B) A word
C) A number
D) A string
Answer: A) A character
Which of the following is true about B-trees?
A) They are always binary trees
B) They allow for efficient searching and insertion
C) They have a variable number of children per node
D) Both B and C
Answer: D) Both B and C
What is the main purpose of a binary heap?
A) Storing sorted data
B) Implementing a priority queue
C) Searching for elements
D) None of the above
Answer: B) Implementing a priority queue
Which of the following is NOT true about an AVL tree?
A) It is a type of binary search tree
B) It is always balanced
C) It can have nodes with up to two children
D) It can have varying heights
Answer: D) It can have varying heights
What is the main disadvantage of using a binary search tree?
A) Requires a lot of memory
B) Can become unbalanced
C) Limited searching capabilities
D) Cannot handle duplicates
Answer: B) Can become unbalanced
What type of tree is used for maintaining a sorted dataset?
A) Binary Tree
B) Binary Search Tree
C) AVL Tree
D) All of the above
Answer: D) All of the above
Basic Concepts
Non-Linear Data Structures MCQs
Sorting and Searching Algorithms MCQs
- Data Structures MCQs 1
- Data Structures MCQs 2
- Data Structures MCQs 3
- Data Structures MCQs 4
- Data Structures MCQs 5
- Stacks Solved MCQs
- Queues MCQs
- pointer mcqs
- Array MCQs