Multiple choice

A link list contains following items:

The first item in link list is A, second is B, third is C, fourth is D and fifth is E. Here, A is pointing to B, B is pointing to C, C is pointing to D and D is pointing to E and E is the last item. Its link part contains NULL. What will be the output after the following sequence of steps? (First is the pointer pointing to first element)

  1. struct NODE*P;
  2. P=First->next->next;
  3. First->next->next=P->next;
  4. P->next->next=P;
  5. printf(%d,First->next->next->next->info);

  1. C

  2. A

  3. D

  4. E

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In link list, when value is assigned, its link part is updated. As after step 2, P is pointing to C, after third step, B is pointing to D, after 4th step, D's link is updated with C and in 5th step, P is pointing to C, so C will be printed. In linklist when value is assigned, Its link part is updated.

As After step 2 P is pointing to C.After third step B is pointing to DAfter 4th step D's link is updated with CAnd 5th step P is pointing to C So C is printed.