Header Ads Widget

Algorithm multiple choice questions part-4

 Algorithm MCQs:-

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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.

  1. 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

  1. 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)

  1. 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)

  1. 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

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

Answer: b) Linked List

  1. 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)


  Pre  👈                                👉  Next  

 Similar posts:-

  1. C-programming MCQs part-1
  2. C-programming MCQs part-2
  3. C-programming MCQs part-3
  4. C-programming MCQs part-4
  5. C-programming MCQs part-5
  6. C-programming MCQs part-6
  7. COA MCQs part-1
  8. COA MCQs part-2
  9. COA MCQs part-3
  10. COA MCQs part-4

EasyCodingZone


Must check this :-

  1. Microprocessor 8085 MCQs part-1
  2. Microprocessor 8085 MCQs part-2
  3. Microprocessor 8085 MCQs part-3
  4. CSS MCQs part-1
  5. CSS MCQs part-2
  6. CSS MCQs part-3
  7. CSS MCQs part-4
  8. CSS MCQs part-5
  9. Engineering Mathematics -II MCQs part-1
  10. Engineering Mathematics -II MCQs part-2
  11. Engineering Mathematics -II MCQs part-3
  12. Engineering Mathematics -II MCQs part-4
  13. Engineering Mathematics -II MCQs part-5
  14. Operating system MCQs part-1
  15. Operating system MCQs part-2
  16. Operating system MCQs part-3
  17. Operating system MCQs part-4
  18. Operating system MCQs part-5



Post a Comment

0 Comments