Question

Which of the following correctly fills the blank in the line labeled “//3”? ItemType UnsortedType::GetItem(ItemType& item,...

Which of the following correctly fills the blank in the line labeled “//3”?

ItemType UnsortedType::GetItem(ItemType& item, bool& found)

                        // Pre: Key member(s) of item is initialized.

                        // Post: If found, item's key matches an element's key in the

                        //       list and a copy of that element has been stored in item;

                        //       otherwise, item is unchanged.

                        {

                           bool moreToSearch;

                           int location = 0;

                           found = false;

           

                           moreToSearch = (location ________ length);                                  // 1

           

                           while (__________________)                                                         // 2

                           {

                              switch (item.ComparedTo(info[location]))

                              {

                                   case LESS    :

                                   case GREATER : location++;

                                                   moreToSearch = (_____________);                         // 3

                                                   break;

                                   case EQUAL   : found = true;

                                                 item = info[___________];                                       // 4

                                                 break;

                              }

                           }

                           return item;

   }

A.

location > length

B.

length >= location

C.

location < length

The last time testing is done is when the user accepts the product after a successful acceptance test.

True

False

Executing every branch and every path at least once is feasible.

True

False

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)  location < length
2)  True
3)  True
Add a comment
Know the answer?
Add Answer to:
Which of the following correctly fills the blank in the line labeled “//3”? ItemType UnsortedType::GetItem(ItemType& item,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT