Chapter 17 Starting out with C++ Linked Lists
Download file with the answers
Chapter 17 Starting out with C++ Linked Lists
1 file(s) 74.43 KB
Not a member!
Create a FREE account here to get access and download this file with answers
Chapter Seventeen
MULTIPLE CHOICE
1. ADT stands for:
a. Algorithm Dependent Template
b. Algorithm Driven Template
c. Abstract Data Type
d. Automatic Data Type
e. None of these
2. A linked list is a series of connected _______.
a. ADT’s
b. vectors
c. algorithms
d. nodes
e. None of these
3. The ________ of a linked list points to the first node in the list.
a. starter
b. head
c. tail
d. declaration
e. None of these
4. To append a node to a list means to ___________.
a. delete a node from the beginning of the list
b. delete a node from the end of the list
c. add a node to the beginning of the list
d. add a node to the end of the list
e. None of these
5. Moving through a linked list is referred to as ___________ the list.
a. cruising
b. traversing
c. node-hopping
d. alternating
e. None of these
6. If the head pointer points to NULL, this indicates
a. the list has been previously created and then destroyed
b. the list needs to be destroyed
c. there are no nodes in the list
d. the list is full and cannot accept any new nodes
e. None of these
7. An insertion or deletion routine requires that you create this many pointers for use during the traversal process.
a. two — one for the node being inspected, and one for the previous node.
b. two — one for the node being inspected, and one for the next node.
c. one — for the node being inserted or deleted
d. three — one for the inspected node, one for the next node, and one for the following node
8. Deleting a node is a ______________ step process.
a. one — delete the node from memory
b. two — remove the node without breaking links, then delete it from memory
c. three — create a blank node, remove the node being deleted, insert the blank, then delete the node
d. four — create a blank, remove the node being deleted, insert the blank, delete the node, delete the blank
e. None of these
9. A doubly-linked list keeps track of the next node in the list, as well as:
a. itself
b. the head node
c. the tail node
d. the previous node
e. None of these
10. The list container provided by the Standard Template Library is a template version of a _________________.
a. singly-linked list
b. doubly-linked list
c. circular-linked list
d. backward-linked list
e. None of these
11. Appending a node means adding it to the end of a list. ________ a node means putting a new node in the list, but not necessarily at the end.
a. Concatenating
b. Popping
c. Clamping
d. Inserting
e. None of these
12. In a circular-linked list, the last node points to the:
a. head pointer
b. tail pointer
c. first node
d. closing curly brace of the original structure declaration
e. None of these
13. If new data needs to be added to a linked list, the program simply ________________ and inserts it into the series.
a. allocates another node
b. removes a node
c. borrows a node from the compiler
d. either b or c
e. None of these
14. The advantage a linked list has over a vector is:
a. A linked list can dynamically shrink or grow, and a vector cannot
b. A linked list is smaller than a vector
c. A node can be inserted into or removed from a linked list faster than from a vector
d. Data removal and insertion are more accurate with a linked list than with a vector
e. None of these
15. To create a linked list, you first create a(n)
a. header file
b. function template
c. exception
d. struct
e. None of these
16. Which of the following is a basic linked list operation?
a. appending a node
b. traversing the list
c. inserting or deleting a node
d. All of these
e. None of these
17. The last node in a linked list points to ______.
a. NULL
b. the previous node
c. the first node in the list
d. nothing. It does not contain a pointer.
e. None of these.
18. A __________ is used to travel through a linked list and search for data.
a. node
b. pointer
c. NULL value
d. traversal operator
e. None of these
19. While traversing a list, a node pointer knows when it has reached the end of a list when:
a. it encounters the newline character
b. it encounters NULL
c. it finds itself back at the beginning of the list
d. it encounters a sentinel, usually 9999
e. None of these
20. To build a list initially, you can use a(n) ________________ routine.
a. build
b. append
c. constructor
d. init
e. None of these
21. Variations of the linked list are:
a. doubly-linked list
b. circular linked list
c. backward linked list
d. a and b
e. None of these
22. A linked list class must take care of removing the dynamically allocated nodes. This is done by ________________.
a. the constructor function
b. the destructor function
c. overriding the removal function
d. overloading the memory persistence operator
e. None of these
23. A __________ list contains pointers to the nodes before it and after it.
a. singly-linked
b. doubly-linked
c. circular-linked
d. b and c
e. None of these
24. This type of list does not contain a NULL pointer at the end of the list.
a. circular-linked
b. doubly-linked
c. backwards-linked
d. NULL-linked
e. None of these
25. To insert a new node in ascending order into a list, the list must be:
a. arranged in descending order
b. arranged in ascending order
c. randomly ordered
d. empty
TRUE/FALSE
1. True/False: A linked list is called “linked” because each node in the series has a pointer that points to the next node in the list.
2. True/False: When working with a linked list, one of the basic operations you can perform is to destroy the list.
3. True/False: If there are no nodes in a linked list, you cannot append a node to the list.
4. True/False: A new node must always be made the last node in the list.
5. True/False: A new node cannot become the first node in the list.
6. True/False: Deleting an entire list requires traversing the list, deleting each node one by one.
7. True/False: When you create a linked list, you must know in advance how many nodes the list will contain.
8. True/False: A linked list can consist of structs, objects, or other abstract data types.
9. True/False: A linked list can grow and shrink as a program runs.
10. True/False: Linked lists are less complex to code and manage than arrays.
11. True/False: Nodes in a linked list are stored in contiguous memory.
12. True/False: When you delete a node from a list, you must ensure that the links in the list are not permanently broken.
13. True/False: Deleting an entire list simply requires the use of the delete operator.
14. True/False: The Standard Template Library (STL) provides a linked list container.
15. True/False: A list that contains pointers to the previous node, the next node, and a node in the third dimension is known as a triple-linked list.
Leave a reply