| How can you tell if an error occurred while allocating memory?
| A | delete MyRecordPointer;
|
| What is the heap?
| B | A null value in the next pointer of the last node.
|
| Describe a program that might benefit from a linked list.
| C | A pointer to the next node.
|
| What signals the end of a linked list?
| D | MYRecordPointer = new student-record;
|
| What is the most common reason for unsuccessful allocation when using the new operator?
| E | The memory left over after your operating system and programs are loaded.
|
| In addition to the data you want to store in the linked list, what must each node store?
| F | if (MyRecordPointer 1= NULL)
{ cout « "Allocation successful.\n"; } else
{ cout « "Memory allocation errorl\n"; } 10. delete MyRecordPointer;
|
| What is the name of the pointer that points to the first node in a linked list?
| G | A program that adds and deletes data frequently.
|
| Write a statement that will allocate memory on the heap for a structure named Btudent-record. Assign the address of the allocated memory to a pointer called MyRecordPointer
| H | The head pointer.
|
| Write the code necessary to check for errors in the memory allocation in question 8 above. Your code should display a message indicating that the memory allocation was successful or unsuccessful.
| I | Test the pointer that the new operator was supposed to create. If it is equal to NULL, there was an allocation error.
|
| Write a statement that deallocates the memory allocated in question 8.
| J | Insufficient free RAM to satisfy your request.
|
| Assume a linked list exists and that a pointer named head ptr points to the first node of the list. Within each node is a pointer named next which points to the next node in the list. Write a statement that will assign the address of the first node in the list to a pointer named traversing ptr.
| K | nodes D, E, and F would become inaccessible.
|
| Write a loop that will traverse the linked list described in question 1 above using the pointer named traversing-ptr, which currently points to the head of the list. The loop should iterate until all nodes have been visited. When the loop stops iterating, traversing-ptr should hold the address of the last node in the list.
| L | Node E would become inaccesible.
|
| If head-ptr were assigned a null pointer, how would the operation of the linked list be affected?
| M | while(traversing-ptr.next 1= NULL)
{traversing-ptr = traversing-ptr.next; }
|
| Ifhead-ptr were made to point to node B rather thanA, how would nodeAbe accessed?
| N | Any traversal would loop infinitely at the end of the list because a null pointer would not be reached.
|
| If the next pointer in node C were assigned a null pointer, how would nodes D, E, and F be affected?
| O | traversing-ptr = head-ptr;
|
| If the next pointer in node D were made to point to node F rather than node E, how would node E be affected?
| P | A could no longer be accessed.
|
| If the next pointer in node E were made to point to node E (itself), what would happen when the list is traversed?
| Q | The entire list would be lost because you could not find the first node.
|