• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 228 páginas
Examen

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

Document preview thumbnail
Vista previa 4 fuera de 228 páginas

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

Vista previa del contenido

KJHGFDSA




Test Bank for Data Structures and Abstractions
with Java, 5th edition by Frank M. Carrano
N
U
All Chapters (1-30)
R
SE
D

♦️♦️♦️INSTANT DOWNLOAD
O

♦️♦️♦️COMPLETE CHAPTERS
C
S
♦️♦️♦️COMPLETE ANSWERS




jkhgfdsa

, KJHGFDSA


Chapter 1 - Bags



True/False (10) All Chapters Included

1. An abstract data type is not necessarily a collection.
All Answers Included
Answer: true

2. A collection is not necessarily an abstract data type.
N
Answer: false

3. Entries of a bag can belong to classes related by inheritance.
U
Answer: true

4. Entries of a bag may belong to different classes because items are unordered.
R
Answer: false

5. All entries of a bag must have the same data type or a subtype of that data type.
SE
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.
D
Answer: true

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

8. A set is a special kind of bag.
C
Answer: true

9. You cannot determine the exact number of times a particular item appears in a bag because it is
S
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




jkhgfdsa

, KJHGFDSA


Short Answer (5)

1. Explain the rationale for returning a Boolean value from the add bag operation.

Answer: A client should know what happened. A Boolean value indicates true for success or false
for a failed operation.

2. Explain why writing a test program before implementing a class is a good idea.

Answer: It helps you understand the specifications before committing to your design and
implementation.
N
3. Explain why the set ADT does not need a getFrequencyOf operation.

Answer: Because sets do not contain duplicate items, only a 0 for absence or 1 for presence of an
U
item would be returned. Using a contains method is a better design.

4. What is the design rationale for providing a toArray method instead of a displayBag method?
R
Answer: The user/client is free to display any or all of the items in any way desired.

5. Explain why null is a potential return value for the remove operation.
SE
Answer: It is a value that cannot be in the bag and therefore signals a problem if, for example, a
client tries to remove an entry from an empty bag.
D
Multiple Choice (30) WARNING: CORRECT ANSWERS ARE IN THE SAME POSITION AND TAGGED
WITH **. YOU SHOULD RANDOMIZE THE LOCATION OF THE CORRECT ANSWERS IN YOUR EXAM.

1. A language-independent specification for a group of values and operations on those values is
O
called a/an:
a. abstract data type **
b. data structure
C
c. collection
d. primitive
S
2. An implementation of an ADT with a programming language is called a/an:
a. data structure **
b. abstract data type
c. collection
d. primitive

3. An object that groups other objects and provides services to its clients is called a/an:
a. collection **




jkhgfdsa

, KJHGFDSA


b. abstract data type
c. data structure
d. primitive

4. Which of the following is not true with regard to bags?
a. objects are in a specific order **
b. can contain duplicate items
c. is an abstract data type
d. is a kind of collection in Java
N
5. Which behavior is not represented in a bag?
a. reorder the bag **
b. report the number of items in the bag
U
c. report if the bag is empty
d. add an item to the bag
R
6. Which method returns a count of the current number of items in a bag?
a. getCurrentSize() **
b. getSize()
SE
c. size()
d. currentSize()

7. Why would the add method return false?
a. when the addition of a new item was not successful **
D
b. when there was a duplicate of the entry already in the bag
c. when there was not a duplicate of the entry already in the bag
d. when addition of a new item was successful
O
8. Which method removes all entries of a bag?
a. clear() **
C
b. remove()
c. delete()
d. empty()
S
9. Which method removes one unspecified entry from a bag if possible?
a. remove() **
b. clear ()
c. delete()
d. empty()

10. Which method removes one occurrence of a particular entry from a bag if possible?
a. remove(anItem) **



jkhgfdsa

Información del documento

Subido en
4 de marzo de 2025
Número de páginas
228
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$18.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
ScoreGuides
4.0
(137)
Vendido
1602
Seguidores
784
Artículos
2632
Última venta
11 horas hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes