41. True or False? Searching the components of an unordered list ADT is faster w
ID: 3690133 • Letter: 4
Question
41. True or False? Searching the components of an unordered list ADT is faster with a linked list representation than with a direct array representation.
a) true
b) false
42. True or False? If an operation that allows random access to individual components of a list ADT is defined and occurs frequently, it is better to represent the list directly as an array than to use a linked list.
a) true
b) false
43. To prevent a compile-time error, how should the code be changed?
a) Insert the following before line 1:
typedef ListNode* NodeType*;
b) Insert the following before line 1:
struct ListNode; typedef ListNode* NodeType*;
c) Replace line 4 with the following:
ListNode* next;
d) Do either b or c above.
e) Do any of a, b, or c above.
44. Given the code fragment
struct Node Type
{
int data;
Node Type* next;
};
NodeType* p;
NodeType* q;
p = new NodeType;
p->data = 12;
p->next = NULL;
q = new NodeType;
q->data = 5;
q->next = p;
which of the following expressions has the value 12?
a) q
b) q->data
c) q->next->data
d) q->next
e) none of the above
45. If a program accidentally corrupts the next member of a node in the middle of a linked list, how much of the original linked list is now inaccessible?
a) only the corrupted node is inaccessible
b) all nodes preceding the corrupted node are inaccessible
c) all nodes following the corrupted node are inaccessible
d) the entire linked list is inaccessible
46. True or False? If currPtr points to a node in a dynamic linked list, the operation currPtr++ advances to the next node in the list.
a) true
b) false
47. True or False? With a list ADT, insertions and deletions at the back of the list are faster with a linked list representation than with a direct array representation.
a) true
b) false
48. True or False? The next item in a linked list always can be found by accessing the next physical location in memory.
a) true
b) false
49. True or False? An array-based list automatically gives you an O(1) length operation, but in a linked implementation the
length operation can be either O(1) or O(N) depending on the design decision.
a) true
b) false
Explanation / Answer
41)Ans: False
42)Ans:True
43)Ans:d
44)Ans:c
45)Ans:c
46)Ans:False
47)Ans:True
48)Ans:False
49)Ans:False
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.