Lists Chapter 15 Test Bank Answers - Java Foundations 4th Edition | Test Bank with Answer Key by John Lewis by John Lewis, Peter DePasquale, Joe Chase. DOCX document preview.

Lists Chapter 15 Test Bank Answers

Chapter 15: Lists

Multiple Choice Questions:

1) A(n) _____________________ is a list collection has elements that are ordered by a characteristic of the elements.

a) ordered list

b) unordered list

c) indexed list

d) linked list

e) array

2) A(n) _____________________ is a list collection has elements whose elements can be referenced using a numeric index.

a) ordered list

b) unordered list

c) indexed list

d) linked list

e) array

3) Which operation below is not part of the List interface?

a) add an element to the list

b) remove an element from the list

c) replace an element in the list with another element

d) get the size of the list

e) grow the size of the list

4) The List interface is implemented by the ________ class.

a) array

b) ArrayList

c) String

d) Object

e) Exception


5) The List ADT (Abstract Data Type) provides how many operations to remove an element from a list?

a) 1

b) 2

c) 3

d) 4

e) more than 4

6) What is the nature of the methods that are added to the OrderedListADT and UnorderedListADT interfaces that extend the ListADT interface?

a)They are methods to add elements to the list

b) They are methods to remove elements from the list

c) They are methods to delete the list

d) They add a method to determine the location of an element in the list

e) They add a method to determine the size of the list

7) A list collection can be implemented using either

a) a stack or a queue

b) an Exception or an Error

c) add or remove operations

d) an array or a linked structure

e) both c) and d) are correct

8) The Serializable interface allows

a) Exceptions to be thrown from methods.

b) objects to be read from and written to external files.

c) Object class elements to be added to list collections.

d) compiler warning messages to be suppressed.

e) none of the above

9) The remove operation returns

a) an int representing the number of elements remaining in the list after the removal.

b) a boolean value indicating if the remove was successful or not.

c) the element that was removed.

d) a pointer to the list

e) The remove operation does not return any of these.

10) The find method, as used in the array-based implementation of the remove and contains operations, returns

a) the element that was found

b) the index of the element that was found

c) a true or false value indicating whether the element was found

d) the element whose reference variable points to the element that was found

e) none of the above

11) The addAfter operation of an unordered list collection is

a) O(1)

b) O(log n)

c) O(n)

d) O(n log n)

e) a higher order than O(n log n)

12) As with queues and stacks, the first step in removing an element from a list collection is to

a) determine that the collection is not empty.

b) determine if the element is in the collection.

c) determine if the element is in the first or the last position in the collection.

d) determine if the collection will be empty once the element is removed.

e) none of these is a reasonable first step in removing an element from a collection.

13) Which of the following is a method in the java.util.List interface?

a) addBefore

b) addAfter

c) add

d) shift

e) resize

14) Which of the following is not a way to categorize list collections?

a) public

b) ordered

c) unordered

d) indexed

e) all of the above are ways to categorize list collections

15) When adding elements to an ordered list, the elements are ordered according to

a) the order of the calls to the add operation to add them to the list.

b) increasing size of storage to hold the element

c) the key value of each element

d) the address of the location in memory that holds the element.

e) none of the above is used to determine the order of the elements in an ordered list.

1) A linked list is a conceptual notion of organizing things in a linear list

2) The size of a list collection is unbounded

3) An array is an example of an indexed list

4) A user does not have any control over the order of the elements in an unordered list

5) The LinkedList class is an example of a class that implements the List interface.

6) The contains method of the List ADT (Abstract Data Type) lets you know if a particular element is in a list.

7) The primary difference between the OrderedList ADT and the UnorderedList ADT is in how elements are removed from the list

8) Using a circular array for an array-based implementation of a list would improve the performance of the operation to remove an element from the middle of a list

9) The operation to remove an element from an array implementation of a list collection is O(n).

10) The remove operation returns a boolean value that indicates if the element to be removed was found in the list.

1) Explain the hierarchy of interfaces to support List objects as documented in the textbook. Explain why specific methods appear in particular interfaces.

2) Why is the find method, used by the remove and the contains operations, declared with private visibility?

3) The find method, used by the remove, contains, and addAfter operations, returns -1 if an element is not found in an array based implementation of a list collection. Why doesn’t it throw an Exception in this case?

4) What are the differences between an ordered list, an unordered list, and an indexed list?

5) The java.util.List interface has an add method that takes an index and an element as parameters. It adds the element to the list at the index. Its header is

void add(int index, E element)

Can the addToFront operation use an implementation of this add method?

6) Given the list elements and contents below. Which type of list collection could be used to represent them? Explain your choice.

front of list

rear of list

David

Carla

Billy

Alice

7) Can a list be of more than one type? For example, can a list be both unordered and indexed, or ordered and unordered?

8) Identify some of the methods in the java.util.List interface that support an indexed list.

9) Write the header and body for isEmpty. The method returns true if the list is empty and false otherwise. Does the method need to know if the underlying implementation uses an array or a list structure?

isEmpty can be determined from a call to size, and does not need to know how the list is implemented. Here are two possible solutions:

public boolean isEmpty()

{

if (size() == 0)

return true;

else

return false;

}

public boolean isEmpty()

{

return (size() == 0);

}

10) The contains operation, used to determine if a particular element is in a list, relies on the find support method to locate the element. The find method, in turn relies on which method being implemented in order to work?

11) Elements added to an ordered list must support which interface?

12) In a linked list implementation of the remove operation, the element to be removed is located. What are the possible situations that must be considered as part of removing the element once it is located?

13) Can the add operations for an unordered list be used to maintain an ordered list?

14) An academic researcher wants to use this class to create Student objects and arrange them in a list in descending order according to the value of their courseAverage member. What is the most appropriate list collection type to use?

15) Suppose that a researcher decides to use an ordered list to organize Student objects. What must be done to the Student class to support this?

Document Information

Document Type:
DOCX
Chapter Number:
15
Created Date:
Aug 21, 2025
Chapter Name:
Chapter 15 Lists
Author:
John Lewis, Peter DePasquale, Joe Chase

Connected Book

Java Foundations 4th Edition | Test Bank with Answer Key by John Lewis

By John Lewis, Peter DePasquale, Joe Chase

Test Bank General
View Product →

$24.99

100% satisfaction guarantee

Buy Full Test Bank

Benefits

Immediately available after payment
Answers are available after payment
ZIP file includes all related files
Files are in Word format (DOCX)
Check the description to see the contents of each ZIP file
We do not share your information with any third party