Exam 17: Linked Data Structures
Exam 1: C++ Basics37 Questions
Exam 2: Flow of Control33 Questions
Exam 3: Function Basics30 Questions
Exam 4: Parameters and Overloading31 Questions
Exam 5: Arrays32 Questions
Exam 6: Structures and Classes37 Questions
Exam 7: Constructors and Other Tools32 Questions
Exam 8: Operator Overloading,friends,and References31 Questions
Exam 9: Strings37 Questions
Exam 10: Pointers and Dynamic Arrays29 Questions
Exam 11: Separate Compilation and Namespaces35 Questions
Exam 12: Streams and File IO43 Questions
Exam 13: Recursion40 Questions
Exam 14: Inheritance30 Questions
Exam 15: Polymorphism and Virtual Functions34 Questions
Exam 16: Templates27 Questions
Exam 17: Linked Data Structures30 Questions
Exam 18: Exception Handling29 Questions
Exam 19: Standard Template Library46 Questions
Exam 20: Patterns and Uml22 Questions
Select questions type
Here is a diagram of a three node linked list with a head pointer and a node to be inserted.Show all steps necessary to delete the second node,pointed to by discard_me.You may assume the necessary search for the node to be deleted is done and the pointer discard_me is already positioned.
You are to make clear the sequence of steps by either numbering the steps,or by making several copies of this drawing,with one change per drawing,numbered to show the sequence.
You may assume that a search routine taking a head pointer and data arguments has been defined for you.
Give code and the drawing to make clear what you are doing.
NodePtr discard_me;
NodePtr temp_ptr;


Free
(Essay)
4.9/5
(28)
Correct Answer:
Code:
NodePtr discard_me;
NodePtr temp_ptr;
discard_me = search( head,discard_data);
head->link = discard_me->link;
delete discard_me
Given the doubly linked list in the diagram below,give the code to delete the second node in the list with the number 31.Assume each entry in the list is a node of class Node with a public next and prev member variable.


Free
(Essay)
4.8/5
(39)
Correct Answer:
Node *toDelete = head->next;
head->next->next->prev = head;
head->next = toDelete->next;
delete toDelete;
Given the type definitions:
const int STRING_SIZE = 20;
struct ListNode
{
char item[STRING_SIZE];
int count;
ListNode *link;
};
ListNode *head = new ListNode;
Give a typedef statement that hides the pointer operator *.Call the new type identifier NodePtr.
(Short Answer)
5.0/5
(43)
Here is a diagram of a three node linked list with a head pointer and a node to be inserted.Show all steps necessary to insert the node pointed to by temp between the second and third nodes,including the search for the node prior to insertion.You are to make clear the sequence of steps by either numbering the steps,or by making several copies of this drawing,with one change per drawing,numbered to show the sequence.You may assume a search routine taking a head node and data has been defined for you.
Give code and the drawing to make clear what you are doing.


(Essay)
4.9/5
(40)
To insert a node into a doubly linked list requires references to the node before and after the location we wish to insert the new node.
(True/False)
4.7/5
(28)
A linked list is normally specified by giving a pointer pointing to the first node of a list.An empty list has no nodes at all.What is the value of a head pointer for an empty list?
(Essay)
4.9/5
(34)
Given the structure definition:
const int STRING_SIZE = 20;
struct ListNode
{
char item[STRING_SIZE];
int count;
ListNode * link;
};
ListNode *head = new ListNode;
Show two equivalent ways to set the count member in the ListNode variable to which head points.
(Essay)
4.9/5
(37)
Which of the following are potential problems when we use the delete operator on a pointer variable?
(Multiple Choice)
4.8/5
(39)
Suppose you have the following struct definition and typedef statements in your program:
struct N
{
double d;
N *next;
};
typedef N* node_ptr;
node_ptr head,p1,p2;
Now suppose further that p1 points to a node of type N in the middle of a linked list (neither the first nor the last node).Write code that deletes the node after the node p1 points to in the linked list.After the code is executed,the linked list should be the same,excepting the specified node is missing.
(Essay)
4.8/5
(31)
Insertion into a linked list takes the same number of operations no matter where the insertion occurs
(True/False)
4.9/5
(40)
Give pseudocode for inserting a node in front of the head node in a linked list.
(Essay)
4.8/5
(40)
Name the stack operations as implemented in the text.Tell what each does.
(Essay)
4.7/5
(39)
A friend class is made to further a sense of community among the students.
(True/False)
4.9/5
(31)
Why can a raw pointer be used as an iterator for an array,but not for a list?
(Essay)
4.9/5
(26)
Most applications that use a stack will store a struct or class object on the stack.
(True/False)
4.7/5
(33)
Showing 1 - 20 of 30
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)