Question 8900 – Compiler-Design
May 7, 2024
Question 17374 – NTA UGC NET Dec 2023 Paper-2
May 8, 2024
Question 8900 – Compiler-Design
May 7, 2024
Question 17374 – NTA UGC NET Dec 2023 Paper-2
May 8, 2024

Question 6184 – UGC NET CS 2007-Dec-Paper-2

Consider the following linked list:

Which of the following piece of code will insert the node pointed to by q at the end of the list ?

Correct Answer: D

Question 12 Explanation: 
→ n order to add a new node to the end of the list, first we need to traverse the entire list.
→ To the traverse the list, we will take one pointer.
→ We will traverse the list till the end by moving the pointer to next node.
→ The pointer will point to the last node and from there the pointer next address will point to the new node.
Option D will provide the above steps.
Q
A
for (p=list; p !=NULL; p=p →next);
p=q;
B
for (p=list; p !=NULL; p=p →next);
p →next=q;
C
for (p=list; p →next!=NULL; p=p→next);
p=q;
D
for (p=list; p →next !=NULL; p=p →next);
p →next=q;
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!