Question: java 2. Which of the following statements about cursors and iterators are true? (Check all that apply) Group of answer choices Both cursors and iterators

java

2. Which of the following statements about cursors and iterators are true? (Check all that apply)

Group of answer choices

Both cursors and iterators represent positions in a data structure.

An ADT can't be coded to have more than one cursor.

Changing the position of an iterator for an object T also changes the position of T's cursor.

The user of an ADT can control how many cursors the ADT has.

A cursor is internal to an ADT (abstract data structure) but iterators are separate objects.

3.Suppose that the T is a reference to a container object that has a cursor and that T implements the Cursor interface from Topic 4, exercise 1. Which of the following code fragments would correctly perform iteration over all elements in T? (check all that apply)

// Fragment A T.goFirst() while(T.itemExists()) { // Do something with T.item() T.goForth() } // Fragment B T.goFirst() while(!T.after()) { // Do something with T.item() T.goForth() } // Fragment C T.goFirst() while(T.item() != null) { // Do something with T.item() T.goForth() } // Fragment D while(!T.before() && !T.after()) { // Do something with T.item() T.goForth() }

Group of answer choices

Fragment A

Fragment D

Fragment C

Fragment B

4.Suppose that an arrayed list implementation has a cursor and that the following list is stored as an arrayed list instance called L:

34

23

91

42

280

16

If the cursor is at the array position where 42 is stored, which of the following expressions has the java value true? (check all that apply)

Group of answer choices

L.before()

L.itemExists()

L.after()

L.item()

5.Suppose that an arrayed list implementation has a cursor and that the following list is stored as an arrayed list instance called L:

34

23

91

42

280

16

If the cursor is at the first array position in which no data is stored, which of the following expressions has the java value false? (check all that apply)

Group of answer choices

L.before()

L.itemExists()

L.after()

L.item()

6.Suppose that an arrayed list implementation has a cursor and that we have an instance of the arrayed list called L.

If L is empty, which of the following expressions has the java value true? (check all that apply)

Group of answer choices

L.item()

L.after()

L.itemExists()

L.before()

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!