CS210 Lab: Queue Prelab
The following are some questions that you can answer prior to the lab.
These questions are designed to refresh your memory on link lists.
For more details on link lists see the following CS115 labs:
Introduction to C++ Pointers
Simple Linked Lists
Refer to the following diagram when answering the questions:
- Give the values of the following expressions
- Are the following expressions true or false
- head->next == ptr1
- ptr1->next->data== 46
- ptr2->next == NULL
- head->data == 12
- Decide whether the syntax of each of the following statements is
valid or invalid. If it is valid, mark it as such; if it is
invalid, explain what is wrong.
- head->next = ptr1->next;
- head->next = *(ptr2->next);
- *head = ptr2;
- ptr2 = ptr1->next->data;
- ptr1->data = ptr2->data;
- ptr2 = ptr2->next->next;
- Write one statement to do each of the following:
- Make head point to the node containing 34.
- Make ptr2 point to the last node in the list.
- Make head point to an empty list.
- Set the data member of the node containing 34 to 45.
For Answers, click
Back to Queue Lab click
Copyright: Department of Computer Science, University of Regina.