Answer Key
University
California State UniversityCourse
COMP 182 | Data Structures and Program Design and LabPages
8
Academic year
2022
NyiH
Views
19
The data structure required for Breadth First Traversal on a graph is? Stack Array Queue Tree
A queue follows ___ FIFO (First In First Out) principle LIFO (Last In First Out) principle Ordered array Linear tree
If the elements "A", "B", "C" and "D" are placed in a queue and are deleted one at a time, in what order will they be removed? ABCD DCBA DCAB ABDC
A normal queue, if implemented using an array of size MAX_SIZE, gets full when? Rear = MAX_SIZE - 1 Front = (rear + 1)mod MAX_SIZE Front = rear + 1 Rear = front
What is the time complexity to insert a node based on key in a priority queue? O(nlogn) O(logn) O(n) O(n2)
What is not a disadvantage of priority scheduling in operating systems? A low priority process might have to wait indefinitely for the CPU If the system crashes, the low priority systems may be lost permanently Interrupt handling Indefinite blocking
In linked list implementation of a queue, from where is the item deleted? At the head of link list At the centre position in the link list At the tail of the link list Node before the tail
In linked list implementation of a queue, where does a new element be inserted? At the head of link list At the centre position in the link list At the tail of the link list At any position in the linked list
What is the space complexity of a linear queue having n elements? O(n) O(nlogn) O(logn) O(1)
What is the need for a circular queue? effective usage of memory easier computations to delete elements based on priority implement LIFO principle in queues
What is the term for inserting into a full queue known as? overflow underflow null pointer exception program won't be compiled
What is the time complexity to insert a node based on position in a priority queue? O(nlogn) O(logn) O(n) O(n2)
With what data structure can a priority queue be implemented? Array List Heap Tree
Which of the following is not the type of queue? Ordinary queue Single ended queue Circular queue Priority queue
COMP 182 Quiz 3: Queue
Please or to post comments