Q. What is the worst-case time complexity for searching 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
Binary search has a worst-case time complexity of O(log n) for searching in a sorted array.
Correct Answer:
B
— O(log n)
Learn More →
Q. Which of the following is true about a queue?
-
A.
LIFO structure
-
B.
FIFO structure
-
C.
Random access
-
D.
None of the above
Solution
A queue is a FIFO (First In, First Out) data structure.
Correct Answer:
B
— FIFO structure
Learn More →
Q. Which of the following is true about linked lists compared to arrays?
-
A.
Linked lists have a fixed size
-
B.
Arrays allow dynamic resizing
-
C.
Linked lists allow efficient insertions/deletions
-
D.
Arrays are more memory efficient
Solution
Linked lists allow efficient insertions and deletions as they do not require shifting elements like arrays do.
Correct Answer:
C
— Linked lists allow efficient insertions/deletions
Learn More →
Showing 1 to 3 of 3 (1 Pages)