Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In java language Question 1 A/An __________ allows a program to walk through the

ID: 3694333 • Letter: I

Question

In java language

Question 1

A/An __________ allows a program to walk through the collection and remove elements from the collection.

Select one:

a. Iterator

b. List

c. Set

d. Queue

Question 2

Iterator method __________ determines whether the Collection contains more elements.

Select one:

a. hasNext

b. containsNext

c. next

d. contains

Question 3

Collections method sort accepts a List as an argument. The method sorts theList elements, which must implement the __________ interface.

Select one:

a. Comparator

b. Equals

c. Compare

d. Comparable

e. Ordering

Question 4

If the items stored in a collection are of different types, then the collection is referred to as ______.

Select one:

a. homogeneous

b. dynamic

c. abstract

d. vector

e. heterogeneous

Question 5

It is possible to restrict the type of object which is stored within a Java collection by using a generic type when the collection is declared.

Select one:

a. True

b. False

Question 6

Generics provide __________ that allows programmers to catch invalid types at compile time.

Select one:

a. compile-time exception handling

b. run-time type safety

c. compile-time error checking

d. compile-time type safety

Question 7

Which statements are true? Select all that apply.

Select one or more:

a. A List is sometimes called a sequence.

b. A List is a Collection.

c. A List cannot contain duplicate elements.

d. Lists use zero-based indices.

Question 8

Which of the following implements the interface List? Select all that apply.

Select one or more:

a. Vector

b. Collection

c. LinkedList

d. ArrayList

e. ListIterator

f. Collections

Question 9

To simulate people waiting in a line, which data structure would you use?

Select one:

a. Queue

b. Vector

c. Stack

d. List

e. Set

Question 10

In order to input a list of values and output them in order, you could use a Queue. In order to input a list of values and output them in opposite order, you could use a Stack.

Select one:

a.True

b. False

Question 11

Stack method __________ looks at the top element of a stack without removing that element.

Select one:

a. poll

b. pop

c. look

d. peek

e. sample

Question 12

If no elements are in the Stack, method pop throws an __________.

Select one:

a. OutOfMemoryException

b. EmptyStackError

c. OutOfMemoryError

d. EmptyStackException

Questiion 13

In order to gain a last-in first-out access to data, which type of structure should be used?

Select one:

a. Array

b. Stack

c. Vector

d. Queue

e. Linked List

Explanation / Answer

1) a. Iterator

2) a. hasNext

3) d. Comparable

4) e. Heterogeneous

5) True

6) d. Compile time type safety

7) a,b,d

8) a,c,d

9) a. Queue

10) True

11) d. peek

12) d. EmptyStackException

13) b. Stack

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote