A doubly linked list is declared as struct Node { int Value; struct Node *Fwd;…

ISRO Scientist/Engineer SC · 2018 · Computer Science

A doubly linked list is declared as

struct Node {
    int Value;
    struct Node *Fwd;
    struct Node *Bwd;
};

Where Fwd and Bwd represent forward and backward link to the adjacent elements of the list. Which of the following segments of code deletes the node pointed to by X from the doubly linked list, if it is assumed that X points to neither the first nor the last node of the list?

  1. A.

    X->Bwd->Fwd = X->Fwd; X->Fwd->Bwd = X->Bwd ;

  2. B.

    X->Bwd.Fwd = X->Fwd ; X.Fwd->Bwd = X->Bwd ;

  3. C.

    X.Bwd->Fwd = X.Bwd ; X->Fwd.Bwd = X.Bwd ;

  4. D.

    X->Bwd->Fwd = X->Bwd ; X->Fwd->Bwd = X->Fwd;

Attempted by 521 students.

Show answer

Correct answer: A

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…