1. A stack is a ____________________ data structure
2. A stack is a static (not a dynamic) data structure
3. A stack can ______________________________
4. A stack can be programmed using a __________, for instance, one that points to the top of the stack.
5. With a stack, it is the _______ that was put on to the stack that can be retrieved.
6. Another word for retreiving an item from the top of the stack is to _____ an item.
7. It is possible to think of a stack as a _______________ where the first item that was added is at the bottom and the latest item at the top.
8. Adding an item to the top of the stack is referred to as:
9. A stack can be used to control the calling of subroutines in a program.Read the following excerpt and fill in the blanks.
10. A stack can be easily implemented either through an array or a linked list
11. Calculators employing ____________________ use a stack structure to hold values
12. The following excerpt explains an example that utilises ___________. This is a very important application of stacks. Fill in the blanks.
13. Follow the logic in the code below and predict the final output when the stack is printed.
14. In Pseudocode, if you perform a check to see if the 'top' pointer is equal to the maximum size, then this would suggest that __________________________
15. The following image is illustrating a depth first search on a graph. What happens next?
16. This shows an OOP python implementation of a stack. What is the output on execution of this code?
#A stack lends itself to the creation of a new class
#Here we create a stack class, where stack operations are methods
self.items = 
def isEmpty(self): #if the stack is empty then return True
return self.items == 
def push(self, item):
self.items.append(item) #appending items
return self.items.pop() #popping an item off the stack
return self.items[len(self.items)-1] #peek at the top most item (it remains in the stack)
def size(self): #returns the size of the stack
17. Stacks are an important way of supporting nested or ________ function calls
18. In the following example, that uses a class implementation of a stack, what will the output be if mysteryfunction is called with "marvin"?
19. In the following very simplistic code implementation (python) of the towers of Hanoi, what is happening on line 11?
def hanoi(n, P1, P2, P3):
""" Move n discs from pole P1 to pole P3. """
if n == 0:
# No more discs to move in this step
count += 1
# WHAT IS HAPPENING HERE?
hanoi(n-1, P1, P3, P2)
# move disc from P1 to P3
print(A, B, C)
# move n-1 discs from P2 to P3
hanoi(n-1, P2, P1, P3)
# Initialize the poles: all n discs are on pole A.
n = 3
A = list(range(n,0,-1))
B, C = , 
print(A, B, C)
count = 0
hanoi(n, A, B, C)
move n-1 discs from P3 to P1
move 1 disc from P1 to P3
move n discs from P2 to P1
move n-1 discs from P1 to P2
20. This question requires some understanding of RPN |(reverse polish notation). Read the excerpt and answer question below.