## __Algorithm MCQs:-__

- What is a tree data structure? a) A linear data structure b) A hierarchical data structure c) A non-linear data structure d) Both b and c

**Answer: d) Both b and c**

- Which of the following is a depth-first traversal method in a tree? a) Breadth-first b) Inorder c) Topological sort d) None of the above

**Answer: b) Inorder**

- What is the property of a binary search tree? a) The left subtree contains only nodes with keys greater than the node's key b) The right subtree contains only nodes with keys less than the node's key c) The left and right subtrees each must be a binary search tree d) Both b and c

**Answer: d) Both b and c**

- Which of the following is a self-balancing binary search tree? a) AVL tree b) B-Tree c) Both a and b d) None of the above

**Answer: c) Both a and b**

- What is the maximum number of children that a node can have in a binary tree? a) 1 b) 2 c) 3 d) There is no limit

**Answer: b) 2**

- Which traversal method visits the root node first, then the left subtree and finally the right subtree? a) Inorder b) Preorder c) Postorder d) Level order

**Answer: b) Preorder**

- What is the difference between a binary tree and a binary search tree? a) A binary tree can have duplicate nodes, while a binary search tree cannot. b) A binary tree can have any arrangement of its nodes, while a binary search tree must follow a specific property. c) Both a and b d) None of the above

**Answer: b) A binary tree can have any arrangement of its nodes, while a binary search tree must follow a specific property.**

- Which of the following is a self-balancing search tree used to reduce the number of disk accesses? a) AVL tree b) B-Tree c) Red-Black tree d) None of the above

**Answer: b) B-Tree**

- What is the time complexity of insertion in a binary search tree? a) O(1) b) O(n) c) O(log n) d) O(n log n)

**Answer: c) O(log n)**

- What is the maximum number of swaps required in a bubble sort to sort an array of n elements? a) Î˜(n) b) Î˜(n2) c) Î˜(n log n) d) Î˜(1)

**Answer: b) Î˜(n2)**

- Which traversal method visits the left subtree, then the right subtree, and finally the root node? a) Inorder b) Preorder c) Postorder d) Level order

**Answer: c) Postorder**

- Which data structure is used to implement a binary search tree? a) Array b) Linked List c) Queue d) Stack

**Answer: b) Linked List**

- What is the maximum number of swaps required in an insertion sort to sort an array of n elements? a) Î˜(n) b) Î˜(n2) c) Î˜(n log n) d) Î˜(1)

**Answer: b) Î˜(n2)**

__ Similar posts:-__

- C-programming MCQs part-1
- C-programming MCQs part-2
- C-programming MCQs part-3
- C-programming MCQs part-4
- C-programming MCQs part-5
- C-programming MCQs part-6
- COA MCQs part-1
- COA MCQs part-2
- COA MCQs part-3
- COA MCQs part-4

__Must check this :-__

__Must check this :-__

- Microprocessor 8085 MCQs part-1
- Microprocessor 8085 MCQs part-2
- Microprocessor 8085 MCQs part-3
- CSS MCQs part-1
- CSS MCQs part-2
- CSS MCQs part-3
- CSS MCQs part-4
- CSS MCQs part-5
- Engineering Mathematics -II MCQs part-1
- Engineering Mathematics -II MCQs part-2
- Engineering Mathematics -II MCQs part-3
- Engineering Mathematics -II MCQs part-4
- Engineering Mathematics -II MCQs part-5
- Operating system MCQs part-1
- Operating system MCQs part-2
- Operating system MCQs part-3
- Operating system MCQs part-4
- Operating system MCQs part-5

## 0 Comments