Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping. True/False (13) Chapter 14 - A List

Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping.

True/False (13)

Chapter 14 - A List Implementation that Links Data

  1. Adding a node to an empty chain is the same as adding a node to the beginning of a chain.

  2. Adding a node at the end of a chain of n nodes is the same as adding a node at position n.

  3. You need a temporary variable to reference nodes as you traverse a list.

  4. The efficiency of the displayList method is directly related to the efficiency of the getEntry

    method.

  5. You cannot use an assert statement to determine of a list is empty.

  6. A fundamental operation of a list is a traversal.

  7. You must know how much memory to allocate before creating a linked implementation of a list.

  8. A linked implementation of a list grows and shrinks dynamically as nodes are added and deleted.

  9. In a linked implementation of a list, you only call the method getNodeAt when we remove an

    entry other than the first one.

  10. Replacing a node in a linked implementation of a list only requires locating the node and

    replacing the data portion of the node.

  11. In a linked implementation of a list, the replace method replaces the entire node.

  12. Retrieving a list entry using a linked implementation is faster than using an array representation.

  13. Replacing a list entry using an array implementation is faster than using a linked representation.

Short Answer (6)

  1. Explain why a public method should be declared to be final if it is called by a constructor.

  2. In the linked implementation of a list, why shouldnt the constructor call the method clear even

    though they do the same exact assignment statements?

  3. Outline the basic steps to add a node to the end of a linked implementation of a list.

  4. Outline the basic steps to add a node to the beginning of an empty linked implementation of a

    list.

  5. Outline the basic steps to add a node to the beginning of a non-empty linked implementation of

    a list.

  6. Outline the basic steps to remove a node from the beginning of a list.

Multiple Choice (30)

1. A linked implementation of a list

  1. uses memory only as need for new entries

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

  3. avoids moving data when adding or removing entries

  4. all of the above

  1. In a chain of linked nodes you can

    1. add nodes from the beginning of a chain

    2. add nodes from the end of a chain

    3. add nodes that are between other nodes

    4. all of the above

  2. In a chain of linked nodes you can

    1. remove nodes from the beginning of a chain

    2. remove nodes from the end of a chain

    3. remove nodes that are between other nodes

    4. all of the above

  3. If a chain is empty, the head reference

    1. is null

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

    3. is in an illegal state

    4. none of the above

  1. When

    1. the node before the insertion position and the node after the insertion position

    2. the first node and the node before the insertion position

    3. the first node and the node after the insertion position

    4. the last node and the node after the insertion position

  2. Adding a node at the end of a chain of n nodes is the same as adding a node at position a. n+1

    b. n c. n1 d. 0

  3. If the reference to the first node is null, this means

    1. the list is empty

    2. the list is full

    3. the garbage collector should be invoked

    4. the list is in an unstable state

  4. The last node is a list has a reference to

    1. null

    2. itself

    3. the node before it

    4. none of the above

inserting a node between adjacent nodes in a chain you must locate

9. To locate a node within a chain that is near the end of the list, we must

  1. start at the first node and traverse the chain

  2. start at the last node and traverse the chain

  3. directly access the node

  4. none of the above

10. Moving a. traversing

through a linked implementation of a list from one node to another is called

  1. walking

  2. hopping

  3. none of the above

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

a. b. c. d.

  1. In the a. b. c. d.

  2. In the

null, 0 null, 1 an empty node, 0 an empty node, 1

LList implementation of a list, the constructor and the clear method have the same functionality do completely different things unnecessary

none of the above

linked implementation of a list, the add method public void add(T newEntry)

inserts a new entry a. at the end of the list b. at the beginning of the list c. between adjacent nodes of the list d. all of the above

14. In the linked implementation of a list, the add method public void add(int newPosition, T newEntry)

inserts a new entry

  1. between adjacent nodes of the list

  2. at the end of the list

  3. at the beginning of the list

  4. all of the above

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

    1. it throws an IndesOutOfBoundsException

    2. it throws an InvalidLinkException

    3. it returns null

    4. it returns false

  2. 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 **

  3. In the LList implementation of a list, given a node called currentNode, which statement moves

the nodes reference to the next node?

a. currentNode.getNextNode(); b. currentNode.get(); c. currentNode.forward(); d. currentNode.traverse();

  1. A reference to the last node in a linked implementation of a list is commonly called the

    1. tail

    2. end

    3. final

    4. none of the above

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

    1. adding a node to the end of a list

    2. searching for a node on the list

    3. removing a node from the list

    4. all of the above

  3. In a linked implementation of a list with a tail reference, removing an entry affects the tail reference if

    1. the list only contains one entry

    2. the list is empty

    3. the list is full

    4. all of the above

  1. In a linked implementation of a list with a tail reference, removing an entry affects the tail reference if

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

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

    3. the list is empty

    4. all of the above

  2. In a linked-based implementation of the ADT list with only a head reference, what is the performance of adding an entry at the end of the list?

    1. O(n)

    2. O(n2)

    3. O(log n)

    4. O(1)

  3. In a linked-based implementation of the ADT list with a tail reference, what is the performance of adding an entry at the end of the list?

    1. O(1)

    2. O(log n)

    3. O(n)

    4. O(n2)

  4. In a linked-based implementation of the ADT list with a tail reference, what is the performance of adding an entry that is not at the beginning of the list?

    1. O(n)

    2. O(n2)

    3. O(log n)

    4. O(1)

  5. In a linked-based implementation of the ADT list with only a head reference, what is the performance of removing an entry at the beginning of the list?

    1. O(1)

    2. O(log n)

    3. O(n)

    4. O(n2)

  6. In a linked-based implementation of the ADT list with only a head reference, what is the performance of removing an entry at the end of the list?

    1. O(n)

    2. O(n2)

    3. O(log n)

    4. O(1)

  1. In a linked-based implementation of the ADT list with a tail reference, what is the performance of removing an entry at the beginning of the list?

    1. O(1)

    2. O(log n)

    3. O(n)

    4. O(n2)

  2. In a linked-based implementation of the ADT list with a tail reference, what is the performance of removing an entry that is not at the beginning of the list?

    1. O(n)

    2. O(n2)

    3. O(log n)

    4. O(1)

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

    1. clear

    2. toArray

    3. contains

    4. all of the above

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

    1. adding an entry to the end of the list

    2. adding an entry to the beginning of the list

    3. clear

    4. all of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

When might an anycast address be useful?

Answered: 1 week ago

Question

Methods of Delivery Guidelines for

Answered: 1 week ago