• Verkeerd document? Gratis ruilen
  • Geschreven door studenten die geslaagd zijn
  • Direct beschikbaar na je betaling
  • Online lezen of als PDF
Verkopen
Kies je studieland
Kies je taal
Document preview thumbnail
Voorbeeld 4 van de 272 pagina's
Tentamen (uitwerkingen)

Test Bank - Data Structures and Abstractions with Java, 5th edition by Frank M. Carrano, Chapter 1-30 , A+ Guide.

Document preview thumbnail
Voorbeeld 4 van de 272 pagina's

Test Bank - Data Structures and Abstractions with Java, 5th edition by Frank M. Carrano, Chapter 1-30 , A+ Guide.

Voorbeeld van de inhoud

Chapter 1 - Bags



True/False (10)

1. An abstract data type is not necessarily a collection.

Answer: true

2. A collection is not necessarily an abstract data type.

Answer: false

3. Entries of a bag can belong to classes related by inheritance.

Answer: true

4. Entries of a bag may belong to different classes because items are unordered.

Answer: false

5. All entries of a bag must have the same data type or a subtype of that data type.

Answer: true

6. By declaring a data type to be a BagInterface, we can replace the bag class with another class
that implements the BagInterface.

Answer: true

7. A method can change the state of an object passed to it as an argument.

Answer: true

8. A set is a special kind of bag.

Answer: true

9. You cannot determine the exact number of times a particular item appears in a bag because it is
unordered.

Answer: false

10. Code written with respect to an interface makes it difficult to replace one implementation of a
bag with another.

Answer: false




SCHOLARVAULT

,Short #mgAnswer #mg(5)

1. Explain #mgthe #mgrationale #mgfor #mgreturning #mga #mgBoolean #mgvalue #mgfrom #mgthe #mg add #mgbag #mgoperation.

Answer: # m g A #mgclient #mgshould #mgknow #mgwhat #mghappened. #mgA #mgBoolean #mgvalue #mgindicates #mgtrue
#mgfor #mgsuccess #mgor #mgfalse #mgfor #mga #mgfailed #mgoperation.




2. Explain #mgwhy #mgwriting #mga #mgtest #mgprogram #mgbefore #mgimplementing #mga #mgclass #mgis #mga #mggood #mgidea.

Answer: # m g It #mghelps #mgyou #mgunderstand #mgthe #mgspecifications #mgbefore #mgcommitting #mgto #mgyour #mgdesign
#mgand #mgimplementation.




3. Explain #mgwhy #mgthe #mgset #mgADT #mgdoes #mgnot #mgneed #mga #mggetFrequencyOf #mgoperation.

Answer: # m g Because #mgsets #mgdo #mgnot #mgcontain #mgduplicate #mgitems, #mgonly #mga #mg0 #mgfor #mgabsence
#mgor #mg1 #mgfor #mgpresence #mgof #mgan #mgitem #mgwould #mgbe #mgreturned. #mgUsing #mga #mgcontains #mgmethod


#mgis #mga #mgbetter #mgdesign.




4. What #mgis #mgthe #mgdesign #mgrationale #mgfor #mgproviding #mga #mgtoArray #mgmethod #mginstead #mgof #mga

#mg displayBag #mgmethod? #mgAnswer: # m g The #mguser/client #mgis #mgfree #mgto #mgdisplay #mgany #mgor #mgall

of #mgthe #mgitems #mgin #mgany #mgway #mgdesired.
#mg




5. Explain #mgwhy #mgnull #mgis #mga #mgpotential #mgreturn #mgvalue #mgfor #mgthe #mgremove #mgoperation.

Answer: # m g It #mgis #mga #mgvalue #mgthat #mgcannot #mgbe #mgin #mgthe #mgbag #mgand #mgtherefore #mgsignals #mga
#mgproblem #mgif, #mgfor #mgexample, #mga #mgclient #mgtries #mgto #mgremove #mgan #mgentry #mgfrom #mgan #mgempty


#mgbag.




Multiple #mgChoice #mg(30) #mgWARNING: #mgCORRECT #mgANSWERS #mgARE #mgIN #mgTHE #mgSAME #mgPOSITION
#mgAND #mgTAGGED #mgWITH #mg**. #mgYOU #mgSHOULD #mgRANDOMIZE #mgTHE #mgLOCATION #mgOF #mgTHE


#mgCORRECT #mgANSWERS #mgIN #mgYOUR #mgEXAM.




1. A #mglanguage-independent #mgspecification #mgfor #mga #mggroup #mgof #mgvalues #mgand #mgoperations #mgon
#mgthose #mgvalues #mgis #mgcalled #mga/an:


a. abstract #mgdata #mgtype # m g **
b. data #mgstructure
c. collection
d. primitive

2. An #mgimplementation #mgof #mgan #mgADT #mgwith #mga #mgprogramming #mglanguage #mgis #mgcalled #mga/an:
a. data #mgstructure #mg**
b. abstract #mgdata #mgtype
c. collection
d. primitive


SCHOLARVAULT

,3. An #mgobject #mgthat #mggroups #mgother #mgobjects #mgand #mgprovides #mgservices #mgto #mgits #mgclients #mgis #mgcalled
#mga/an:


a. collection #mg**




SCHOLARVAULT

, b. abstract #mgdata #mgtype
c. data #mgstructure
d. primitive

4. Which #mgof #mgthe #mgfollowing #mgis #mgnot #mgtrue #mgwith #mgregard #mgto #mgbags?
a. objects #mgare #mgin #mga #mgspecific #mgorder #mg**
b. can #mgcontain #mgduplicate #mgitems
c. is #mgan #mgabstract #mgdata #mgtype
d. is #mga #mgkind #mgof #mgcollection #mgin #mgJava

5. Which #mgbehavior #mgis #mgnot #mgrepresented #mgin #mga #mgbag?
a. reorder #mgthe #mgbag #mg**
b. report #mgthe #mgnumber #mgof #mgitems #mgin #mgthe #mgbag
c. report #mgif #mgthe #mgbag #mgis #mgempty
d. add #mgan #mgitem #mgto #mgthe #mgbag

6. Which #mgmethod #mgreturns #mga #mgcount #mgof #mgthe #mgcurrent #mgnumber #mgof #mgitems #mgin #mga #mgbag?
a. getCurrentSize() #mg**
b. getSize()
c. size()
d. currentSize()

7. Why #mgwould #mgthe #mgadd #mgmethod #mgreturn #mgfalse?
a. when #mgthe #mgaddition #mgof #mga #mgnew #mgitem #mgwas #mgnot #mgsuccessful #mg**
b. when #mgthere #mgwas #mga #mgduplicate #mgof #mgthe #mgentry #mgalready #mgin #mgthe #mgbag
c. when #mgthere #mgwas #mgnot #mga #mgduplicate #mgof #mgthe #mgentry #mgalready #mgin #mgthe #mgbag
d. when #mgaddition #mgof #mga #mgnew #mgitem #mgwas #mgsuccessful

8. Which #mgmethod #mgremoves #mgall #mgentries #mgof #mga #mgbag?
a. clear() #mg**
b. remove()
c. delete()
d. empty()

9. Which #mgmethod #mgremoves #mgone #mgunspecified #mgentry #mgfrom #mga #mgbag #mgif #mgpossible?
a. remove() #mg**
b. clear #mg()
c. delete()
d. empty()

10. Which #mgmethod #mgremoves #mgone #mgoccurrence #mgof #mga #mgparticular #mgentry #mgfrom #mga #mgbag #mgif
#mgpossible?


a. remove(anItem) #mg**



SCHOLARVAULT

Documentinformatie

Geüpload op
26 augustus 2025
Aantal pagina's
272
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden
$16.49

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
ScholarVault
3.0
(1)
Verkocht
34
Volgers
1
Items
546
Laatst verkocht
13 uur geleden



Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen