Q. What is the primary advantage of using a queue over an array?
-
A.
Faster access
-
B.
Dynamic size
-
C.
FIFO order
-
D.
Less memory usage
Solution
A queue operates on a First-In-First-Out (FIFO) basis, which is its primary advantage over arrays.
Correct Answer:
C
— FIFO order
Learn More →
Q. What is the primary advantage of using a stack?
-
A.
FIFO order
-
B.
LIFO order
-
C.
Dynamic resizing
-
D.
Random access
Solution
A stack operates on a Last In, First Out (LIFO) principle, allowing the most recently added element to be accessed first.
Correct Answer:
B
— LIFO order
Learn More →
Q. What is the time complexity of inserting an element at the beginning of a singly linked list?
-
A.
O(1)
-
B.
O(n)
-
C.
O(log n)
-
D.
O(n log n)
Solution
Inserting an element at the beginning of a singly linked list takes constant time, hence O(1).
Correct Answer:
A
— O(1)
Learn More →
Q. Which data structure is best suited for implementing a queue?
-
A.
Array
-
B.
Linked List
-
C.
Stack
-
D.
Both Array and Linked List
Solution
Both arrays and linked lists can be used to implement a queue, as they can efficiently support FIFO operations.
Correct Answer:
D
— Both Array and Linked List
Learn More →
Q. Which of the following is a disadvantage of using a linked list over an array?
-
A.
Dynamic size
-
B.
Ease of insertion/deletion
-
C.
Memory overhead
-
D.
Random access
Solution
Linked lists do not allow random access to elements, unlike arrays which provide direct access via indices.
Correct Answer:
D
— Random access
Learn More →
Q. Which of the following is true about a circular linked list?
-
A.
It has a null reference
-
B.
It can be traversed in one direction only
-
C.
It can be traversed in both directions
-
D.
The last node points to the first node
Solution
In a circular linked list, the last node points back to the first node, creating a circular structure.
Correct Answer:
D
— The last node points to the first node
Learn More →
Q. Which of the following sorting algorithms has the best average-case time complexity?
-
A.
Bubble Sort
-
B.
Insertion Sort
-
C.
Quick Sort
-
D.
Selection Sort
Solution
Quick Sort has the best average-case time complexity of O(n log n) among the given sorting algorithms.
Correct Answer:
C
— Quick Sort
Learn More →
Showing 1 to 7 of 7 (1 Pages)