Deck 13: Pointers and Linked Lists
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/51
العب
ملء الشاشة (f)
Deck 13: Pointers and Linked Lists
1
You can directly access the nth node of a linked list
False
2
If you write a linked list class,then you should implement the destructor,copy constructor,and the assignment operator
True
3
The stack exhibits last-in/first-out behavior
True
4
There is no need for error checking when popping a stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
5
Most applications that use a stack will store a struct or class object on the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
6
*head.item is the same as *head).item
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
7
A stack is a first-in-first-out data structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
8
A stack is a specialized type of list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
9
A queue is first-in-first-out data structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
10
Data is removed at the back of the queue.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
11
Placing data on a stack is called popping the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
12
Data is inserted into a queue at the back.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
13
The linked list is always the most efficient storage mechanism for storing many pieces of data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
14
Removing data from a stack is called popping the stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
15
The last node in a linked list as defined in the text should always point back to the head of the list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
16
A linked list is not fixed in size.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
17
The constant NULL can be assigned only to pointers that point to numbers
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
18
A _______ is a list constructed using pointers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
19
The stack can be compared to a line of people at a bank,where the first person in line is the first person served.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
20
There is no need for error checking when pushing a stack.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
21
Dynamically allocated memory that is no longer pointed to by any pointer variable causes a ______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
22
If you want to make your linked list a class,you must also include the _____.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
23
The number of possible nodes in a linked list is __________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
24
The function used to put data into a stack is typically called _______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
25
In a node type named MyNode,which of the following correctly declares a pointer to a node of that type?
A)MyNode* ptr;
B)MyNode ptr;
C)ptr myNode*;
D)MyNode.data* ptr;
A)MyNode* ptr;
B)MyNode ptr;
C)ptr myNode*;
D)MyNode.data* ptr;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
26
A _________ is a struct or class object that has one or more member variables that are pointer variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
27
The pointer in a node points to
A)the data part of a node
B)the count part of a node
C)the pointer part of the node
D)the whole node
A)the data part of a node
B)the count part of a node
C)the pointer part of the node
D)the whole node
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
28
A stack can be implemented using a __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
29
The first node in a linked list is generally named _________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
30
The function used to get the data at the top or front)of the stack is called _______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
31
The arrow operator ->)specifies
A)a member of a struct or class that is pointed to by a pointer variable
B)the pointer member only of a struct or a class that is pointed to by a pointer variable
C)less than or equal
D)is known as NULL
A)a member of a struct or class that is pointed to by a pointer variable
B)the pointer member only of a struct or a class that is pointed to by a pointer variable
C)less than or equal
D)is known as NULL
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
32
You can define a stack that will hold _________-
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
33
The arrow operator ->)combines the actions of which two operators?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
34
If you want to declare a node type struct and typedef a pointer type for that node,in which order must you make these declarations?
A)first the node pointer,then the node,since the node has a pointer in it.
B)first the node,then the typedef.
C)it doesn't matter which order you do them in
D)you cannot do both of them in the same program.
A)first the node pointer,then the node,since the node has a pointer in it.
B)first the node,then the typedef.
C)it doesn't matter which order you do them in
D)you cannot do both of them in the same program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
35
In a linked list as defined in the text,the pointer in the last node in the list should always point to _________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which operator * or .)has higher precedence?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
37
When adding a node to a linked list,which pointer variable do you update first?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
38
If head is a NodePtr pointer variable,write the code to make head point to new node of type Node.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
39
Apart from constructors,the operations for a queue listed in the text are ____________,_____________,and _______________,
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
40
Apart from constructors,the operations for a stack listed in the text are ____________,_____________,and _______________,
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
41
As defined in the text,the pointer variable head
A)is the first node in the list
B)points to the first node in the list
C)is always NULL
D)is undefined
A)is the first node in the list
B)points to the first node in the list
C)is always NULL
D)is undefined
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
42
If you push the following numbers onto an integer stack,what item is on the top of the stack? 1,4,8,16)
A)1
B)4
C)8
D)16
A)1
B)4
C)8
D)16
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
43
The actual value of NULL is
A)-1
B)0
C)99999
D)-99
A)-1
B)0
C)99999
D)-99
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
44
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
A)whileiter != NULL) iter++;
B)whileiter != NULL) iter=iter->link;
C)foriter=NULL; iter != NULL; iter=iter->link)
D)for iter=head; iter != NULL; iter=iter->link)
NodePtr iter; //a pointer to a node
A)whileiter != NULL) iter++;
B)whileiter != NULL) iter=iter->link;
C)foriter=NULL; iter != NULL; iter=iter->link)
D)for iter=head; iter != NULL; iter=iter->link)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
45
To remove an item from the stack,we call the ____ function
A)pop
B)top
C)push
D)empty
A)pop
B)top
C)push
D)empty
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
46
To add an item to a stack,we call the ______ function
A)pop
B)top
C)push
D)empty
A)pop
B)top
C)push
D)empty
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
47
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?
A)0
B)1
C)N-1
D)N
A)0
B)1
C)N-1
D)N
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
48
A stack exhibits ______________ behavior
A)last-in/ first-out
B)last-in/last-out
C)first-in/first-out
D)none of the above
A)last-in/ first-out
B)last-in/last-out
C)first-in/first-out
D)none of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
49
If you need to insert an element in the front of a list with N nodes and move the other elements back one place),how many nodes do you have to move?
A)0
B)1
C)N-1
D)N
A)0
B)1
C)N-1
D)N
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
50
If NodeTypePtr is defined to be a pointer type to a node in a linked list,then the declaration
NodeTypePtr head;
A)allocates memory for the node that head will point to
B)automatically makes head->link point to NULL
C)allocates only the memory for a pointer variable
D)allocates a linked list
NodeTypePtr head;
A)allocates memory for the node that head will point to
B)automatically makes head->link point to NULL
C)allocates only the memory for a pointer variable
D)allocates a linked list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
51
When would you use a linked list over an array or a dynamic array?
A)when you know the maximum size at compile time
B)when you know the maximum size at run-time
C)when you do not know the maximum size
D)when you need to access any item quickly
A)when you know the maximum size at compile time
B)when you know the maximum size at run-time
C)when you do not know the maximum size
D)when you need to access any item quickly
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck