Austin Community College District | Start Here. Get There.



COSC 1320 C++ PROGRAMMING

Homework 10

Part I

True/False

1. A linked list is called "linked" because each node in the series has a

pointer that points to the next node in the list.

*a. True b. False

2. When working with a linked list, one of the operations you can perform is to

destroy the list.

*a. True b. False

3. If there are no nodes in a linked list, you cannot append a node to the

list.

a. True *b. False

4. A new node must always be made the last node in the list.

a. True *b. False

5. A new node cannot become the first node in the list.

a. True *b. False

6. If a node is not the first node in a linked list, deleting it may require

setting the successor pointer in its predecessor.

*a. True b. False

7. Deleting a node from a linked list requires that every node after the

deletion point be shifted back one position.

a. True *b. False

8. Deleting an entire list requires traversing the list to delete the nodes.

*a. True b. False

9. When you create a linked list, you must know in advance how many nodes the

list will contain.

a. True *b. False

10. The values stored in the value portion of a node of a linked list can be

simple data types, structures, objects of classes, or any other data type.

*a. True b. False

11. A linked list can grow and shrink as a program runs.

*a. True b. False

12. When you delete a node from a linked list, you must ensure that the links in

the surrounding nodes are set to bypass the node being deleted.

*a. True b. False

13. Deleting an entire linked list requires a call to the delete operator for

each node in the list.

*a. True b. False

14. The Standard Template Library (STL) provides a linked list container.

*a. True b. False

15. Linked lists are less complex to code and manage than arrays.

a. True *b. False

Part II

Multiple Choice

16. ADT stands for:

a) Algorithm Dependent Template.

b) Algorithm Driven Template.

*c) Abstract Data Type.

d) Automatic Data Type.

e) None of the above.

17. A linked list is a series of connected ________.

a) ADT's

b) vectors

c) algorithms

*d) nodes

e) None of the above

18. The ________ of a linked list points to the first node in the list.

a) starter

*b) head

c) tail

d) declaration

e) None of the above

19. 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 end of the list

d) All of the above

e) None of the above

20. Moving through a linked list is referred to as ________ the list.

a) cruising

*b) traversing

c) node-hopping

d) alternating

e) None of the above

21. If the head pointer points to NULL, it is an indication that

a) the list has been 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 the above.

22. When using a node pointer to traverse a linked list, we know we have reached

the end of a list when

a) we encounter the new line character '\n'

*b) we encounter a successor pointer value of NULL in the current node.

c) we arrive back at the beginning of the list.

d) we encounter a sentinel, usually 9999

e) None of the above.

23. To build a linked list, we can

a) start with an empty list, and then form an array of nodes.

*b) start with an empty list, and then perform a series of append operations.

c) use the constructor to create an array of nodes.

d) call the list init function.

d) None of the above.

24. Which of the following are linked list operations?

a) appending a node

b) traversing the list

c) inserting or deleting a node

*d) All of the above

e) None of the above

25. If new information needs to be added to a linked list, the program simply

________________ and inserts it into the list.

*a) allocates another node

b) removes a node

c) borrows a node from the compiler

d) either B or C

e) None of the above

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download