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 6–10 of 36

Q6GATE 2024 (Session 2)2 marksNAT
A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.
R-type Instruction Format: I-type Instruction Format: OPCODEUNUSEDDST RegisterSRC Register1SRC Register 2 OPCODEDST RegisterSRC Register# Immediate value/address
In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.
Let X be the number of bits used to encode the UNUSED field, Y be the number of bits used to encode the OPCODE field, and Z be the number of bits used to encode the immediate value/address field. The value of X + 2Y + Z is ______

Q7GATE 20232 marksMCQ−0.67 if wrong
Consider the given C-code and its corresponding assembly code, with a few operands U1-U4 being unknown. Some useful information as well as the semantics of each unique assembly instruction is annotated as inline comments in the code. The memory is byte-addressable.
//C-code                      ;assembly-code (; indicates comments)
                              ;r1-r5 are 32-bit integer registers
                              ;initialize r1=0, r2=10
                              ;initialize r3, r4 with base address of a, b

int a[10], b[10], i;          L01: jeq r1, r2, end   ;if(r1==r2) goto end
// int is 32-bit              L02: lw  r5, 0(r4)     ;r5 <- Memory[r4+0]
for (i=0; i<10;i++)           L03: shl r5, r5, U1    ;r5 <- r5 << U1
    a[i] = b[i] * 8;          L04: sw  r5, 0(r3)     ;Memory[r3+0] <- r5
                              L05: add r3, r3, U2    ;r3 <- r3+U2
                              L06: add r4, r4, U3
                              L07: add r1, r1, 1
                              L08: jmp U4            ;goto U4
                              L09: end

Which one of the following options is a CORRECT replacement for operands in the position (U1, U2, U3, U4) in the above assembly code?

Q8GATE 2021 (Session 1)2 marksNAT
Consider the following instruction sequence where registers R1,R2 and R3R_1,R_2 \text{ and }R_3 are general purpose and MEMORY[X]MEMORY[X] denotes the content at the memory location XX.

InstructionSemanticsInstruction Size (bytes)MOV R1,(5000)R1←MEMORY[5000]4MOV R2,(R3)R2←MEMORY[R3]4ADDR2,R1R2←R1+R22MOV (R3),R2MEMORY[R3]←R24INC R3R3←R3+12DEC R1R1←R1−12BNZ 1004Branch if not zero to the2given absolute addressHALTStop1\begin{array}{llc} \textbf{Instruction} & \textbf{Semantics} & \textbf{Instruction Size} \text{ (bytes)} \\ \hline \text{MOV } R1, (5000) & R1 \leftarrow \text{MEMORY}[5000] & 4 \\ \hline \text{MOV } R2, (R3) & R2 \leftarrow \text{MEMORY}[R3] & 4 \\ \hline \text{ADD} R2, R1 & R2 \leftarrow R1 + R2 & 2 \\ \hline \text{MOV } (R3), R2 & \text{MEMORY}[R3] \leftarrow R2 & 4 \\ \hline \text{INC } R3 & R3 \leftarrow R3+1 & 2 \\ \hline \text{DEC } R1 & R1 \leftarrow R1-1 & 2 \\ \hline \text{BNZ } 1004 & \text{Branch if not zero to the} & 2 \\ & \text{given absolute address} \\ \hline \text{HALT} & \text{Stop} & 1 \\ \hline \end{array}

Assume that the content of the memory location 5000 is 10, and the content of the register R3R_3 is 3000. The content of each of the memory locations from 3000 to 3020 is 50. The instruction sequence starts from the memory location 1000. All the numbers are in decimal format. Assume that the memory is byte addressable.
After the execution of the program, the content of memory location 3010 is ____________

Q9GATE 20201 markMCQ−0.33 if wrong
Consider the following data path diagram.
BUS MARMDRIRPC R0R1R7 TEMP2TEMP1ALU To Memory
Consider an instruction: R0←R1+R2R0\leftarrow R1+R2. The following steps are used to execute it over the given data path. Assume that PC is incremented appropriately. The subscripts r and w indicate read and write operations, respectively.

1.  R2r,TEMP1r,ALUadd,TEMP2w1. \; R2_r,TEMP1_r,ALU_{add},TEMP2_w
2.  R1r,TEMP1w2. \; R1_r,TEMP1_w
3.  PCr,MARw,MEMr3. \; PC_r,MAR_w,MEM_r
4.  TEMP2r,R0w4. \; TEMP2_r,R0_w
5.  MDRr,IRw5. \; MDR_r,IR_w

Which one of the following is the correct order of execution of the above steps?

Q10GATE 20202 marksNAT
A processor has 64 registers and uses 16-bit instruction format. It has two types of instructions: I-type and R-type. Each I-type instruction contains an opcode, a register name, and a 4-bit immediate value. Each R-type instruction contains an opcode and two register names. If there are 8 distinct I-type opcodes, then the maximum number of distinct R-type opcodes is _______.

Keep practising

Topics in Computer Organization and Architecture

All CS topics ›