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

1. Which of the following statements about hash tables is NOT correct? Elements

ID: 3801502 • Letter: 1

Question

1. Which of the following statements about hash tables is NOT correct?

Elements are grouped into smaller collections that share the same characteristic.

You can form hash tables holding objects of type String.

You can add an element to a specific position within a hash table.

The value used to locate an element in a hash table is called a hash code.

2. Which of the following statements about sets is correct?

Inserting and removing elements that have already been located is faster with a list than with a set.

A set allows duplicate values.

You can add an element to a specific position within a set.

A set is a collection of unique elements organized for efficiency.

8. Consider the code snippet shown below. Assume that employeeNames is an instance of type LinkedList<String>.

Which element(s) of employeeNames does this loop process?

no elements

all elements

elements meeting a condition

the most recently added elements

6. Which of the following statements about data structures is correct?

Inserting and removing elements that have already been located is faster with a list than with a set.

Accessing elements in a linked list in a random fashion is efficient.

Adding and removing already-located elements in the middle of a linked list is efficient.

A set is an ordered collection of unique elements.

9. A(n) ____ is a data structure used for collecting a sequence of objects that allows efficient addition and removal of already-located elements in the middle of the sequence.

stack

queue

linked list

priority queue

QUESTION 13

Consider the following code snippet:

What will this code print when it is executed?

abcdefghi

ghiabcdef

abcghidef

defghiabc

QUESTION 14

To create a TreeSet for a class of objects, the object class must ____.

create an iterator.

implement the Comparable interface.

implement the Set interface.

create a Comparator object.

QUESTION 20

Which of the following statements about manipulating objects in a set is correct?

If you try to add an element that already exists, an exception will occur.

A set iterator visits elements in the order in which they were added to the set.

You can add an element at the position indicated by an iterator.

You can remove an element at the position indicated by an iterator.

QUESTION 18

You need to access values in the order in which they were added (first in, first out), and not randomly. Which collection type should you use?

Map

Hashtable

Stack

Queue

Elements are grouped into smaller collections that share the same characteristic.

You can form hash tables holding objects of type String.

You can add an element to a specific position within a hash table.

The value used to locate an element in a hash table is called a hash code.

Explanation / Answer

QUESTION 1

Elements are grouped into smaller collections that share the same characteristic.- This statement is falser one because it can group large number of collections

The value used to locate an element in a hash table is called a hash code. - False, it is called as Hash Key.

QUESTION 14

To create a TreeSet for a class of objects, the object class must ____. Create a comparator object

QUESTION 18

You need to access values in the order in which they were added (first in, first out), and not randomly. Which collection type should you use? -- Queue, as you know in Queue if you enter first you will be leaving first. So queue is famous for the attribute FIFO

What will this code print when it is executed?

abcdefghi

Elements are grouped into smaller collections that share the same characteristic.- This statement is falser one because it can group large number of collections

The value used to locate an element in a hash table is called a hash code. - False, it is called as Hash Key.

QUESTION 14

To create a TreeSet for a class of objects, the object class must ____. Create a comparator object

QUESTION 18

You need to access values in the order in which they were added (first in, first out), and not randomly. Which collection type should you use? -- Queue, as you know in Queue if you enter first you will be leaving first. So queue is famous for the attribute FIFO

What will this code print when it is executed?

abcdefghi