Tuesday, July 28, 2009

This is a question about data structures (linked lists) can anyone help?

Suppose cursor points to a node in a linked list (using the node definition with member functions called data and link). What statement changes cursor so that it points to the next node?


A. cursor++;


B. cursor = link( );


C. cursor += link( );


D. cursor = cursor-%26gt;link( );





Suppose cursor points to a node in a linked list (using the node definition with member functions called data and link). What Boolean expression will be true when cursor points to the tail node of the list?


A. (cursor == NULL)


B. (cursor-%26gt;link( ) == NULL)


C. (cursor-%26gt;data( ) == NULL)


D. (cursor-%26gt;data( ) == 0.0)


E. None of the above.





Why does our node class have two versions of the link member function?


A. One is public, the other is private.


B. One is to use with a const pointer, the other with a regular pointer.


C. One returns the forward link, the other returns the backward link.


D. One returns the data, the other returns a pointer to the next node.

This is a question about data structures (linked lists) can anyone help?
Question 1 - Answer: D


Question 2 - Answer: B


Question 2 - Answer: C*


*I can only assume "your" definition of the node class is a 2-way linked list. If the definition is of a single-direction linked list, then C is not the answer


No comments:

Post a Comment