Exam 2 Ch 9

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

d.

4. A(n) ______ operation sequentially visits each node in a linked list. a. access b. delete c. get d. traverse

b.

1. A pointer variable contains the ______ of a memory cell. a. content b. address c. data type d. ADT

a.

10. The author suggests that when you first look at implementing an ADT List, that "list" is simply a fancy name for a. an array b. a bag c. a linked list d. a stack

B.

11. What operation does the ADT List have that an array does not? a. identify their items by number b. getLength() c. insertItem() d. isEmpty()

C.

12. When designing an array based implementation of an ADT List, which of the following are not specified as private? a. items b. itemCount c. clear() d. maxItems

D.

13. What is the return type of the list operator remove(int position)? a. void b. int c. itemType d. bool

A.

14. Which of the following operators uses two parameters? a. insert b. getLength c. remove d. clear

B.

15. Given the following diagram. What list operation does this depict? a. deleting an item in the list b. inserting an item in the list c. expanding the array to make it larger d. counting the number of items in the list

C.

16. To thoroughly test the insert method in an array-based implementation of ADT List, what other method do we need? a. clear b. remove c. getEntry d. the constructor

A.

17. Given the following diagram. What list operation does this depict? a. deleting an item in the list b. inserting an item in the list c. expanding the array to make it larger d. counting the number of items in the list

D.

18. In the author's array based implementation of the ADT List, to what one variable does the clear method assign a value? a. items[0] b. items[maxItems] c. position d. itemCount

B

19. In the list based implementation of the ADT List, which of the following is not a private variable in the classe? a. headPtr b. isEmpty c. itemCount d. getNodeAt

c.

2. The members of a node structure can be accessed with the ______ operator. a. [] b. & c. -> d. at

C.

20. Given the following diagram. What List action does this depict? a. insert a new node b. get the value stored at a node c. remove a node from the chain d. get the value stored at a node

D.

21. In the link based implementation of the ADT List, what method does the destructor call? a. remove b. insert c. isEmpty d. clear

A.

22. Given the following pseudocode logic: if ( the insertion position is 1 ) Add the new node to the beginning of the chain else Ignore the first node and add the new node to the rest of the chain What does this describe? a. recursive addition of a node to the list b. iterative addition of a node to the list c. addition of a node to the beginning of the list d. adding a node to the end of the list

B

23. In an array based implementation of the ADT List, what is a characteristic of the time required to access any particular element in the list? a. you have no way of knowing how long it will take b. the time required is a constant c. the time required is a function of the size of the list d. It is of order O(n2)

C.

24. When calling the insert or remove methods, what is an advantage for the link-based implementation of the ADT List? a. searching for that position is quicker b. takes less memory c. no need to shift data d. easier to understand

A.

25. When calling the insert or remove methods, what is an disadvantage for the link-based implementation of the ADT List? a. searching for that position is slower b. takes more memory c. must shift data d. harder to understand

B.

26. Adding or removing an entry anywhere within a link based list requires a change of at least how many pointers? a. one b. two c. three d. four

B.

27. A link based getEntry method requires how many steps to access the nth item in the list? a. n - 1 b. n c. n + 1 d. n2

C.

28. In either the link based or array based implementation of the ADT List, what is the single parameter for both the remove and getEntry methods? a. itemCount b. maxItems c. position d. ItemType

A.

29. What is the last step in the insertion process for a linked implementation of the ADT List? a. Connect the new node to the linked chain by changing pointers b. Create a new node and store the new data in it c. Determine the point of insertion d. The order of these steps really doesn't matter

d.

3. A pointer variable whose sole purpose is to locate the first node in a linked list is called ______. a. the list's top b. the node's link c. the list's link d. the list's head

C.

30. What is the first step in the deletion process for a linked implementation of the ADT List? a. Return the node to the system b. Disconnect the node from the linked chain by changing pointers c. Locate the node you want to delete d. The order of these steps really doesn't matter

a.

5. To remove a node N from a linear linked list, you will need to ______. a. set the pointer next in the node that precedes N to point to the node that follows N b. set the pointer next in the node that precedes N to point to N c. set the pointer next in the node that follows N to point to the node that precedes N d. set the pointer next in N to point to the node that follows N

d.

6. Which of the following statements deletes the node to which cur points? a. prev->next = cur; b. cur->next = prev; c. cur->next = cur->next; d. prev->next = cur->next;

c.

7. Which of the following statements deletes the first node of a linear linked list that has 10 nodes? a. head->next = cur->next; b. prev->next = cur->next; c. head = head->next; d. head = NULL;

a.

8. Which of the following statements inserts a new node, pointed to by newPtr, at the end of a linear linked list? a. newPtr->next = cur; prev->next = newPtr; b. newPtr->next = head; head = newPtr; c. newPtr->next = NULL; d. prev->next = cur; newPtr->next = cur;

d.

9. A ______ allows the deletion of a node from a linked list without the need to traverse the list to establish a trailing reference. a. head pointer b. dummy head node c. tail pointer d. precede pointer


संबंधित स्टडी सेट्स

Openstax Sociology Midterm Review Chapters 1-10

View Set

NR368 Ch. 57: Management of Patients with Burn Injury

View Set

The Individual Life Insurance Contract Quizzes

View Set

marketing 4th test true or false

View Set

Reproductive System Practice Questions

View Set

Physics Chapter 22, Physics Final

View Set

Ch 4: Human Digestion, Absorption and Transport

View Set