Which of the following options is the correct code for traversing a link list…

NVS Computer Science / IT Teacher Recruitment · 2022 · PGT Computer Science · 15 Dec 2022 · Shift 2 · Computer Science or Information Technology

Which of the following options is the correct code for traversing a link list staring at pointer P, upto element X ?

  1. A.

    while (P == NULL || P→Element != X) P = P→Next;

  2. B.

    while (P == NULL && P→Element != X) P = P→Next;

  3. C.

    while (P != NULL || P→Element != X) P = P→Next;

  4. D.

    while (P != NULL && P→Element != X) P = P→Next;

Attempted by 34 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…