Machine Instruction: GATE CS Previous Year Questions

Machine Instruction · Computer Organization and Architecture

36 questions · asked in 19 of 27 years (2000–2026)

MCQ 27 · MSQ 1 · NAT 81-mark 22 · 2-mark 14

2000Questions per year2026

Questions 26–30 of 36

Q26GATE 20061 markMCQ−0.33 if wrong
Consider these two functions and two statements S1 and S2 about them.
int work1(int *a, int i, int j)         int work2(int *a, int i, int j)
{                                       {
   int x = a[i+2];                         int t1 = i+2;
   a[j] = x+1;                             int t2 = a[t1];
   return a[i+2] - 3;                      a[j] = t2+1;
}                                          return t2 - 3;
                                        }

S1 : The transformation from work 1 to work 2 is valid, i.e., for any program state and input arguments, work 2 will compute the same output and have the same effect on program state as work 1
S2 : All the transformations applied to work 1 to get work 2 will always improve the performance (i.e. reduce CPU time) of work 2 compared to work 1

Q27GATE 20061 markMCQ−0.33 if wrong
Consider a new instruction named branch-on-bit-set (mnemonic bbs). The instruction "bbs reg, pos, label" jumps to label if bit in position pos of register operand reg is one. A register is 32 bits wide and the bits are numbered 0 to 31, bit in position 0 being the least significant. Consider the following emulation of this instruction on a processor that does not have bbs implemented.

temp←\leftarrowreg & mask
Branch to label if temp is non-zero

The variable temp is a temporary register. For correct emulation the variable mask must be generated by

Q28GATE 20061 markMCQ−0.33 if wrong
A CPU has 24-bit instructions. A program starts at address 300 (in decimal). Which one of the following is a legal program counter (all values in decimal)?

Q29GATE 20041 markMCQ−0.33 if wrong
If we use internal data forwarding to speed up the performance of a CPU (R1, R2 and R3 are registers and M[100] is a memory reference), then the sequence of operations
R1 →\rightarrow M[100]
M[100] →\rightarrow R2
M[100] →\rightarrow R3
can be replaced by

Q30GATE 20041 markMCQ−0.33 if wrong
Consider the following program segment for a hypothetical CPU having three user registers R1, R2 and R3.
Instruction Operation Instruction Size (in words) MOV R1,5000 ;R1 ← Memory[5000] 2 MOV R2(R1) ;R2 ← Memory[(R1)] 1 ADD R2, R3 ;R2 ← R2 + R3 1 MOV 6000, R2 ; Memory[6000] ← R2 2 HALT ;Machine halts 1
Consider that the memory is byte addressable with size 32 bits, and the program has been loaded starting from memory location 1000 (decimal). If an interrupt occurs while the CPU has been halted after executing the HALT instruction, the return address (in decimal) saved in the stack will be

Keep practising

Topics in Computer Organization and Architecture

All CS topics ›