Q. What is the primary characteristic of a queue?
-
A.
Last In First Out
-
B.
First In First Out
-
C.
Random Access
-
D.
Sorted Order
Solution
A queue operates on a First In First Out (FIFO) basis, meaning the first element added is the first one to be removed.
Correct Answer:
B
— First In First Out
Learn More →
Q. What is the worst-case time complexity of Quick Sort?
-
A.
O(n log n)
-
B.
O(n^2)
-
C.
O(n)
-
D.
O(log n)
Solution
The worst-case time complexity of Quick Sort occurs when the pivot selection is poor, leading to O(n^2) performance.
Correct Answer:
B
— O(n^2)
Learn More →
Q. Which data structure is used to implement a breadth-first search (BFS) algorithm?
-
A.
Stack
-
B.
Queue
-
C.
Array
-
D.
Linked List
Solution
A Queue is used to implement the breadth-first search (BFS) algorithm to explore nodes level by level.
Correct Answer:
B
— Queue
Learn More →
Q. Which of the following is a characteristic of a doubly linked list?
-
A.
Each node has one pointer
-
B.
Nodes can be traversed in both directions
-
C.
It uses less memory than a singly linked list
-
D.
It cannot be used to implement a stack
Solution
A doubly linked list allows traversal in both directions because each node contains two pointers, one to the next node and one to the previous node.
Correct Answer:
B
— Nodes can be traversed in both directions
Learn More →
Q. Which traversal method is used to visit all nodes in a binary tree?
-
A.
In-order
-
B.
Pre-order
-
C.
Post-order
-
D.
All of the above
Solution
All of the mentioned traversal methods (In-order, Pre-order, Post-order) can be used to visit all nodes in a binary tree.
Correct Answer:
D
— All of the above
Learn More →
Showing 1 to 5 of 5 (1 Pages)