Quiz


1.  

What is a linked list index?

a linked list index is an integer that represents the position of a node in a linked list.

2.  

What is the value of the first linked list index?

the value of the first index is zero.

3.  

What is the difference between the removeNode() and deleteNode() functions?

the removenode() requires a reference to the node that is to be removed, while the deletenode() function requires the value of the data element of the node that is being removed.

4.  

What is the return value of the findNode() function?

the return value of the findnode() function is the index position of the node.

5.  

What is the difference between the insertNodeAt() and the appendNode() functions?

the insertnodeat() function specifies the index of where to insert the new node into the linked list. the appendnode() function appends the new node to the list without requiring the programmer to specify where to place the new node in the linked list.

6.  

What happens if an invalid index value is passed to a function?

functions that use an index value always determine if the index passed tothem is valid before using the index value. if an invalid index is received, the function terminates without further processing.

7.  

Can a linked list store data other than integers?

yes, a linked list can store data other than integers. integers were used in this chapter as an example, but you can modify the data type of the data in the definition of the node to change the kind of data stored in the linked list.

8.  

Why would you define a getSize() function instead of having the application access the size of the linked list directly?

you use the getsize() function instead of having the application access the size of the linked list directly to protect the data from inadvertently being changed by the application. if the application needs to change the data, then the appropriate function is called and the function changes the data.

9.  

Can the insertNodeAt() function place a node at the front or back of a linked list?

yes, the insertnodeat() function can place a node at the front or back of a linked list if you pass the appropriate index to this function.

10.  

Why is it important to enhance the functionality of the LinkedList class?

you enhance the functionality of the linkedlist class to more easily manipulate a linked list.

Answers

1.  

A linked list index is an integer that represents the position of a node in a linked list.

2.  

The value of the first index is zero.

3.  

The removeNode() requires a reference to the node that is to be removed, while the deleteNode() function requires the value of the data element of the node that is being removed.

4.  

The return value of the findNode() function is the index position of the node.

5.  

The insertNodeAt() function specifies the index of where to insert the new node into the linked list. The appendNode() function appends the new node to the list without requiring the programmer to specify where to place the new node in the linked list.

6.  

Functions that use an index value always determine if the index passed to  them is valid before using the index value. If an invalid index is received, the function terminates without further processing.

7.  

Yes, a linked list can store data other than integers. Integers were used in this chapter as an example, but you can modify the data type of the data in the definition of the node to change the kind of data stored in the linked list.

8.  

You use the getSize() function instead of having the application access the size of the linked list directly to protect the data from inadvertently being changed by the application. If the application needs to change the data, then the appropriate function is called and the function changes the data.

9.  

Yes, the insertNodeAt() function can place a node at the front or back of a linked list if you pass the appropriate index to this function.

10.  

You enhance the functionality of the LinkedList class to more easily manipulate a linked list.




Data Structures Demystified
Data Structures Demystified (Demystified)
ISBN: 0072253592
EAN: 2147483647
Year: 2006
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net