Classes and Stacks Flashcards
1
Q
Explain how data is “popped” from a stack
A
Data is read from the stack at the stack pointer, then the stack pointer is lowered by one.
2
Q
Explain how data is “peeked” in a stack?
A
The data at the stack pointer is read.
3
Q
How is data “pushed” to the stack?
A
The stack pointer is increased by one, then the data is written to the stack at the stack pointer.
4
Q
How would you explain the stack?
A
The stack is a Last in First out (LIFO) process where the most recent data added is the next data to be overwritten in the stack