 Open in App
Not now

# ISRO | ISRO CS 2013 | Question 4

• Last Updated : 03 May, 2018

The following steps in a linked list

```p = getnode()
info (p) = 10
next (p) = list
list = p```

result in which type of operation?

(A)

pop operation in stack

(B)

removal of a node

(C)

inserting a node at beginning

(D)

modifying an existing node

Explanation:

The given steps result in the insertion of a new node at the beginning of a linked list.

The first step p = getnode() creates a new node p using the getnode() function (assuming it is defined elsewhere).

The second step info (p) = 10 sets the info field of the new node p to the value 10.

The third step next (p) = list sets the next field of the new node p to the current head of the linked list, which is pointed to by the list pointer.

Finally, the fourth step list = p updates the list pointer to point to the newly inserted node p, effectively making it the new head of the linked list.

Therefore, this sequence of steps performs an insertion operation at the beginning of the linked list, also known as a push operation.

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up