Solved

Previously, to Iterate Through a Linked List, We Used a While

Question 36

Multiple Choice

Previously, to iterate through a linked list, we used a while loop. Which of the following for-loops could replace the previous while loop that would start at head and go until temp == null?


A) for (Node temp = header.front, int j = 0; j < header.count; temp = temp.next) { ... }
B) for (int j = 0; j < header.count; j++) { ... }
C) for (Node temp = header.front; temp != header.rear; temp = temp.next) { ... }
D) for (Node temp = header.front, int j = 0; j < header.count; temp = temp.next, j++) { ...}
E) for (Node temp = header.front, int j = 0; j < header.count && temp != header.rear; temp = temp.next, j++) { ... }

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents