978-1337102087 Chapter 17

subject Type Homework Help
subject Pages 9
subject Words 1516
subject Authors D. S. Malik

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 1
1. Linked lists allow you to overcome the size limitations of an array data type.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
1116
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
2. Memory for the components of an array does not need to be contiguous.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
1116
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
3. You can use the pointer head of a linked list to traverse the list.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
1120
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
4. We deallocate the memory for a linked list by calling the operator clear.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
1124
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
page-pf2
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 2
5. In a linked list, if a new item is always inserted at the beginning or at the end of the list and the data we read is
unsorted, the linked list will be unsorted.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
1124
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
6. When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
1128
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
7. It is not possible to create an ordered linked list.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
1130
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
8. The length of a linked list is the number of nodes in the list.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
1138
QUESTION TYPE:
True / False
HAS VARIABLES:
False
page-pf3
Name:
Class:
Date:
page-pf4
Name:
Class:
Date:
page-pf5
Name:
Class:
Date:
page-pf6
Name:
Class:
Date:
current = head;
while (current != nullptr)
{
//Process current
current = current->link;
}
a.
Insertion of a node
b.
Selection of a node
c.
Traversal of a linked list
d.
Creation of a new list
ANSWER:
c
POINTS:
1
REFERENCES:
1120
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
page-pf7
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 7
c.
traversal
d.
random
ANSWER:
b
POINTS:
1
REFERENCES:
1124
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
23. How many pointers are needed to build a linked list in a backward manner?
a.
One
b.
Two
c.
Three
d.
Four
ANSWER:
b
POINTS:
1
REFERENCES:
1128
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
24. Which of the following is a basic operation on singly linked lists?
a.
Retrieve the data of an arbitrary node.
b.
Swap the head and the last nodes.
c.
Determine whether the list is nearly full.
d.
Make a copy of the linked list.
ANSWER:
d
POINTS:
1
REFERENCES:
1129
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
12/20/2016 11:54 AM
25. The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.
a.
constructor
b.
destructor
c.
head pointer
d.
tail pointer
ANSWER:
b
POINTS:
1
REFERENCES:
1140
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
page-pf8
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 8
26. The steps involved in inserting a new item at the beginning of an unordered linked list are ____.
a.
1. Create a new node.
2. Insert the node before first.
3. Increment the counter by 1.
b.
1. Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
4. Increment the counter by 1.
c.
1. Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
d.
1. Create a new node.
2. Store the new item in the new node.
3. Insert the node before first.
4. Decrement the counter by 1.
ANSWER:
b
POINTS:
1
REFERENCES:
1143
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
27. Every node in a doubly linked list has two pointers: ____ and ____.
a.
top; bottom
b.
back; next
c.
current; forward
d.
previous; forward
ANSWER:
b
POINTS:
1
REFERENCES:
1166
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
28. Which of the following correctly initializes a doubly linked list in the default constructor?
a.
head = nullptr;
back = nullptr;
b.
head = 0;
back = 0;
count = 0;
c.
first = 0;
last = 0;
d.
first = nullptr;
last = nullptr;
page-pf9
Name:
Class:
Date:
count = 0;
ANSWER:
d
POINTS:
1
REFERENCES:
1167
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
page-pfa
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 10
____
}
The statement that provides the length of the linked list is ____.
a.
cout <<< count;
b.
destroy();
c.
return count;
d.
return next;
ANSWER:
c
POINTS:
1
REFERENCES:
1168
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
32. Consider the following code which deletes all the nodes in a linked list.
void doublyLinkedList<Type>::destroy()
{
nodeType<Type> *temp; //pointer to delete the node
while (first != nullptr)
{
temp = first;
first = first->next;
____
}
last = nullptr;
count = 0;
}
Which of the following is the missing statement?
a.
delete first;
b.
delete temp;
c.
destroy temp;
d.
clear temp;
ANSWER:
b
POINTS:
1
REFERENCES:
1167
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:43 PM
DATE MODIFIED:
10/5/2016 1:43 PM
33. Which of the following statements appears in the insert function of a doubly linked list?
a.
current++;
b.
trailCurrent++;
c.
newNode++;
d.
count++;
ANSWER:
d
POINTS:
1
REFERENCES:
1171
QUESTION TYPE:
Multiple Choice
page-pfb
Name:
Class:
Date:
page-pfc
Name:
Class:
Date:

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.