MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which one of the following node is considered the top of the stack if the stack is implemented using the linked list?
A
First node
B
Second node
C
Third node
D
none of the above
Explanation: 

Detailed explanation-1: -Explanation: First node is considered as the top element when stack is implemented using linked list.

Detailed explanation-2: -It is easiest and most efficient to add and remove items at the front of a linked list, therefore, we will choose the front of the list as the top of the stack (i.e., the items field will be a pointer to the node that contains the top-of-stack item).

Detailed explanation-3: -A stack has a restriction that insertion and deletion of element can only be done from only one end of stack and we call that position as top. The element at top position is called top element.

Detailed explanation-4: -* Which of the following can be used to implement stack? Stack can be implemented using array and linked list. * The process of adding/inserting a new data element in a stack is known as push. The process of deleting/removing a new data element from the stack is known as pop.

Detailed explanation-5: -Which of the following is true about linked list implementation of stack? (A) In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.

There is 1 question to complete.