Q29.Marks: +2.0UGC NET Paper 2: Computer Science 18th June 2024 Shift 1 (Cancelled)
The instructions
ADD R1, A, B
ADD R2, C, D
MUL X, R1, R2
evaluates the X = (A + B)*(C + D) in which of the following ?
1.3 - Address instructions✓ Correct
2.2 - Address instructions
3.1 - Address instructions
4.RISC instructions
Solution
The correct answer is 3 - Address instructions.
Key Points
Three-address instructions are a type of computer architecture instruction where each instruction specifies three addresses (or operands). In the given example, the instructions ADD R1, A, B, ADD R2, C, D, and MUL X, R1, R2 use three operands each.
The instruction ADD R1, A, B adds the values of A and B and stores the result in R1.
The instruction ADD R2, C, D adds the values of C and D and stores the result in R2.
The instruction MUL X, R1, R2 multiplies the values of R1 and R2 and stores the result in X.
These instructions together evaluate the expression X = (A + B) * (C + D).
Additional Information
2 - Address instructions: In this type of instruction, two addresses (or operands) are specified. Typically, one of the addresses serves as both an input and an output. For example, ADD A, B would add the value of B to A and store the result in A.
1 - Address instructions: Here, only one address is specified, usually involving an accumulator. For example, ADD A would add the value of A to the accumulator.
RISC instructions: Reduced Instruction Set Computing (RISC) instructions typically use a load/store architecture where operations are performed between registers, and memory access is done through separate load and store instructions. While the given instructions could be part of a RISC architecture, the term "three-address instructions" more specifically describes the addressing mode used.