csis

18. When adding an entry to an array-based implementation of the ADT List at the end of the list a. no shift is necessary b. all of the previous elements must be shifted toward the front of the array c. only one element is shifted toward the end of the array to make room d. only one element is shifted toward the beginning of the array to make room 19. When inserting a node between two adjacent nodes in a chain you must locate a. the first node and the node before the insertion position b. the first node and the node after the insertion position c. the last node and the node after the insertion position d. the node before the insertion position and the node after the insertion position

EXPERT ANSWER When adding an entry to an array-based implementation of the ADT List at the end of the list no shift is necessary all of the previous elements must be shifted toward the front of the array only one element is shifted toward the end of the array to make room only one element …

18. When adding an entry to an array-based implementation of the ADT List at the end of the list a. no shift is necessary b. all of the previous elements must be shifted toward the front of the array c. only one element is shifted toward the end of the array to make room d. only one element is shifted toward the beginning of the array to make room 19. When inserting a node between two adjacent nodes in a chain you must locate a. the first node and the node before the insertion position b. the first node and the node after the insertion position c. the last node and the node after the insertion position d. the node before the insertion position and the node after the insertion position Read More »

Assume array size is 50 in a circular array implementation of a Queue; Assume frontIndex is 49 and backIndex is 46; After dequeueing three, ie removing 3 elements, what will the values of backIndex and FrotnIndex be: a. FrontIndex: 49 BackIndex: 46 b. FrontIndex: 47 BackIndex: 46 c. FrontIndex: 49 BackIndex: 44 d. FrontIndex: 2 BackIndex: 46 Answer: 16. In an array-based implementation of a Queue, if waitingList is the name of the array, and the index to the last entry in the queue is called backIndex, which assignment statement updates backIndex to add an entry to the queue: a. backIndex = (backIndex + 2) % waitingList.length; b. backIndex = (backIndex + 1) % waitingList.length; c. backIndex = (backIndex – 1) % waitingList.length; d. backIndex = (backIndex – 2) % waitingList.length;

EXPERT ANSWER Assume array size is 50 in a circular array implementation of a Queue; Assume frontIndex is 49 and backIndex is 46; After dequeueing three, ie removing 3 elements, what will the values of backIndex and FrotnIndex be: a. FrontIndex: 49 BackIndex: 46 b. FrontIndex: 47 BackIndex: 46 c. FrontIndex: 49 BackIndex: 44 d. …

Assume array size is 50 in a circular array implementation of a Queue; Assume frontIndex is 49 and backIndex is 46; After dequeueing three, ie removing 3 elements, what will the values of backIndex and FrotnIndex be: a. FrontIndex: 49 BackIndex: 46 b. FrontIndex: 47 BackIndex: 46 c. FrontIndex: 49 BackIndex: 44 d. FrontIndex: 2 BackIndex: 46 Answer: 16. In an array-based implementation of a Queue, if waitingList is the name of the array, and the index to the last entry in the queue is called backIndex, which assignment statement updates backIndex to add an entry to the queue: a. backIndex = (backIndex + 2) % waitingList.length; b. backIndex = (backIndex + 1) % waitingList.length; c. backIndex = (backIndex – 1) % waitingList.length; d. backIndex = (backIndex – 2) % waitingList.length; Read More »

10. What is the entry returned by the peek method after the following stack operations. push(A), push(R), pop(), push(D), pop(), push(L), pop(), push(J), push(S), pop(), pop() a. A b. S c. L d. D Answer: 11. In an efficient array-based chain implementation of a Stack ADT, the entry peek returns may be found at a. the last location in the array b. the first location in the array c. the last occupied location in the array d. none of the above

EXPERT ANSWER What is the entry returned by the peek method after the following stack operations. push(A), push(R), pop(), push(D), pop(), push(L), pop(), push(J), push(S), pop(), pop() A S L D In an efficient array-based chain implementation of a Stack ADT, the entry peek returns may be found at the last location in the array …

10. What is the entry returned by the peek method after the following stack operations. push(A), push(R), pop(), push(D), pop(), push(L), pop(), push(J), push(S), pop(), pop() a. A b. S c. L d. D Answer: 11. In an efficient array-based chain implementation of a Stack ADT, the entry peek returns may be found at a. the last location in the array b. the first location in the array c. the last occupied location in the array d. none of the above Read More »

Activation records in recursion are stored in which data structure? a. Queue b. List c. Stack d. Tree Answer: 9. In a linked-chain implementation of a Stack ADT, the performance of pushing an entry onto the stack is a. O(2) b. O(n) c. O(n2) d. O(1)

EXPERT ANSWER Activation records in recursion are stored in which data structure? Queue List Stack Tree In a linked-chain implementation of a Stack ADT, the performance of pushing an entry onto the stack is O(2) O(n) O(n2) O(1)

What is the value returned from the following recursive method when it is called with the value 9? public int mystery (int n) { if (n < 1) return 0; else if (n % 2 == 0) return mystery(n-1); else return 1 + mystery(n-1); } a. 6 b. 5 c. 4 d. 0

EXPERT ANSWER What is the value returned from the following recursive method when it is called with the value 9? public int mystery (int n) { if (n < 1) return 0; else if (n % 2 == 0) return mystery(n-1); else return 1 + mystery(n-1); } 6 5 4 0