Which of the following statement is TRUE? A) Stack pointer decremented by one when PUSH instruction executed. B) Stack pointer incremented by one when PUSH instruction executed. C) Stack pointer decremented by two when PUSH instruction executed. D) Stack pointer incremented by two when PUSH instruction executed.
Question
Which of the following statement is TRUE? A) Stack pointer decremented by one when PUSH instruction executed. B) Stack pointer incremented by one when PUSH instruction executed. C) Stack pointer decremented by two when PUSH instruction executed. D) Stack pointer incremented by two when PUSH instruction executed.
Solution
The correct statement is A) Stack pointer decremented by one when PUSH instruction executed.
Here's why:
In computer science, a stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop. The relation between the push and pop operations is such that the stack is a Last-In-First-Out (LIFO) data structure.
In a LIFO data structure, the last element added to the structure must be the first one to be removed. This is exactly the principle followed by stack data structure.
When a PUSH instruction is executed, the stack pointer is decremented to create space for the new item and then the item is inserted at the new top of stack. Hence, the statement "Stack pointer decremented by one when PUSH instruction executed" is true.
Similar Questions
Consider the following operations performed on a stack of size 5 : Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop();Pop(); Push (e) Which of the following statements is correct?
Which of the following is not an operation on a stack?
When PUSH operation is executed in register stack organization then stack pointer is ______*Equal the valuesCheck for PC-Incremented by 1Decremented by 1
Which of the following statements about pointers is true?
Which of the following code segment correctly represents to push an element 26 in to the stack, where the initial value of top is -1?a.top+; myStack[top] = 26;b.myStack[top] = 26; top+;c.myStack[top] = 26; top++;d.top++; myStack[top] = 26;
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.