DSA MIDTERM Flashcards
What is the characteristic behavior of a queue?
A. LIFO (Last In First Out)
B. FILO (First In Last Out)
C. FIFO (First In First Out)
D. Random Access
FIFO (First In First Out)
Which of the following operations adds an item to the end of a queue?
A. dequeue
B. enqueue
C. pop
D. front
enqueue
What does the dequeue() operation do in a queue?
A. Removes the item from the front
B. Adds an item to the rear
C. Checks if the queue is full
D. Returns the last item
Removes the item from the front
Which operation checks if a queue is empty?
A. get-size()
B. is-empty()
C. front()
D. back()
is-empty()
What is returned by the front() method in a queue?
A. The item at the front
B. The item at the back
C. The number of elements
D. A boolean value
The item at the front
What is the main disadvantage of using a linked list over an array?
A. Requires more memory due to pointers
B. Slower access to elements
C. Only stores primitive types
D. Can’t grow in size
Requires more memory due to pointers
Which type of linked list can only be traversed in one direction?
A. Singly Linked List
B. Doubly Linked List
C. Circular Linked List
D. Binary Tree
Singly Linked List
In a doubly linked list, each node contains:
A. One data field and one link
B. One data field and two links
C. Only links
D. One link and one method
One data field and two links
In a circular linked list, the last node points to:
A. NULL
B. Middle node
C. First node
D. Random node
First node
Which of the following is not a queue operation?
A. enqueue()
B. traverse()
C. dequeue()
D. front()
traverse()
What happens when a queue is full?
A. No more items can be enqueued
B. It resets
C. It removes the front item
D. It duplicates the rear item
No more items can be enqueued
Which method removes the front element without returning it?
A. pop()
B. dequeue()
C. front()
D. push()
pop()
What is the time complexity of insertion at the rear of a queue using a circular array?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
O(1)
What does the get-size() method return?
A. The last index
B. The number of elements in the queue
C. The queue capacity
D. Boolean value
The number of elements in the queue
What is the pointer to the first node in a linked list called?
A. HEAD
B. TAIL
C. START
D. NODE
HEAD
In a singly linked list, the last node points to:
A. First node
B. NULL
C. Head node
D. Itself
NULL
What type of linked list allows bidirectional traversal?
A. Singly linked list
B. Doubly linked list
C. Queue
D. Stack
Doubly linked list
Which type of linked list does not end in NULL?
A. Singly Linked List
B. Doubly Linked List
C. Circular Linked List
D. Static List
Circular Linked List
What is the main purpose of using a circular array in a queue?
A. Simplifies logic
B. Saves memory
C. Speeds up sorting
D. Avoids overflow
Saves memory
Which queue operation is equivalent to inserting at the end of the list?
A. enqueue
B. dequeue
C. front
D. pop
enqueue
A queue always allows insertions at the front.
T/F
False
A singly linked list node stores both data and a pointer to the next node.
True
Doubly linked lists require three references per node.
False
In a circular linked list, traversal can go infinitely if not properly terminated.
True