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

please please help me. in these multiplchoice. 1) \"In a linked-based implementa

ID: 3683733 • Letter: P

Question

please please help me. in these multiplchoice.

1) "In a linked-based implementation of the ADT list with only a head reference, which method has a time efficiency of O(1)?"

a. toArray

b. clear

c. contains

d. all of the above

2) Including a tail reference to a linked implementation of a list makes which functionality more efficient?

a. adding a node to the end of a list

b. searching for a node on the list

c. removing a node from the list

d. all of the above

3) "In a linked-based implementation of the ADT list with a tail reference, which method has a time efficiency of O(1)?"

a. adding an entry to the end of the list

b. adding an entry to the beginning of the list

c. clear

d. all of the above

4) The last node of a list has a reference to

a. itself

b. the node before it

c. null

d. none of the above

5) "If a chain is empty, the head reference"

a. is an empty node with the data field not set

b. is null

c. is in an illegal state

d. none of the above

6) "In the LList implementation of a list, when a list is empty the firstNode is _____ and the numberOfEntries is _____."

a. "null, 0 "

b. "null, 1"

c. "an empty node, 0"

d. "an empty node, 1"

7) A linked implementation of a list

a. uses memory only as need for new entries

b. returns unneeded memory to the system when an entry is removed

c. avoids moving data when adding or removing entries

d. all of the above

8) In a chain of linked nodes you can

a. add nodes from the beginning of a chain

b. add nodes from the end of a chain

c. add nodes that are between other nodes

d. all of the above

9) "In the linked implementation of a list, what happens when you try to add a node at an invalid position?"

a. it throws an InvalidLinkException

b. it returns null

c. it throws an IndesOutOfBoundsException

d. it returns false

10) "If the reference to the first node is null, this means"

a. the list is empty

b. the list is full

c. the garbage collector should be invoked

d. the list is in an unstable state

11) "In a linked implementation of a list with a tail reference, removing an entry affects the tail reference if"

a. the list only contains one entry

b. the list is empty

c. the list is full

d. all of the above

12) "In a linked implementation of a list with a tail reference, removing an entry affects the tail reference if"

a. the list has multiple entries and the entry to be removed is the first one

b. the list is empty

c. the list has multiple entries and the entry to be removed is the last one

d. all of the above

13) "In the linked implementation of a list, the add method: public void add(int newPosition, T newEntry); inserts a new entry"

a. at the end of the list

b. between adjacent nodes of the list

c. at the beginning of the list

d. all of the above

14) To determine if a list is empty you can

a. check to see if the length of the list is zero

b. check to see if the reference to firstNode is null

c. use an assertion on firstNode == null

d. all of the above

15) "In the linked implementation of a list, the add method: public void add(T newEntry); inserts a new entry"

a. at the beginning of the list

b. between adjacent nodes of the list

c. at the end of the list

d. all of the above

16) An array provides _______ access to its elements.

a. Direct

b. Random

c. Sequential

d. None of the above

17) When adding an entry to an array-based implementation of the ADT list at a specified location before the end of the list.

a. no shift is necessary.

b. entries must be shifted to vacate a position for the item.

c. A new entry must be allocated and linked to attached the new item.

18) In an array-based implementation of the ADT list, the contains method locates the entry by"

a. Searching for the entry starting at the end of the array working to the beginning.

b. going directly to the appropriate array element.

c. Searching for the entry starting at the beginning of the array working to the end.

d. None of the above.

19) In an array-based implementation of the ADT list, the getEntry method locates the entry by"

a. going directly to the appropriate array element.

b. Search for the entry starting at the beginning of the array working to the end.

c. Search for the entry starting at the end of the array working to the beginning.

d. None of the above.

20) A new entry is added to an array-based implementation of the ADT list

a. in the last array position.

b. Immediately before the first occupied position.

c. Immediately after the last occupied position.

d. In the location returned by the new operator.

Explanation / Answer

1-b

2-a

3-d

4-c

5-b

6-a

7-d

8-d

9-c

10-a

11-a

12-c

13-d

14-d

15-a

16-a

17-b

18-c

19-a

20-a