Question 8900 – Compiler-Design
May 7, 2024Question 17374 – NTA UGC NET Dec 2023 Paper-2
May 8, 2024Question 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
→ 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
for (p=list; p !=NULL; p=p →next);
p=q;
p=q;
for (p=list; p !=NULL; p=p →next);
p →next=q;
p →next=q;
for (p=list; p →next!=NULL; p=p→next);
p=q;
p=q;
for (p=list; p →next !=NULL; p=p →next);
p →next=q;
p →next=q;
Subscribe
Login
0 Comments