Solved

For a Non-Empty Linked List, Select the Code That Should

Question 15

Multiple Choice

For a non-empty linked list, select the code that should appear in a function that adds a node to the end of the list. newPtr is a pointer to the new node to be added and lastPtr is a pointer to the current last node. Each node contains a pointer nextPtr.


A) lastPtr->nextPtr = newPtr; lastPtr = newPtr
B) lastPtr = newPtr; lastPtr->nextPtr = newPtr
C) newPtr->nextPtr = lastPtr; lastPtr = newPtr
D) lastPtr = newPtr; newPtr->nextPtr = lastPtr

Correct Answer:

verifed

Verified

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

Related Questions