0% found this document useful (0 votes)
27 views4 pages

Dsa Quize

Queues follow a FIFO principle, with elements inserted at the rear and deleted from the front. Circular queues are useful when array rotation is frequent, avoiding wasted space. Priority queues remove elements based on significance rather than order added.

Uploaded by

brianyeboah35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Dsa Quize

Queues follow a FIFO principle, with elements inserted at the rear and deleted from the front. Circular queues are useful when array rotation is frequent, avoiding wasted space. Priority queues remove elements based on significance rather than order added.

Uploaded by

brianyeboah35
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Which data structure follows a FIFO


principle? 6. Which of the following is not a type of
A) Stack queue?
B) Array A) Circular Queue
C) Queue B) LIFO Queue
D) Tree C) Priority Queue
D) Double-Ended Queue
2. In which of the following types of queues can
you insert or delete elements from both the front 7. When using a circular queue, what does it
and rear? mean when the front and rear pointers are at the
A) Simple Queue same position?
B) Circular Queue A) The queue is full.
C) Priority Queue B) Only one element exists in the queue.
D) Double-Ended Queue C) The queue is empty.
D) The queue is corrupted.
3. In a priority queue:
A) Elements are removed based on their 8. In which data structure is the place of
significance. insertion different from the place of deletion?
B) First entered element is always A) Stack
removed first. B) Array
C) Last entered element is always C) Linked List
removed first. D) Queue
D) All elements are removed at once.
9. How is a full circular queue differentiated
3. In which scenario is a circular queue from an empty one, given that in both cases, the
especially useful? front pointer might equal the rear pointer?
A) When priorities are assigned to A) By moving the rear pointer back by
elements. one.
B) When there's frequent memory B) By using a counter to track the
allocation and deallocation. number of elements.
C) When there's a need to avoid wastage C) By checking the next position of the
of space in scenarios where array rear.
rotation might be frequent. D) By asking the user.
D) When only the front end is used for
insertions and deletions. 10. Which of the following scenarios is an ideal
use case for a priority queue?
4. Which of the following is a primary use of A) Handling interrupt routines in real-
queues? time systems.
A) To backtrack. B) Storing data in hierarchical order.
B) To store hierarchical data. C) Implementing a web browser's back
C) To ensure data is processed in a LIFO button.
manner. D) Balancing load in computational
D) To manage tasks in the order they problems.
arrive.
11. In a double-ended queue, if you can only
5. What happens when you try to dequeue an insert at the rear and delete from the front, it
empty queue? essentially acts as a:
A) The queue overflows. A) Stack
B) The first element from the previous B) Array
queue is returned. C) Simple Queue
C) An underflow condition arises. D) Priority Queue
D) A new queue is automatically
created.
12. Which operation is not applicable to a 23. Which tree structure is used extensively for
simple queue? Chose 2 database indexing?
A) enqueue at the rear A) Binary Tree
B) dequeue from the front B) AVL Tree
C) enqueue at the front C) Trie
D) dequeue from the rear D) B-Tree

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:

50. In the tree traversal method that visits the


root node first, followed by the left and right
subtrees, the traversal method is called ______.

51. Which of the following traversals visits the


nodes level by level?
A) Preorder
B) Inorder
C) Postorder
D) Level-order

52. Given a tree traversal order: DBEAFCG,


which traversal method corresponds to this if
the inorder traversal is ABDECFG?
A) Preorder

You might also like