1 / 6

# a. ptr = ptr-&gt;link; b. ptr++; c. *ptr = ptr-&gt;link; d. ptr = *ptr; e. ptr-&gt;link = ptr;

0. Given the declarations struct ListNode { float volume; ListNode* link; }; ListNode* ptr; which of the following statements advances ptr to point to the next node of a list?. a. ptr = ptr-&gt;link; b. ptr++; c. *ptr = ptr-&gt;link; d. ptr = *ptr; e. ptr-&gt;link = ptr;.

Télécharger la présentation

## a. ptr = ptr-&gt;link; b. ptr++; c. *ptr = ptr-&gt;link; d. ptr = *ptr; e. ptr-&gt;link = ptr;

E N D

### Presentation Transcript

1. 0 Given the declarations struct ListNode { float volume; ListNode* link; }; ListNode* ptr; which of the following statements advances ptr to point to the next node of a list? • a. ptr = ptr->link; • b. ptr++; • c. *ptr = ptr->link; • d. ptr = *ptr; • e. ptr->link = ptr;

2. 0 The following code, which builds a linked list with the numbers 18 and 32 as its components, has a missing statement. What should the statement be? struct NodeType { int data; NodeType* link; }; NodeType* head, p, q; p = new NodeType; head = p; p->data = 18; q = new NodeType; q->data = 32; <-- Statement is missing here q->link = NULL; • a. p = q; • b. p->link = new NodeType; • c. p->link = q; • d. p->link = q->link;

3. 0 What is special about the last node in a dynamic linked list? • a. Its component (data) member is undefined. • b. Its component (data) member contains the value 0. • c. Its link member is undefined. • d. Its link member contains the value NULL. • e. It has no link member

4. 0 If a program accidentally corrupts the link member of a node in the middle of a linked list, how much of the original linked list is now inaccessible? a. only the corrupted node is inaccessible b. all nodes preceding the corrupted node are inaccessible c. all nodes following the corrupted node are inaccessible d. the entire linked list is inaccessible