Chapter 3 Questions
Multiple Choice
1. Which of the following provides a way to enforce the wall of an ADT?
a. Implement the ADT as a C++ class
b. Always use public fields
c. Never use private records together methods
d. Link records together
2. Each method for the array based implementation of the ADT bag will require access to the array
of entries and what else?
a. The number of fields
b. The current number of entries in the bag
c. The ID of the previous bag entry
d. The ID of the next bag entry
3. The default constructor for an array implementation of the ADT Bag should do what?
a. Load the bag with blanks and zeros
b. Set itemCount to DEFAULT_CAPACITY
c. Initialize the current number of items
d. Load the new entry with blanks and zeros
4. Why should we prevent a client’s direct access to a data structure?
a. To protect the job security of the systems analyst
b. It is a federal law
c. Most computer languages do not allow it
d. The client could possibly damage the ADT’s data
5. Which of the following methods would definitely be considered part of a core group?
a. add
b. findNext
c. clear
d. search
6. An add method that encounters a full array should either signal it’s client or
a. Crash the program
b. Allocate a larger array
c. Loop back to the beginning of the array for another pass through the array
d. Merely increment the loop counter into the next area of memory
7. Rather than returning a value, a method can signal its client by
a. Crashing the program
b. Beeping
c. Throwing an exception
d. Ignoring the requested record