Queue and Linked List MCQs

Queue and Linked List MCQs

 Q1. The data structure required for Breadth First Traversal on a graph is?. 

A. Stack. 

B. Array. 

C. Queue

D. Tree. 

Answer= 

Que


Q2. A Queue is a ?. 

A. FIFO (First In First Out) list. 

B. LIFO (Last In First Out) list. 

C. Ordered array. 

D. Linear tree. 

Answer= FIFO (First In First Out) list


Q3. In Breadth First Search of Graph, which of the following data structure is used?. 

A. Stack. 

B. Queue 

C. Linked list. 

D. None of the mentioned. 

Answer= 

Que


Q4. If the elements "A", "B", "C" and "D" are placed in a Que and are deleted one at a time, in what order will they be removed?. 

A. ABCD. 

B. DCBA. 

C. DCAB. 

D. ABDC. 

Answer= ABCD


Q5. A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?. 

A. 

Que. 

B. Circular Queue. 

C. DeQueue. 

D. Priority Queue. 

Answer= DeQueue


Q6. A normal Queue, if implemented using an array of size MAX_SIZE, gets full when. 

A. Rear = MAX_SIZE - 1. 

B. Front = (rear + 1)mod MAX_SIZE. 

C. Front = rear + 1. 

D. Rear = front. 

Answer= Rear = MAX_SIZE - 1


Q7. Queues serve major role in. 

A. Simulation of recursion. 

B. Simulation of arbitrary linked list. 

C. Simulation of limited resource allocation. 

D. All of the mentioned. 

Answer= Simulation of limited resource allocation


Q8. Which of the following is not the type of Queue?. 

A. Ordinary Queue. 

B. Single ended Queue. 

C. Circular Queue. 

D. Priority Queue. 

Answer= Single ended Queue


Q9. Which of the following is not a disadvantage to the usage of array?. 

A. Fixed size. 

B. You know the size of the array prior to allocation. 

C. Insertion based on position. 

D. Accessing elements at specified positions. 

Answer= Accessing elements at specified positions


Q10. What is the time complexity of inserting at the end in dynamic arrays?. 

A. O(1). 

B. O(n). 

C. O(logn). 

D. Either O(1) or O(n). 

Answer= Either O(1) or O(n)


Q11. What is the time complexity to count the number of elements in the linked list?. 

A. O(1). 

B. O(n). 

C. O(logn). 

D. None of the mentioned. 

Answer= O(n)


Q12. What is the space complexity for deleting a linked list?. 

A. O(1). 

B. O(n). 

C. Either O(1) or O(n). 

D. O(logn). 

Answer= O(1)


Q13. A linear collection of data elements where the linear node is given by means of pointer is called?. 

A. Linked list. 

B. Node list. 

C. Primitive list. 

D. None of the mentioned. 

Answer= Linked list


Q14. In linked list each node contain minimum of two fields. One field is data field to store the data second field is?. 

A. Pointer to character. 

B. Pointer to integer. 

C. Pointer to node. 

D. Node. 

Answer= Pointer to node


Q15. What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?. 

A. O(1). 

B. O(n). 

C. ?(n). 

D. ?(1). 

Answer= ?(n)


Q16. What would be the asymptotic time complexity to add an element in the linked list?. 

A. O(1). 

B. O(n). 

C. O(n2). 

D. None of the mentioned. 

Answer= O(n)


Q17. What would be the asymptotic time complexity to find an element in the linked list?. 

A. O(1). 

B. O(n). 

C. O(n2). 

D. None of the mentioned. 

Answer= O(n)


Q18. What would be the asymptotic time complexity to insert an element at the second position in the linked list?. 

A. O(1). 

B. O(n). 

C. O(n2). 

D. None of the mentioned. 

Answer= O(1)


Q19. The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?. 

A. Singly linked list. 

B. Doubly linked list. 

C. Circular doubly linked list. 

D. Array implementation of list. 

Answer= Circular doubly linked list


Q20. What kind of linked list is best to answer Qstion like "What is the item at position n?". 

A. Singly linked list. 

B. Doubly linked list. 

C. Circular linked list. 

D. Array implementation of linked list. 

Answer= Array implementation of linked list


Q21. Linked lists are not suitable to for the implementation of?. 

A. Insertion sort. 

B. Radix sort. 

C. Polynomial manipulation. 

D. Binary search. 

Answer= Binary search


Q22. Linked list is considered as an example of ___________ type of memory allocation.. 

A. Dynamic. 

B. Static. 

C. Compile time. 

D. None of the mentioned. 

Answer= Dynamic


Q23. In Linked List implementation, a node carries information regarding. 

A. Data. 

B. Link. 

C. Data and Link. 

D. None of the mentioned. 

Answer= Link


Q24. Linked list data structure offers considerable saving in. 

A. Computational Time. 

B. Space Utilization. 

C. Space Utilization and Computational Time. 

D. None of the mentioned. 

Answer= Space Utilization and Computational Time


Q25. Which of the following points is/are true about Linked List data structure when it is compared with array. 

A. Arrays have better cache locality that can make them better in terms of performance. 

B. It is easy to insert and delete elements in Linked List. 

C. Random access is not allowed in a typical implementation of Linked Lists. 

D. All of the mentioned. 

Answer= All of the mentioned


Q26. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?. 

A. Insertion Sort. 

B. Quick Sort. 

C. Heap Sort. 

D. Merge Sort. 

Answer= Merge Sort


Q27. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is. 

A. log 2 n. 

B. n/2. 

C. log 2 n - 1. 

D. n. 

Answer= n


Q28. Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not given, can we delete the node X from given linked list?. 

A. Possible if X is not last node. 

B. Possible if size of linked list is even. 

C. Possible if size of linked list is odd. 

D. Possible if X is not first node. 

Answer= Possible if X is not last node


Q29. You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?. 

A. Delete the first element. 

B. Insert a new element as a first element. 

C. Delete the last element of the list. 

D. Add a new element at the end of the list. 

Answer= Delete the last element of the list


Q30. Which of the following is false about a doubly linked list?. 

A. We can navigate in both the directions. 

B. It requires more space than a singly linked list. 

C. The insertion and deletion of a node take a bit longer. 

D. None of the mentioned. 

Answer= None of the mentioned


Q31. What is a memory efficient double linked list?. 

A. Each node has only one pointer to traverse the list back and forth. 

B. The list has breakpoints for faster traversal. 

C. An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list. 

D. None of the mentioned. 

Answer= Each node has only one pointer to traverse the list back and forth


Q32. How do you calculate the pointer difference in a memory efficient double linked list?. 

A. head xor tail. 

B. pointer to previous node xor pointer to next node. 

C. pointer to previous node - pointer to next node. 

D. pointer to next node - pointer to previous node. 

Answer= pointer to previous node xor pointer to next node


Q33. What is the time complexity of inserting a node in a doubly linked list?. 

A. O(nlogn). 

B. O(logn). 

C. O(n). 

D. O(1). 

Answer= O(n)


Q34. What differentiates a circular linked list from a normal linked list?. 

A. You cannot have the 'next' pointer point to null in a circular linked list. 

B. It is faster to traverse the circular linked list. 

C. You may or may not have the 'next' pointer point to null in a circular linked list. 

D. All of the mentioned. 

Answer= You may or may not have the 'next' pointer point to null in a circular linked list


Q35. What is the time complexity of searching for an element in a circular linked list?. 

A. O(n). 

B. O(nlogn). 

C. O(1). 

D. None of the mentioned. 

Answer= O(n)


Q36. Which of the following application makes use of a circular linked list?. 

A. Undo operation in a text editor. 

B. Recursive function calls. 

C. Allocating CPU to resources. 

D. All of the mentioned. 

Answer= Allocating CPU to resources


Q37. Which of the following is false about a circular linked list?. 

A. Every node has a successor. 

B. Time complexity of inserting a new node at the head of the list is O(1). 

C. Time complexity for deleting the last node is O(n). 

D. None of the mentioned. 

Answer= Time complexity of inserting a new node at the head of the list is O(1)


Q38. Consider a small circular linked list. How to detect the presence of cycles in this list effectively?. 

A. Keep one node as head and traverse another temp node till the end to check if its 'next points to head. 

B. Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer advancing by one node at a time. 

C. Cannot determine, you have to pre-define if the list contains cycles. 

D. None of the mentioned. 

Answer= Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer advancing by one node at a time

Previous Post Next Post