Deck 16: Linked Lists
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 16: Linked Lists
1
A linked list is a collection of components called ____.
A) elements
B) nodes
C) members
D) pointers
A) elements
B) nodes
C) members
D) pointers
B
2
The link field of the last node of a linked list is ____.
A) NULL
B) 1
C) n-1
D) n
A) NULL
B) 1
C) n-1
D) n
A
3
You deallocate the memory for a linked list by calling the operator clear.
False
4
Data can be organized and processed sequentially using an array called a(n)____ list.
A) linked
B) ordered
C) sequential
D) ascending
A) linked
B) ordered
C) sequential
D) ascending
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Each node of a singly linked list has two components: ____ and ____.
A) info, head
B) link, back
C) back, head
D) info, link
A) info, head
B) link, back
C) back, head
D) info, link
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
Linked lists allow you to overcome the size limitations of an array data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
The length of a linked list is the number of nodes in the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
In a linked list,the address of the first node in the list is stored in a separate location,called the ____ or first.
A) head
B) pointer
C) front
D) top
A) head
B) pointer
C) front
D) top
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Suppose that the pointer head points to the first node in the list,and the link of the last node is NULL.The first node of the linked list contains the address of the ____ node.
A) head
B) first
C) second
D) tail
A) head
B) first
C) second
D) tail
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
What is the purpose of the following code? current = head;
While (current != NULL)
{
//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
While (current != NULL)
{
//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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
When you build a linked list in the backward manner,a new node is always inserted at the end of the linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
In a linked list,the order of the nodes is determined by the address,called the ____,stored in each node.
A) head
B) tail
C) link
D) first
A) head
B) tail
C) link
D) first
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
A linked list is a random access data structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
Every node (except of the last node)in a singly linked list contains ____.
A) the next node
B) no address information
C) the address of the next node
D) the address of the previous node
A) the next node
B) no address information
C) the address of the next node
D) the address of the previous node
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
It is not possible to create an ordered linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
A doubly linked list can be traversed in either direction.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a linked list,if a new item is always inserted at the beginning or at the end of the list and the data read is unsorted,the linked list will be unsorted.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
Because each node of a linked list has two components,we need to declare each node as a(n)____.
A) reference and string
B) int and object
C) index and element
D) class or struct
A) reference and string
B) int and object
C) index and element
D) class or struct
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
You can use the pointer head of a linked list to traverse the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Memory for the components of an array does not need to be contiguous.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following correctly initializes a doubly linked list in the default constructor?
A) head = NULL;
Back = NULL;
B) head = 0;
Back = 0;
Count = 0;
C) first = 0;
Last = 0;
D) first = NULL;
Last = NULL;
Count = 0;
A) head = NULL;
Back = NULL;
B) head = 0;
Back = 0;
Count = 0;
C) first = 0;
Last = 0;
D) first = NULL;
Last = NULL;
Count = 0;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
When building a linked list in the ____ manner,a new node is always inserted at the end of the linked list.
A) backward
B) forward
C) traversal
D) random
A) backward
B) forward
C) traversal
D) random
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
template
____ doublyLinkedList::isEmptyList() const
{
return (first == NULL);
}
Consider the following code,which deletes all the nodes in a linked list. void doublyLinkedList::destroy()
{
NodeType *temp; //pointer to delete the node
While (first != NULL)
{
Temp = first;
First = first->next;
____
}
Last = NULL;
Count = 0;
}
Which of the following is the missing statement?
A) delete first;
B) delete temp;
C) destroy temp;
D) clear temp;
____ doublyLinkedList
{
return (first == NULL);
}
Consider the following code,which deletes all the nodes in a linked list. void doublyLinkedList
{
NodeType
While (first != NULL)
{
Temp = first;
First = first->next;
____
}
Last = NULL;
Count = 0;
}
Which of the following is the missing statement?
A) delete first;
B) delete temp;
C) destroy temp;
D) clear temp;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
template
____ doublyLinkedList::isEmptyList() const
{
return (first == NULL);
}
Consider the accompanying statements.The list is empty if the pointer first is ____.
A) NULL
B) 0
C) last
D) next
____ doublyLinkedList
{
return (first == NULL);
}
Consider the accompanying statements.The list is empty if the pointer first is ____.
A) NULL
B) 0
C) last
D) next
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
What is the output of the following program segment? (The class unorderedLinkedList is as defined in the book.) unorderedLinkedList list;
List.insertFirst(6);
List.insertLast(5);
List.insertFirst(4);
List.insertFirst(8);
List.insertLast(10);
List.deleteNode(4);
List.insertFirst(1);
List.print();
A) 1 6 5 8 10
B) 1 6 8 10 5
C) 1 8 6 5 10
D) 1 8 10 6 5
List.insertFirst(6);
List.insertLast(5);
List.insertFirst(4);
List.insertFirst(8);
List.insertLast(10);
List.deleteNode(4);
List.insertFirst(1);
List.print();
A) 1 6 5 8 10
B) 1 6 8 10 5
C) 1 8 6 5 10
D) 1 8 10 6 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
In C++,the dereferencing operator is represented by the ____________________ symbol.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
In a linked list,the link component of each node is a(n)____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
Each node of a linked list must store the data as well as the ____________________ for the next node in the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
How many pointers are needed to build a linked list in a backward manner?
A) One
B) Two
C) Three
D) Four
A) One
B) Two
C) Three
D) Four
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
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
A) constructor
B) destructor
C) head pointer
D) tail pointer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Every node in a doubly linked list has two pointers: ____ and ____.
A) previous; next
B) back; next
C) current; next
D) previous; current
A) previous; next
B) back; next
C) current; next
D) previous; current
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
template
____ doublyLinkedList::isEmptyList() const
{
return (first == NULL);
}
Consider the accompanying statements.The operation returns true if the list is empty; otherwise,it returns false.The missing code is ____.
A) protected
B) int
C) void
D) bool
____ doublyLinkedList
{
return (first == NULL);
}
Consider the accompanying statements.The operation returns true if the list is empty; otherwise,it returns false.The missing code is ____.
A) protected
B) int
C) void
D) bool
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
The deleteNode operation (if the item to be deleted is in a doubly linked list)requires the adjustment of ____ pointer(s)in certain nodes.
A) one
B) two
C) three
D) four
A) one
B) two
C) three
D) four
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
struct nodeType
{
int info;
nodeType *link;
};
nodeType *head, *p, *q, *newNode;
newNode = new nodeType;
Consider the accompanying code.What is the effect of the following statement? newNode->info = 50;
A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
{
int info;
nodeType *link;
};
nodeType *head, *p, *q, *newNode;
newNode = new nodeType;
Consider the accompanying code.What is the effect of the following statement? newNode->info = 50;
A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
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 full.
D) Make a copy of the linked list.
A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is full.
D) Make a copy of the linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
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.
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
template
____ doublyLinkedList::isEmptyList() const
{
return (first == NULL);
}
Which of the following statements appears in the insert function of a doubly linked list?
A) current++;
B) trailCurrent++;
C) newNode++;
D) count++;
____ doublyLinkedList
{
return (first == NULL);
}
Which of the following statements appears in the insert function of a doubly linked list?
A) current++;
B) trailCurrent++;
C) newNode++;
D) count++;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
template
____ doublyLinkedList::isEmptyList() const
{
return (first == NULL);
}
Consider the following code: template
Int doublyLinkedList::length()const
{
____
}
The statement that provides the length of the linked list is ____.
A) cout <<< count;
B) destroy();
C) return count;
D) return next;
____ doublyLinkedList
{
return (first == NULL);
}
Consider the following code: template
Int doublyLinkedList
{
____
}
The statement that provides the length of the linked list is ____.
A) cout <<< count;
B) destroy();
C) return count;
D) return next;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
A(n)____________________ is an object that produces each element of a container,such as a linked list,one element at a time.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
The ____________________ operator advances the iterator to the next node in the linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
In a circular linked list with more than one node,it is convenient to make the pointer first point to the ____________________ node of the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
The nodes of a standard ordered list (as constructed in the text)are in ____________________ order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
In a linked list,the ____________________ operator returns the info of the current node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
If a formal parameter is a value parameter,the ____________________ constructor provides the formal parameter with its own copy of the data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
For classes that include pointer data members,the assignment operator must be explicitly ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
The ____________________ constructor executes when an object is declared and initialized using another object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
A(n)____________________ linked list is a linked list in which every node has a next pointer and a back pointer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
The ____________________ constructor can make an identical copy of a linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
A linked list must be searched ____________________,starting from the first node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
A linked list in which the last node points to the first node is called a(n)____________________ linked list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck