Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. T F A stack is a First In First Out data structure. 2. T F The stack pointer

ID: 3836390 • Letter: 1

Question

1. T    F A stack is a First In First Out data structure.

2. T    F The stack pointer keeps track of the first element to be popped off the stack.

3. T    F The stack protocol is a set of rules which define how the stack should be accessed.

4. T    F   In a stack implemented in memory with a stack pointer, the data entries move after each operation performed on the stack.

5. Assume that the stack grows towards zero, the stack pointer is R6 and contains x4000. What are the contents of R6 after the following operations:

push 5
push 4
push 3
push 2
pop
pop

   a. x4002
   b. x3FFF
   c. x3FFE
   d. x 4001

6. After the following operations, the contents of the stack, from the top of the stack to the bottom, are?

            push 5

            push 3

            push 9

            pop

            push 8

Explanation / Answer

1. A stack is a First In First Out data structure. : False (Its lasts in first out)

2. The stack pointer keeps track of the first element to be popped off the stack. [True, the top of the stack]

3 The stack protocol is a set of rules which define how the stack should be accessed. : true

4. In a stack implemented in memory with a stack pointer, the data entries move after each operation performed on the stack. : true

5. Assume that the stack grows towards zero, the stack pointer is R6 and contains x4000. What are the contents of R6 after the following operations:

push 5
push 4
push 3
push 2
pop
pop

   a. x4002
   b. x3FFF
   c. x3FFE : AFTER 2 PUSH AND 2 POP results in 2 push, decrement by 1
   d. x 4001

6. After the following operations, the contents of the stack, from the top of the stack to the bottom, are?

            push 5

            push 3

            push 9

            pop

            push 8


8 , 5, 3

8 will be at Top, 9 will be Popped ..So result is 8 , 5, 3