100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

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

Rating
-
Sold
-
Pages
272
Grade
A+
Uploaded on
26-08-2025
Written in
2025/2026

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

Institution
Data Structures And Abstractions With Java, 5e
Course
Data Structures and Abstractions with Java, 5e

Content preview

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

Written for

Institution
Data Structures and Abstractions with Java, 5e
Course
Data Structures and Abstractions with Java, 5e

Document information

Uploaded on
August 26, 2025
Number of pages
272
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ScholarVault West Virgina University
View profile
Follow You need to be logged in order to follow users or courses
Sold
23
Member since
8 months
Number of followers
1
Documents
555
Last sold
6 days ago
StudyHub: I provide A+ solutions in Accounting, Finance, Statistics, Computer Science, Nursing, Chemistry, Biology, and many other subjects.

Greetings, Are you tired of scouring for reliable study materials? Look no further! I'm here to provide you with accurate, comprehensive, and current study documents to ace your quizzes, assignments, midterms, and final exams. Whatever your study needs may be, I've got you covered. Feel free to reach out for assistance with any study materials, and don't hesitate to refer me to your friends. Thank you for choosing my services, and welcome to your solution! Best regards,

Read more Read less
3.0

1 reviews

5
0
4
0
3
1
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions