GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 54

GATE CSE 2015 Set 2 Q54

Computer Organization & Architecture · Instructions & Addressing Modes · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q54 2 marks · MCQ
Report issue

Instructions & Addressing Modes

Question 54, GATE 2015: A byte-addressed machine has two-byte registers and an upward-growing stack. SP is 016E hexadecimal and PC is 5FA0 immediately before a two-word CALL that pushes PC and PSW. What is the resulting SP? A 016A; B 016C; C 0170; D 0172.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

CALL pushes the two-byte PC and two-byte PSW onto an upward-growing stack, adding 4 to SP. Thus hexadecimal 016E+4=0172, D. Instruction length affects the return-address value pushed, not the number of bytes added to this stack.

Each pushed register consumes two bytes. Two pushes therefore add four to the stack pointer: 0x016E+0x0004=0x0172. The two-word length of the CALL affects the saved return PC, not how many registers are pushed. Similarly, the current PC value is not an address increment to add to SP. A downward-growing stack would subtract four, but the question explicitly gives upward growth, ruling out 016A.

Original paper, page 47 · Answer key