Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 14 Which behaviors do not change the contents of a bag? add() clear() remove() none of the above 1 points QUESTION 15 Which behaviors

QUESTION 14

Which behaviors do not change the contents of a bag?

add()

clear()

remove()

none of the above

1 points

QUESTION 15

Which behaviors change the contents of a bag?

clear()

remove()

add()

all of the above

1 points

QUESTION 16

When using abstraction as a design principle you should focus on:

what you want to do with the data

how the data is stored

how the data is manipulated

all of the above

1 points

QUESTION 17

Which of the following is a special kind of bag that does not allow duplicate entries?

set

collection

extended bag

super bag

1 points

QUESTION 18

When adding an item to a bag, which of the following statements are true?

You cannot specify the position of the item in the bag.

You can specify the item will be placed as the first in the bag.

You can specify the item will be placed as the last in the bag.

None of the above.

1 points

QUESTION 19

To accommodate entries of any class, the bag methods use ______ .

a generic type

an inherited type

a sub class

all of the above

1 points

QUESTION 20

Which behavior(s) change the contents of a bag?

remove()

getCurrentSize()

isEmpty()

getFrequencyOf()

1 points

QUESTION 21

Which behavior(s) change the contents of a bag?

add()

getFrequencyOf()

contains()

toArray()

1 points

QUESTION 22

Which behaviors leave the contents of a bag unaltered?

contains()

remove()

clear()

add()

1 points

QUESTION 23

Which behavior(s) leave the contents of a bag unaltered?

toArray()

getFrequencyOf()

isEmpty()

all of the above

1 points

QUESTION 24

Which of the following are good reasons to write Java statements that use your bag ADT before the implementation is done?

it helps confirm the design

it helps check the suitability of the specification

it helps check your understanding of the specification

all of the above

1 points

QUESTION 25

Which of the following would be suitable items to store in a bag?

marbles

coins

student roster

all of the above

1 points

QUESTION 26

You wish to keep track of the distribution of words in a document, for example, how many times the word apple appears. You store each word in the document in a bag. Why is a bag a potentially good solution?

the order of the words is unimportant

the words in the document are not unique

getFrequencyOf() is a useful behavior for determining the word distribution

all of the above

1 points

QUESTION 27

For which of the following would a bag implementation be suitable?

a shopping cart

a vending machine

a postage stamp collection

all of the above

1 points

QUESTION 28

Which behavior is not specified in the bag ADT?

sort()

contains()

clear()

remove()

1 points

QUESTION 29

Which bag behavior is not useful or relevant for a set?

getFrequencyOf()

add()

remove()

contains()

1 points

QUESTION 30

Which bag behaviors would need modified when implementing a set?

add()

clear()

contains()

toArray()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions