Q. In a doubly linked list, how many pointers does each node contain?
-
A.
One
-
B.
Two
-
C.
Three
-
D.
Four
Solution
Each node in a doubly linked list contains two pointers: one to the next node and one to the previous node.
Correct Answer:
B
— Two
Learn More →
Q. In a stack, which operation is performed in constant time?
-
A.
Push
-
B.
Pop
-
C.
Peek
-
D.
All of the above
Solution
All operations (Push, Pop, and Peek) in a stack are performed in constant time, O(1).
Correct Answer:
D
— All of the above
Learn More →
Q. What is the space complexity of a linked list with n nodes?
-
A.
O(1)
-
B.
O(n)
-
C.
O(n log n)
-
D.
O(n^2)
Solution
The space complexity of a linked list with n nodes is O(n) because each node requires space.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the time complexity of inserting an element at the end of a singly linked list?
-
A.
O(1)
-
B.
O(n)
-
C.
O(log n)
-
D.
O(n^2)
Solution
Inserting an element at the end of a singly linked list requires O(n) time if the tail pointer is not maintained.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of inserting an element at the end of a singly linked list?
-
A.
O(1)
-
B.
O(n)
-
C.
O(log n)
-
D.
O(n^2)
Solution
Inserting at the end of a singly linked list requires traversing the entire list, resulting in O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of searching for an element in a sorted array using binary search?
-
A.
O(n)
-
B.
O(log n)
-
C.
O(n log n)
-
D.
O(1)
Solution
The worst-case time complexity of binary search in a sorted array is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. Which data structure uses FIFO (First In First Out) principle?
-
A.
Stack
-
B.
Queue
-
C.
Array
-
D.
Linked List
Solution
A Queue uses the FIFO principle, where the first element added is the first one to be removed.
Correct Answer:
B
— Queue
Learn More →
Q. Which sorting algorithm is generally considered the most efficient for large datasets?
-
A.
Bubble Sort
-
B.
Insertion Sort
-
C.
Quick Sort
-
D.
Selection Sort
Solution
Quick Sort is generally considered the most efficient for large datasets due to its average time complexity of O(n log n).
Correct Answer:
C
— Quick Sort
Learn More →
Showing 1 to 8 of 8 (1 Pages)