Exercises 20 through 28 refer to blanks in the following code segment. Save your
ID: 3852808 • Letter: E
Question
Exercises 20 through 28 refer to blanks in the following code segment. Save your responses in a word document:
LastName_FirstName_Discussion3
Class UnsortedType{
public:
//all the prototypes go here.
private:
int length;
NodeType* listData;
};
void UnsortedType::DeleteItem(ItemType item)
// Pre:Item is in list
NodeType* tempPtr;// pointer delete
NodeType* predLoc;// trailing pointer
NodeType* location; // traveling pointer
bool found = false;
location = listData;
predLoc = _____________; // 20
length--;
// Find node to delete.
while (____________) ; // 21
{
switch (__________________) ; // 22
{
case GREATER:
case LESS : predLoc = location;
location = ___________; // 23
break;
case EQUAL : found = ___________; // 24
break;
}
}
// delete location
tempPtr = _____________; // 25
if (____________) // 26
____________ = location->next; //27
else
predLoc->next = _____________; //28
delete tempPtr;
}
Read the code segment above and fill in blank # 20.
A. NULL
B. True
C. false
D. listData
E. answer not shown
Read the code segment above and fill in blank # 21.
A. true
B. !found
C. false
D. moreToSearch
E. answer not shown
Read the code segment above and fill in blank # 22.
A. item.ComparedTo(listData->info)
B. item.ComparedTo(location->next)
C. item.ComparedTo(location->info)
D. item.CompareedTo(location)
E. answer not shown
Read the code segment above and fill in blank # 23.
A. item
B. *location.next
C. (*location).next
D. predLoc
E. answer not shown
Read the code segment above and fill in blank # 24.
A. false
B. true
C. predLoc == NULL
D. location != NULL
E. answer not shown
Read the code segment above and fill in blank # 25.
A. preLoc
B. location
C. predLoc->next
D. location->next
E. answer not shown
Read the code segment above and fill in blank # 26.
A. predLoc == NULL
B. location == NULL
C. predLoc == location
D. predLoc->next == NULL
E. answer not shown
Read the code segment above and fill in blank # 27.
A. predLoc
B. location
C. location->next
D. listData
E. answer not shown
Read the code segment above and fill in blank # 28.
A. listData
B. predLoc->next
C. location->next
D. newNode->next
E. answer not shown
Explanation / Answer
Find the answers below.
blank # 20 = A. NULL
blank # 21 = B. !found
blank # 22 = E. answer not shown
blank # 23 = D. predLoc
blank # 24 = B. true
blank # 25 = B. location
blank # 26 = C. predLoc == location
blank # 27 = B. location
blank # 28 = C. location->next
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.