Question: Question 1 So that the collection classes can hold different classes of objects, the text: A.defines collections of class Object B.uses classes of a particular

Question 1

So that the collection classes can hold different classes of objects, the text:

A.defines collections of class Object

B.uses classes of a particular interface

C.creates multiple implementations for each collection

D.uses the Java generics mechanism

E.None of these is correct

2. Suppose we have a linked list of Strings, as defined in the text, named presidents. Suppose it contains three nodes, with first node holding Washington, the second node Adams, and the third node Jefferson. What would be the result of the following code?

LLNode temp = presidents;

for (int i = 1; i <= 2; i++)

temp = temp.getLink();

System.out.println(temp.getInfo());

A.runtime error

B."Washington" is printed

C."Adams" is printed

D."Jefferson" is printed

E.None of these is correct

Question 3

Suppose we have a linked list of Strings, as defined in the text, named presidents. Suppose it contains three nodes, with the first node holding Washington, the second node Adams, and the third node Jefferson. What would be the result of the following code?

System.out.println(presidents.getLink().getInfo());

A.runtime error

B."Washington" is printed

C."Adams" is printed

D."Jefferson" is printed

E.None of these is correct

4. The StackInterface interface represents a contract between the implementer of a Stack ADT and the programmer who uses the ADT.

A.True

B.False

5.Our StackUnderflowException code essentially consists of two simple constructors and "packages" and "extends" statements and nothing else.

A. True

B.False

6.It is more efficient to insert a new element into the front of a list of 100 elements held in an array (so that all the other elements move down one slot) than it is to insert a new element into the front of that same list held in a linked list structure.

A.True

B.False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!