Dsa Quize
Dsa Quize
13. A real-world example of a priority queue is: 24. In which data structure are the keys stored to
A) A playlist of songs playing in allow for fast retrieval of associated values?
sequence. A) Suffix Tree
B) An emergency room where critical B) Trie (Prefix Tree)
patients are treated C) AVL Tree
D) N-ary Tree
18. Which of the following structures allows
you to store two types of priorities - one at the 25. Which tree data structure is used to store the
start and one at the end? set of all possible suffixes of a string?
A) Priority Queue A) Binary Search Tree
B) Simple Queue B) Trie
C) Double-Ended Priority Queue C) Suffix Tree
D) Circular Queue D) AVL Tree
19. If we are deleting an element from a non- 26. Which of the following is not a property of a
empty queue and adding it to the rear, which binary tree?
type of queue are we likely simulating? A) Every node has at most two children.
A) Priority Queue B) It can be entirely traversed starting
B) Simple Queue from any node.
C) Circular Queue C) It does not contain cycles.
D) Double-Ended Queue D) The nodes contain an element, and
optionally, links to left and right child
20. In a binary search tree, where would you nodes.
expect to find a node with a value smaller than
the root node? 27. In a complete binary tree, every level,
A) Right subtree except possibly the last, is completely filled, and
B) It could be anywhere in the tree all nodes are as:
C) Left subtree A) Left as possible
D) As a sibling of the root node B) Scattered uniformly
C) Right as possible
21. Which of the following trees ensures that the D) Found in the center
tree remains balanced after every insert and
delete operation? 28. What does the "N" in an N-ary tree
A) Binary Tree represent?
B) N-ary Tree A) Number of levels in the tree
C) AVL Tree B) Number of nodes in the tree
D) Trie C) Maximum number of children a node
can have
22. In a max-heap, the value of each parent node D) The total number of trees
is
A) Any random order 29. Trees used in the networking sector for
B) Greater than or equal to its children broadcasting are:
C) Lesser than its children A) AVL trees
D) Equal to the average of its children B) Spanning trees
C) Red-Black trees
D) B-trees
36. What is the minimum possible height of an
30. Which tree is especially useful in situations AVL tree with 64 nodes?
where the dataset is dynamic and the A) 5
information in stored keys is continually B) 6
changing? C) 7
A) Trie D) 8
B) B-tree
C) Splay tree 37 In a binary tree with 'n' nodes, how many
D) Binary Search Tree edges will it have?
A) n-2
31. Which of the following is false about a red- B) n
black tree? C) n+1
A) It ensures that the tree remains D) n-1
approximately balanced.
B) The nodes are colored, either red or 38. Which tree is useful for hierarchical data
black. such as folder structures?
C) Every leaf node is red. A) Heap
D) From any node, the paths to its B) N-ary Tree
descendant leaves have the same black C) Red-Black Tree
node count. D) Trie
32.Which data structure is essential for 39. A self-adjusting binary search tree, which
algorithms used in many spell-checkers? performs rotations to balance itself after every
A) N-ary tree insert or delete operation, is called:
B) Trie A) B-tree
C) AVL tree B) Splay tree
D) Heap C) AVL tree
D) Trie
33. Which of the following traversal methods is
used to get nodes of a binary search tree in 40. A node in a tree has a degree of 3. This
ascending order? means:
A) Preorder A) The node has 3 parents.
B) Postorder B) The tree has 3 levels.
C) Inorder C) The node has 3 children.
D) Level-order D) The tree has 3 nodes.
34. In the worst-case scenario, the time 41. In which tree structure is the height of the
complexity of searching for an element in a left and right subtrees for every node, differing
balanced binary search tree is: by at most 1?
A) O(n) A) Binary Search Tree
B) O(1) B) N-ary Tree
C) O(log n) C) AVL Tree
D) O(n^2) D) B-tree
35. Which of the following tree traversal 42. What is a leaf node?
methods visits the root node first, then the left A) A node with exactly one child.
subtree, and finally the right subtree? B) A node with no children.
A) Inorder C) The topmost node in a tree.
B) Preorder D) A node with two children.
C) Postorder
D) Level-order 43. If a node in a tree has no siblings, it implies:
A) It is the only child of its parent.
B) It is a root node.
C) It has no children. B) Postorder
D) It is part of a binary tree. C) Both A and B
D) None of the above
44. In a heap data structure, if a node is found at
position 'i', where can its left child be found? 53. For constructing a binary tree uniquely,
A) Position 2i which traversals are necessarily required?
B) Position i+1 A) Preorder and Inorder
C) Position 2i+1 B) Postorder and Preorder
D) Position i/2 C) Inorder and Level-order
D) Inorder and Postorder
45. Which tree traversal produces nodes in a
non-decreasing order for a Binary Search Tree? 54. If you're using tree traversal to evaluate an
A) Preorder expression tree (like those used in mathematical
B) Inorder operations), which traversal is most commonly
C) Postorder used?
D) Level-order A) Preorder
B) Inorder
46. In which traversal are nodes visited before C) Postorder
their descendants? D) Level-order
A) Preorder
B) Inorder 55. The traversal method where every node's
C) Postorder left subtree is traversed before its right subtree
D) None of the above and ends up visiting the node itself last is called
______.
47. Which traversal can be used to delete a tree
(i.e., free up its nodes)? 56. If you're traversing a tree in such a way that
A) Preorder the current node is visited before its left subtree
B) Inorder and then its right subtree, the traversal is known
C) Postorder as ______.
D) Level-order
57. In ______ traversal, nodes at the deepest
48. In a Binary Search Tree, the ______ level are visited before nodes at higher levels.
traversal results in a non-decreasing order of In a tree with multiple levels, a traversal
node values. that visits all nodes of a particular level
before moving to the next level is termed
49. In ______ traversal, a node's left subtree is as ______ traversal.
traversed before the node itself. Answers: