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

Read the following code and determine what goes in blank #1. void RevPrint(NodeT

ID: 3901745 • Letter: R

Question

Read the following code and determine what goes in blank #1.

                  void RevPrint(NodeType* listPtr)

                  // Pre: listPtr is an external pointer to a list.

                  // Post: Values in the list have been printed in reverse order.

                  {

                     if (_______________)                                            // 1

                     {

                          RevPrint(_________);                           // 2

                          cout << __________ << endl;             // 3

                     }

                     ___________                                                        // 4

                  }

A) listPtr = NULL

B) ListPtr != NULL

C) listPtr->next

D) listPrt->info

Explanation / Answer

Answer: Option B i.e listPtr != NULL

To print the values of list in reverse order (using recursion) , at line #1, we need to check if the list is NOT NULL

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote