Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Problem Solving with C++ Study Set 1
Quiz 13: Pointers and Linked Lists
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 41
Multiple Choice
Which of the following loops correctly uses iter as an iterator to move through the nodes of the linked list? NodePtr iter; //a pointer to a node
Question 42
Multiple Choice
A stack exhibits ______________ behavior
Question 43
Multiple Choice
If NodeTypePtr is defined to be a pointer type to a node in a linked list, then the declaration NodeTypePtr head;
Question 44
Multiple Choice
Given the following declarations, which statement would allocate memory for the first item in the list? Struct Node { Int item; Node* link; }; Typedef Node* NodePtr; NodePtr head;
Question 45
Multiple Choice
The actual value of NULL is
Question 46
Multiple Choice
As defined in the text, the pointer variable head
Question 47
Multiple Choice
If you need to access the last element of a linked list with N nodes in it, how many comparisons do you need to make to find the last element?
Question 48
Multiple Choice
What is wrong with the following definition of headInsert? Struct Node { Int item; Node* link; }; Typedef Node* NodePtr; Void headInsertNodePtr& head, int data) { NodePtr tmp = new Node; Tmp->item = data; Head->next = tmp; Tmp->next = head->next; } NodePtr head; HeadInserthead, 4) ;
Question 49
Multiple Choice
Given the following stack declaration, which of the following function definitions would correctly implement the destructor? Struct StackFrame { Char data; StackFrame *link; }; Typedef StackFrame* StackFramePtr; Class Stack { Public: Stack ) ; Stackconst Stack& a_stack) ; ~Stack ) ; Void pushchar the_symbol) ; Char pop ) ; Bool empty ) const; Private: StackFramePtr top; };
Question 50
Multiple Choice
What happens if you have two lists list1, list2) , no assignment operator in your class, and attempt to execute the following statement? List1 = list2;
Question 51
Multiple Choice
In the following search function for a linked list using the Node and NodePtr as defined in the text) , why is there code to check if here is NULL? NodePtr searchNodePtr head, int target) { NodePtr here = head; Ifhere == NULL) { Return NULL; } Else { While here->data != target && here->link != NULL) { Here = here->link; } Ifhere->data == target) { Return here; } Else { Return NULL; } } }
Question 52
Multiple Choice
To add an item to a stack, we call the ______ function
Question 53
Multiple Choice
Given a linked list using the code from the book) , which of the following sets of statements would implement a function to return the last item in the list?
Question 54
Multiple Choice
Given the following function declaration Void insert NodePtr afterMe, int num) ; //PRE: afterMe points to some node in the non-empty list //POST: A new node containing num is inserted after afterMe. Void insertNodePtr afterMe, int num) { // which of the following function definitions correctly implement this //function? }
Question 55
Multiple Choice
To remove an item from the stack, we call the ____ function
Question 56
Multiple Choice
Given a linked list using the code from the book) and assuming there are at least two nodes in the list, which of the following sets of statements would implement a function to return and remove the last item in the list?