GATE 2017 Previous Year Paper Solution Question 7 – Computer Science
In this video the question which was asked in the exam of GATE 2017, has been discussed.
Question :- Consider the C code fragment given below
typedef struct node {
int data;
node* next;
} node;
void join(node*m, node*n) {
node*p = n;
Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will
1. append list m to the end of list n for all inputs.
2. either cause a null pointer dereference or append list m to the end of list n
3. cause a null pointer dereference for all inputs
4. append list n to the end of list m for all inputs
Solution is given in the video.