Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For questions 15 through 17, assume the carlier declaration of the class SNode a

ID: 3703953 • Letter: F

Question

For questions 15 through 17, assume the carlier declaration of the class SNode and the declarations below Sode Head: SNode Currenta const int initval-0 15. If Head points to the first node in a properly constructed linked list of ms nodes, which code segment below stcees the value initVal in each node? 1) Curzent Heada 5) CurcentHead while (Current -NULL) while (Current !-NULL Current->Element initvali Cuerent -Current-lext Current->Element initval: Current-Next I through 5 will all work 1 through 4 will all work, 2) Carrent Heada while (Current!-NULL) 6) Cuzzent-Elenent -initval: Current-Current) Next but not 5 8) 1 and 2 only 9) 1,2 and 3 only 10) None of these 3) Bead->Elenent-initVal: Cureent-Head while (Current->Next 1-NUL Current->Next-Elenent eur rent->E lenen t ; Current-Current->Next: 4) Current -Head while (Current !. NULL) current->Element-initVala 6 Which, if any, of the code fragments given in the previous question would work comectly only if the list were sonempty? (Use the same choices for your answers.) Which of the following code segments outputs the data in the list, visiting each mode from first to last (assuming the list is not empty 1) Curreat Bead 4) Current Head-Next: while (Current I-NULL) while (Current !-NULL) cout Elenent cout Next NULL) cout Next 3) Current lead do ( cout

Explanation / Answer

As per Chegg policy, I am answering only first question. In order to get the solution of remaining questions, please upload them again.

15.) The possible code segments for storing same value are:

i.) current = head;

while(current != NULL) {

current->element = initVal;

current = current->next;

}

ii.) current = head;

while(current != NULL) {

current->element = initVal;

current = (*current).next;

}

Hence option1,2 and 3 is the correct option which gives option 9 is the correct option.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote