Questions
#mr
Multiple Choice Questions
1. The specifications of an ADT’s operations indicate .
a. what the operations do
b. how to implement the operations
c. how to store the data in the ADT
d. how to carry out the operations
Answer: a.
2. Data structures are part of an ADT’s .
a. definition
b. implementation
c. specifications
d. usage
Answer: b.
3. A(n) allows two modules to communicate with each other.
a. data structure
b. axiom
c. interface
d. client
Answer: c.
4. An ADT’s govern(s) what its operations are and what they do.
a. specifications
b. implementation
c. documentation
d. data structure
Answer: a.
5. When each module performs one well-defined task, we say that it is .
a. loosely coupled
b. highly coupled
c. cohesive
d. not easily reused
Answer: c.
6. When should an operation contract be written?
a. during analysis
b. after coding
c. at the same time as user documentation
d. when taking initial notes from client
Answer: a.
7. What information is included in the operation contract?
a. the method’s interface
b. data flow among the modules
c. assumptions about input
d. all of these
Answer: d.
8. What kind of interface contains a method if and only that method is essential to that class’s
responsibilities?
a. complete
b. minimal
© #mr 2017 #mr Pearson #mr Education, # mr Inc., #mr Hoboken, #mr NJ.
# m r All # mr rights # mr reserved.
SCHOLARVAULT
, Chapter 1 #mr
Questions
#mr
c. expanded
d. compact
#mrAnswer: #mrb.
9. What #mrmust #mrbe #mrknown #mrabout #mrthe #mrADT #mrBag #mrin #mrorder #mrto #mruse #mrit #mrin #mra #mrprogram?
a. how #mrentries #mrin #mrthe #mrbag #mrare #mrrepresented
b. how #mrbag #mroperations #mrare #mrimplemented
c. how #mrmany #mrentries #mrcan #mrbe #mrstored #mrin #mrthe #mrbag
d. the #mrinterface #mrof #mrthe
#mrbag #mrAnswer: #mrd.
10. According #mrthe #mrCRC #mrspecifications #mrfor #mra #mrBag, #mrwhich #mrof #mrthe #mrfollowing #mrbehaviors #mrwould
# m r not #mrbe #mrone #mrof #mrthe # m r responsibilities #mrof #mrthe #mrclass #mrBag?
a. See #mrif #mrthe #mrbag #mris #mrempty
b. See #mrif #mrthe #mrbag #mris #mrfull
c. Look #mrat #mrall #mrthe #mrobjects #mrin #mrthe #mrbag
d. Count #mrthe #mrnumber #mrof #mrtimes #mra #mrcertain #mrobject
#mroccurs #mrin #mrthe #mrbag #mrAnswer: #mrb.
11. A #mrclient #mrprogram #mrdepends #mrsolely #mron #mrthe # m r of #mrthe #mrADT.
a. data #mrmembers
b. structure
c. implementation
d. behavior
#mrAnswer: # m r d.
12. What #mrshould #mra #mrprogrammer #mrdo #mrbefore #mrimplementing #mra #mrrecently #mrdesigned #mrclass?
a. write #mrcode #mrthat #mruses #mrthe #mrclass
b. check #mrcomments #mrthat #mrdocument #mrspecifications
c. adjust #mrthe #mrdesign #mrwhen #mrproblems #mrare #mrdiscovered
d. all #mrof
#mrthese #mrAnswer: # m r d
13. Object-oriented #mrprogramming #mrviews #mra #mrprogram #mras #mr .
a. a #mrsequence #mrof #mractions
b. a #mrcollection #mrof #mrclasses
c. a #mrgroup #mrof #mrmethods
d. an #mrinteraction #mramong
#mrobjects #mrAnswer: # m r d.
14. An #mrADT’s #mroperations #mrare #mrknown #mras #mrits #mr .
a. axioms
b. methods
c. variables
d. interfaces
#mrAnswer: # m r b.
15. Encapsulation #mrcombines #mran #mrADT’s #mrdata #mrwith #mrits #mroperations #mrto #mrform #mra(n) #mr .
a. exception
b. method
c. object
d. variable
#mrAnswer: # m r c.
16. A(n) #mr is #mra #mrC++ #mrconstruct #mrthat #mrenables #mra #mrprogrammer #mrto #mrdefine #mra #mrnew #mrdata #mrtype.
© #mr 2017 #mr Pearson #mr Education, # mr Inc., #mr Hoboken, #mr NJ.
# m r All # mr rights # mr reserved.
SCHOLARVAULT
, Chapter 1 #mr
Questions
#mr
a. class
b. method
c. data #mrfield
d. object
#mrAnswer: # m r a.
17. A #mrC++ #mrclass #mrcontains #mrdata #mrmembers #mrand #mr .
a. clients
b. interfaces
c. methods
d. data
#mrstructures #mrAnswer:
# m r c.
18. A(n) #mr is #mran #mrinstance #mrof #mra #mrclass.
a. method
b. data #mrfield
c. interface
d. object
#mrAnswer: # m r d.
19. A(n) #mr is #mra #mrclass #mrthat #mrinherits #mrthe #mrmembers #mrof #mranother #mrclass.
a. base #mrclass
b. superclass
c. abstract #mrclass
d. subclass
#mrAnswer: # m r d.
20. A #mrfunction #mrcan #mrindicate #mrthat #mran #mrerror #mrhas #mroccurred #mrby #mr an #mrexception.
a. throwing
b. catching
c. implementing
d. declaring
#mrAnswer: # m r a.
21. To #mr an #mrexception #mrmeans #mrto #mrdeal #mrwith #mrthe #mrerror #mrcondition.
a. declare
b. catch
c. implement
d. try
#mrAnswer:
# m r b.
22. Which #mrof #mrthe #mrfollowing #mrare #mrways #mrto #mraddress #mrunusual #mrsituations?
a. simply #mrassume #mrthe #mrinvalid #mrsituation #mrwill #mrnever #mroccur
b. guess #mrat #mrthe #mrclient’s #mrintention
c. return #mra #mrvalue #mrthat #mrsignals #mra #mrproblem
d. all #mrof #mrthe #mrabove #mrare
#mroptions #mrAnswer: # m r d.
23. For #mrthe #mrmethod #mrremove(anEntry)o
r f #mrthe #mrADT #mrBag, #mrwhat #mrwould #mrbe #mrthe #mroutput #mrof #mrthe
#
m
#mrmethod?
a. anEntry
b. nothing
c. true#omr r #mrfalse
© #mr 2017 #mr Pearson #mr Education, # mr Inc., #mr Hoboken, #mr NJ.
# m r All # mr rights # mr reserved.
SCHOLARVAULT
, Chapter 1 #mr
Questions
#mr
d. the #mrprevious #mrposition #mrof #mranEntryi#mrn #mrthe #mrbag
© #mr 2017 #mr Pearson #mr Education, # mr Inc., #mr Hoboken, #mr NJ.
# m r All # mr rights # mr reserved.
SCHOLARVAULT