MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is true about linked list implementation of queue?
A
In the push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
B
In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
C
None of the above
D
None of the above
Explanation: 

Detailed explanation-1: -both (a) and (b) are correct. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.

Detailed explanation-2: -Queue supports operations like enqueue and dequeue. It can be implemented using an array and linked list.

Detailed explanation-3: -Answer. The following is true about linked list implementation of stack. If new nodes are added to the linked list’s beginning during a push operation, nodes must be removed from the end during a pop operation.

Detailed explanation-4: -Linked list consists of nodes where each node contains one or more data fields and a reference(link) to the next node. Explanation: Linked lists saves both space and time. 6.

Detailed explanation-5: -Random access of elements at a linked list is not possible. Arrays have better cache locality than linked list. The size of linked list is dynamic and can be changed as needed. Answer: D) Explanation: All of the above statements are true.

There is 1 question to complete.