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 16–20 of 36
A machine has a 32-bit architecture, with 1-word long instructions. It has 64 registers, each of which is 32 bits long. It needs to support 45 instructions, which have an immediate operand in addition to two register operands. Assuming that the immediate operand is an unsigned integer, the maximum value of the immediate operand is ____________.
Answer: 16383
Let us go through each part:
- For 45 instructions we need a 6-bit opcode
- For 2 registers out of 64 we need 6 + 6 = 12 bits
- The immediate field is 32 6 12 = 14 bits the max unsigned value is
Answer: 16383
- For 45 instructions we need a 6-bit opcode
- For 2 registers out of 64 we need 6 + 6 = 12 bits
- The immediate field is 32 6 12 = 14 bits the max unsigned value is
Answer: 16383
Consider the following sequence of micro-operations.
MBR PC
MAR X
PC Y
Memory MBR
Which one of the following is a possible operation performed by this sequence?
MBR PC
MAR X
PC Y
Memory MBR
Which one of the following is a possible operation performed by this sequence?
Answer: (D)
The present PC value is stored in memory. It goes through the MBR to address X, for example the stack. Then PC is loaded with a new address Y, which is the service routine. This is what happens when an interrupt is serviced.
Answer: Initiation of interrupt service
Answer: Initiation of interrupt service
Assume that EA = (X)+ is the effective address equal to the contents of location X, with X incremented by one word length after the effective address is calculated; EA = -(X) is the effective address equal to the contents of location X, with X decremented by one word length before the effective address is calculated; EA = (X)- is the effective address equal to the contents of location X, with X decremented by one word length after the effective address is calculated. The format of the instruction is (opcode, source, destination), which means (destination source op destination). Using X as a stack pointer, which of the following instructions can pop the top two elements from the stack, perform the addition operation and push the result back to the stack.
Answer: (A)
The format is ADD source, destination, and it means destination source + destination. Here X is the stack pointer and points to the top element. Take a word as 2 bytes and X = 1000 at the start, so the top is at 1000 and the next element is at 998. Popping uses (X)-, which reads at X and then decreases X, so here the stack grows toward higher addresses.
(A) ADD (X)-, (X): source address is 1000, then X becomes 998. The destination address is 998. So . Both top elements are popped and added, the sum is stored at 998, and X = 998 now points to it as the new top. This is the required operation.
(B) ADD (X), (X)-: both addresses are 1000, so . It adds the top to itself.
(C) ADD -(X), (X)+: X becomes 998 first, so both addresses are 998 and . It adds the second element to itself.
(D) ADD -(X), (X): X becomes 998 first, so again .
Answer: (A)
(A) ADD (X)-, (X): source address is 1000, then X becomes 998. The destination address is 998. So . Both top elements are popped and added, the sum is stored at 998, and X = 998 now points to it as the new top. This is the required operation.
(B) ADD (X), (X)-: both addresses are 1000, so . It adds the top to itself.
(C) ADD -(X), (X)+: X becomes 998 first, so both addresses are 998 and . It adds the second element to itself.
(D) ADD -(X), (X): X becomes 998 first, so again .
Answer: (A)
A processor that has the carry, overflow and sign flag bits as part of its program status word (PSW) performs addition of the following two 2's complement numbers 01001101 and 11101001. After the execution of this addition operation, the status of the carry, overflow and sign flags, respectively will be:
Answer: (B)
Add the two 8-bit numbers.
The 8-bit result is , with a carry out of the msb.
- Carry flag , since there is a carry out of the msb.
- Overflow flag . In 2's complement, overflow occurs only when both operands have sign bit 0 and the result has sign bit 1, or when both have sign bit 1 and the result has sign bit 0. Here the operands have different sign bits (0 and 1), so overflow cannot occur. (Check: , which fits in 8 bits.)
- Sign flag , since the msb of the result is 0.
Answer: (B)
The 8-bit result is , with a carry out of the msb.
- Carry flag , since there is a carry out of the msb.
- Overflow flag . In 2's complement, overflow occurs only when both operands have sign bit 0 and the result has sign bit 1, or when both have sign bit 1 and the result has sign bit 0. Here the operands have different sign bits (0 and 1), so overflow cannot occur. (Check: , which fits in 8 bits.)
- Sign flag , since the msb of the result is 0.
Answer: (B)
In an instruction execution pipeline, the earliest that the data TLB (Translation Lookaside Buffer) can be accessed is
Answer: (C)
The data TLB translates a virtual address into a physical address, so it needs the virtual address as its input.
The effective address is the address that results from applying the addressing mode (indexed, base plus offset and so on). It is still a virtual address, and the CPU forms it fully only when the effective address calculation is complete. The physical address comes only from the TLB or the page table.
So the TLB lookup cannot start before or during the effective address calculation (options A and B), because the virtual address is not ready. The earliest it can start is right after that calculation completes. Option (D) is later than necessary: in the usual design the TLB lookup happens before, or alongside, the data cache lookup, since the cache needs the physical address.
Answer: (C)
The effective address is the address that results from applying the addressing mode (indexed, base plus offset and so on). It is still a virtual address, and the CPU forms it fully only when the effective address calculation is complete. The physical address comes only from the TLB or the page table.
So the TLB lookup cannot start before or during the effective address calculation (options A and B), because the virtual address is not ready. The earliest it can start is right after that calculation completes. Option (D) is later than necessary: in the usual design the TLB lookup happens before, or alongside, the data cache lookup, since the cache needs the physical address.
Answer: (C)
Keep practising