Unit 2 - Practice Quiz

CSE211 59 Questions
0 Correct 0 Wrong 59 Left
0/59

1 What is the primary function of general-purpose registers in a CPU?

General Register Organization Easy
A. To store temporary data and results during program execution
B. To store the operating system kernel
C. To permanently store user files
D. To control the speed of the system clock

2 Which special-purpose register holds the memory address of the next instruction to be fetched?

General Register Organization Easy
A. Memory Address Register (MAR)
B. Accumulator (AC)
C. Instruction Register (IR)
D. Program Counter (PC)

3 In a stack-based architecture, which operation is used to add an item to the top of the stack?

Stack Organization Easy
A. PUSH
B. POP
C. ADD
D. PEEK

4 The Stack Pointer (SP) register is used to...

Stack Organization Easy
A. Store the result of the last arithmetic operation
B. Hold the address of the top element of the stack
C. Count the number of instructions executed
D. Store the base address of the program

5 In which addressing mode is the operand's value present directly within the instruction itself?

Addressing Modes Easy
A. Register Mode
B. Immediate Mode
C. Indirect Mode
D. Direct Mode

6 Consider the instruction LOAD R1, 1000. If this instruction loads the value from memory location 1000 into register R1, which addressing mode is being used for the source operand?

Addressing Modes Easy
A. Register
B. Immediate
C. Direct
D. Indirect

7 In 'Register Indirect' addressing mode, the instruction specifies a register that contains the...

Addressing Modes Easy
A. actual data operand
B. memory address of the operand
C. size of the operand
D. opcode for the next instruction

8 Which of the following is a defining characteristic of a RISC (Reduced Instruction Set Computer) architecture?

Reduced instruction set computer Easy
A. A large number of complex, multi-step instructions
B. A small set of simple, fixed-length instructions
C. Variable-length instruction formats for code compactness
D. Most instructions can directly access main memory for operands

9 In a typical RISC architecture, which are the only instructions that access main memory?

Reduced instruction set computer Easy
A. All arithmetic instructions
B. Only LOAD and STORE instructions
C. All logical instructions
D. All types of instructions

10 A key feature of a CISC (Complex Instruction Set Computer) architecture is...

Complex instruction set computer Easy
A. A focus on only the most basic instructions
B. Instructions that can perform complex, multi-step operations
C. Single-cycle execution for all instructions
D. A large number of general-purpose registers as a strict requirement

11 An instruction that reads two operands from memory, multiplies them, and writes the result back to memory is typical of which type of architecture?

Complex instruction set computer Easy
A. RISC
B. Vector
C. CISC
D. Stack-based

12 The part of a machine instruction that specifies the operation to be performed, such as ADD, SUB, or LOAD, is known as the...?

instruction formats Easy
A. Address field
B. Opcode
C. Operand
D. Mode field

13 A 'zero-address' instruction format implies that operations are performed on operands located where?

instruction formats Easy
A. On the top of a stack
B. In general-purpose registers
C. In main memory
D. Directly in the instruction

14 Which I/O data transfer scheme requires the CPU to repeatedly check the status of an I/O device until it is ready?

Data Transfer Schemes Easy
A. Channel I/O
B. Interrupt-driven I/O
C. Direct Memory Access (DMA)
D. Programmed I/O

15 What is the primary advantage of using Direct Memory Access (DMA) for data transfer?

Data Transfer Schemes Easy
A. It frees up the CPU from handling the data transfer
B. It simplifies the CPU's design
C. It is the cheapest method to implement
D. It makes assembly programming easier

16 Instructions like JUMP, BRANCH, and CALL are categorized as what type of instructions?

Program Control and Interrupts Easy
A. Program Control Instructions
B. Logical Instructions
C. Data Transfer Instructions
D. Arithmetic Instructions

17 What is the fundamental purpose of an interrupt in a computer system?

Program Control and Interrupts Easy
A. To halt the system permanently in case of a fatal error
B. To signal the CPU about an event that needs immediate attention
C. To speed up arithmetic calculations by using special hardware
D. To clear the contents of all registers and memory

18 When an interrupt occurs, what is the first thing the processor typically does?

Program Control and Interrupts Easy
A. It deletes the interrupting program
B. It saves its current state (e.g., PC and registers)
C. It shuts down the system
D. It finishes the current program completely

19 The collection of status bits in the Processor Status Word (PSW), such as Zero (Z), Carry (C), and Negative (N), are commonly referred to as...?

Processor status word Easy
A. Address bits
B. Instruction bits
C. Condition codes or flags
D. Control bits

20 What does it signify when the Zero flag (Z) in the Processor Status Word is set to 1?

Processor status word Easy
A. An overflow occurred during the last operation
B. The result of the last operation was a negative number
C. The result of the last operation was an odd number
D. The result of the last operation was zero

21 A CPU's control unit uses a 14-bit control word to define a micro-operation. The control word is divided into three fields: SELA (selects register for A bus), SELB (selects register for B bus), and OPR (selects ALU operation). If the ALU can perform 64 distinct operations, how many general-purpose registers are in the register file, assuming SELA and SELB can each access any register?

General Register Organization Medium
A. 32 registers
B. 64 registers
C. 8 registers
D. 16 registers

22 For a stack-based CPU with zero-address instructions, which sequence of operations correctly evaluates the arithmetic expression X = (A + B) * (C / D)?

Stack Organization Medium
A. PUSH A, B, ADD, PUSH C, D, DIV, MUL, X, POP
B. POP X, PUSH A, PUSH B, ADD, PUSH C, PUSH D, DIV, MUL
C. PUSH A, PUSH B, ADD, PUSH C, PUSH D, DIV, MUL, POP X
D. PUSH A, PUSH B, PUSH C, PUSH D, ADD, DIV, MUL, POP X

23 A processor executes the instruction LOAD R1, 200(R2). The content of register R2 is 0x1000. The memory location at address 0x1000 contains 0x1200. The memory location at address 0x1200 contains 0xABCD. The memory location at address 0x0200 contains 0xFFFF. What value is loaded into register R1?

Addressing Modes Medium
A. 0x1000
B. 0xABCD
C. 0xFFFF
D. 0x1200

24 Which of the following is the most significant reason why a RISC architecture is generally better suited for instruction pipelining than a CISC architecture?

Reduced instruction set computer Medium
A. RISC processors use a microprogrammed control unit.
B. RISC instructions are of fixed length and have simpler formats.
C. RISC code density is higher than CISC.
D. RISC has more addressing modes than CISC.

25 A key advantage of CISC architecture that influenced its design is its ability to:

Complex instruction set computer Medium
A. rely solely on a hardwired control unit for faster execution.
B. simplify compiler design by providing instructions that map closely to high-level language constructs.
C. execute every instruction in a single clock cycle.
D. implement a load/store architecture for efficient memory access.

26 A processor has a 32-bit instruction format. The opcode field is 6 bits. If the instruction must support two register operands and one 16-bit immediate operand, what is the maximum number of registers the processor's architecture can support?

instruction formats Medium
A. 64 registers
B. 16 registers
C. 128 registers
D. 32 registers

27 When transferring a large block of data from a disk to main memory, Direct Memory Access (DMA) is preferred over Programmed I/O because:

Data Transfer Schemes Medium
A. DMA transfers data one word at a time, with the CPU managing each word.
B. DMA allows the I/O module to manage the transfer directly with memory, freeing the CPU to perform other tasks.
C. DMA is a software-only protocol and does not require a dedicated controller.
D. DMA requires the CPU to check the I/O device status continuously.

28 Upon receiving and accepting a hardware interrupt, after the current instruction is completed, what is a critical action the processor's hardware performs automatically before fetching the first instruction of the Interrupt Service Routine (ISR)?

Program Control and Interrupts Medium
A. It sends an acknowledgement signal back to the interrupting device.
B. It saves the contents of all general-purpose registers to memory.
C. It pushes the current Program Counter (PC) and Processor Status Word (PSW) onto the stack.
D. It immediately jumps to address 0x0000 of the interrupt vector table.

29 An 8-bit processor performs the addition of two 2's complement numbers: 11001000 () and 10101000 (). The result is (1)01110000. What will be the state of the Carry (C) and Overflow (V) flags?

Processor status word Medium
A. C=0, V=1
B. C=1, V=0
C. C=1, V=1
D. C=0, V=0

30 In a CPU with a general register organization, which of the following scenarios would lead to the longest instruction length, assuming all other factors are constant?

General Register Organization Medium
A. An instruction performing an operation between a register and a memory location, storing the result in the register.
B. An instruction performing an operation between two registers and storing the result in a third register.
C. An instruction transferring data from one memory location to another memory location.
D. An instruction performing a logical shift on a register.

31 Consider a stack that grows downwards (towards lower addresses) and a stack pointer (SP) that points to the top element. If SP contains 0x2000 and a 32-bit (4-byte) value is pushed onto the stack, what will be the new value of SP?

Stack Organization Medium
A. 0x1FFC
B. 0x2004
C. 0x2000
D. 0x1FFF

32 A program needs to access a look-up table stored at a fixed base address in memory. To access the Nth entry in the table, which addressing mode is the most suitable and efficient?

Addressing Modes Medium
A. Indexed Addressing
B. Direct Addressing
C. Immediate Addressing
D. PC-Relative Addressing

33 A RISC processor's instruction set is designed with a 'load/store' architecture. What is the primary implication of this design choice?

Reduced instruction set computer Medium
A. Only LOAD and STORE instructions can access memory; all other operations (like ADD, SUB) must operate on registers.
B. The processor can perform arithmetic operations directly on data in memory.
C. The instruction format must include at least two memory address fields.
D. All instructions must access memory at least once.

34 A computer uses an expanding opcode scheme. It has 15 three-address instructions and 12 two-address instructions. If the instruction length is 16 bits and the memory address size is 6 bits, how many one-address instructions can be formulated?

instruction formats Medium
A. 128
B. 8192
C. 2048
D. 15360

35 In a system using vectored interrupts, what determines the starting address of the interrupt service routine (ISR)?

Program Control and Interrupts Medium
A. The CPU always jumps to a single, fixed address for all interrupts.
B. The interrupting device provides a unique identifier or address to the CPU.
C. The CPU polls all devices to determine which one generated the interrupt.
D. The operating system's kernel dynamically allocates an address.

36 What is the primary function of the 'strobe' signal in a strobe-controlled asynchronous data transfer scheme?

Data Transfer Schemes Medium
A. To select the I/O device for the transfer.
B. To act as a system clock for synchronizing all devices.
C. To indicate the direction of data flow (read or write).
D. To inform the destination unit that valid data is on the data bus or to inform the source unit that data has been accepted.

37 Which of the following instructions is most likely to be found in a CISC processor's instruction set but not in a RISC processor's?

Complex instruction set computer Medium
A. JMP label
B. LOAD R1, [R2]
C. ADD R1, R2, R3
D. MULF [mem1], [mem2], [mem3]

38 Which addressing mode is essential for writing position-independent code (code that can run correctly regardless of where it is loaded in memory)?

Addressing Modes Medium
A. Direct Addressing
B. Indirect Addressing
C. Absolute Addressing
D. PC-Relative Addressing

39 How does a CALL instruction fundamentally differ from a JUMP instruction?

Program Control and Interrupts Medium
A. A CALL instruction can only jump to addresses within the current code segment.
B. A CALL instruction modifies the Processor Status Word, while a JUMP does not.
C. A CALL instruction saves the return address on the stack before branching, while a JUMP instruction does not.
D. A JUMP instruction is always conditional, while a CALL is always unconditional.

40 In an 8-bit system, if the value 10000000 (the smallest negative number, -128) is negated using the 2's complement method, what will be the state of the Overflow (V) flag?

Processor status word Medium
A. V = 1, because the result cannot be correctly represented in 8 bits.
B. V = 0, because negation never causes an overflow.
C. The operation is not possible.
D. V = 0, because the sign bit does not change.

41 An 8-bit processor using two's complement arithmetic performs the operation 01110101 + 01011100. What will be the final state of the Carry (C), Zero (Z), Sign (S), and Overflow (V) flags?

Processor status word Hard
A. C=0, Z=0, S=1, V=0
B. C=0, Z=0, S=0, V=1
C. C=1, Z=0, S=0, V=1
D. C=1, Z=0, S=1, V=0

42 A 32-bit processor has an instruction JMP [R1 + R2*4 + 0x100]. If R1 contains 0x00001000 and R2 contains 0x00000020, and the memory is byte-addressable, what is the effective address calculated by this instruction and what is this addressing mode called?

Addressing Modes Hard
A. 0x00001180, Base-Scaled Indexed
B. 0x00011100, Indirect Register with Scaling
C. 0x00001084, Indexed Absolute
D. 0x00001180, Base-Indexed with Displacement

43 A machine has 12-bit addresses, 4-bit opcodes, and 32 registers. A specific instruction format provides for one register operand and one memory operand. For the memory operand, only direct addressing is allowed. What is the maximum number of instructions that can be formulated if this is the only instruction format for the machine?

Instruction Formats Hard
A. 16
B. Impossible to determine with the given information
C. 4096
D. 8

44 A CPU has a general register organization with 32 registers, an ALU with 16 operations, and two multiplexers (A and B) feeding the ALU inputs. A control word is used to manage this datapath. The control word must specify: two source registers (for MUX A and MUX B), a destination register, and the ALU operation. What is the minimum number of bits required for the control word, and what is the effect of using a 3-port register file versus a 2-port register file?

General Register Organization Hard
A. 20 bits; a 2-port file would require an additional clock cycle.
B. 14 bits; a 3-port file is not necessary for this operation.
C. 19 bits; a 3-port file allows simultaneous read and write in one cycle.
D. 19 bits; a 3-port file allows two reads and one write simultaneously.

45 Consider a stack machine evaluating the expression (A + B * C) / (D - E). The correct Reverse Polish Notation (RPN) is A B C * + D E - /. If PUSH, POP, ADD, MUL, SUB, DIV operations each take 1 cycle, and memory access (for A, B, C, D, E) takes 3 cycles, what is the total execution time, and what is the maximum depth the stack reaches?

Stack Organization Hard
A. 24 cycles, max depth 2
B. 29 cycles, max depth 3
C. 29 cycles, max depth 2
D. 24 cycles, max depth 3

46 A CISC processor has an instruction MUL M, R1 which multiplies the content of memory location M with register R1 and stores the result in R1. This instruction takes 10 clock cycles. A RISC processor implements this with LOAD R2, M, MUL R1, R1, R2, and STORE R1, M. Given that LOAD/STORE take 5 cycles each (due to pipeline stalls for memory access) and MUL takes 1 cycle on the RISC machine, what is the clock rate ratio (RISC_freq / CISC_freq) required for the RISC machine to have the same execution time as the CISC machine for this specific operation?

RISC vs. CISC Hard
A. 1.1
B. 1.2
C. 1.0
D. 0.91

47 A system uses a daisy-chain interrupt scheme with 3 devices (D1, D2, D3), where D1 has the highest priority. An interrupt occurs from D2. While the ISR for D2 is executing, interrupts from D1 and D3 occur simultaneously. Assume interrupts are disabled upon entering an ISR and re-enabled just before the IRET (Interrupt Return) instruction. What is the sequence of ISR execution?

Program Control and Interrupts Hard
A. ISR1 -> ISR2 -> ISR3
B. ISR2 is completed, then ISR1, then ISR3
C. ISR2 -> ISR1 -> ISR3
D. ISR2 -> ISR3 -> ISR1

48 A disk drive transfers data at 2 MB/s. The data is transferred to memory using DMA in burst mode. The CPU and DMA controller share a bus that runs at 10 MHz. Each bus cycle takes 1 clock tick. The CPU is paused during the DMA transfer. If the DMA transfer is for a block of 4096 bytes, what percentage of time is the CPU blocked during the transfer of this one block?

Data Transfer Schemes Hard
A. 20.48%
B. 100% of the DMA transfer time, which is 0.2048% of a 1-second interval
C. 0.041%
D. 0.2048%

49 A key feature of CISC architectures that complicates pipelining is the use of microcode. How does a microcoded instruction that requires fetching data from memory mid-execution (e.g., ADD [mem1], [mem2]) specifically cause a structural hazard and a data hazard in a classic 5-stage pipeline (IF, ID, EX, MEM, WB)?

Complex instruction set computer Hard
A. It only causes a control hazard because the microcode PC needs to branch.
B. It causes a structural hazard by needing the instruction decoder (ID) again and a data hazard because the registers are locked.
C. It requires the instruction fetch (IF) unit to stall, creating a structural hazard, and the data dependency is resolved by the ALU.
D. It causes a structural hazard by needing the MEM stage twice and a data hazard if a subsequent instruction needs the result before it's written.

50 A 16-bit CPU uses PC-relative addressing for a branch instruction BRA N. The instruction is 2 words long (32 bits), where the second word is a 16-bit signed offset N. The PC is incremented after fetching each word. If a BRA instruction is located at address 0x1000, what value of N is required to branch to address 0x0F80?

Addressing Modes Hard
A. 0xFF7E
B. 0x0F80
C. 0xFF7C
D. 0xFF80

51 In a system with a non-vectored interrupt mechanism, the interrupt service routine (ISR) address is fixed at 0x0000FFFE. To handle multiple devices, the ISR must poll each device to identify the source. If there are 8 devices, and polling each device's status register takes 5 cycles, and on average the 5th device is the one that triggered the interrupt, what is the average interrupt latency added by the polling mechanism, excluding the initial hardware latency?

Program Control and Interrupts Hard
A. 25 cycles
B. 40 cycles
C. 5 cycles
D. 22.5 cycles

52 A 16-bit CPU uses an expanding opcode scheme. A zero-address instruction format requires only an opcode. A one-address instruction format requires an opcode and an 8-bit address. If there are 10 zero-address instructions, what is the maximum number of one-address instructions possible?

Instruction Formats Hard
A. (2^16 - 10) / 2^8
B. 65536 - 10
C. 65526
D. 255 * (256 - 10)

53 In a 5-stage RISC pipeline (IF, ID, EX, MEM, WB), a data hazard occurs that cannot be resolved by forwarding. For example: LOAD R1, 0(R2) followed immediately by ADD R3, R1, R0. Why exactly can't standard forwarding completely resolve this, and what is the required action?

Reduced instruction set computer Hard
A. Forwarding can resolve it; the ALU output is sent directly to the next instruction's ALU input.
B. The LOAD instruction must complete the WB stage before the ADD can start its IF stage. The pipeline must stall for three cycles.
C. This causes a structural hazard, not a data hazard, because both instructions need the register file at the same time.
D. The data from memory is not available until the end of the MEM stage, but the ADD needs it at the beginning of its EX stage. The pipeline must stall for one cycle.

54 A CPU with a general register organization uses a 20-bit control word for its datapath operations. A new requirement is to double the number of registers from 16 to 32 and to increase the number of ALU functions from 16 to 32. The control word specifies two source registers, one destination register, and an ALU operation. What is the new minimum size of the control word?

General Register Organization Hard
A. 20 bits, using a more complex encoding scheme
B. 24 bits
C. 23 bits
D. 25 bits

55 In a system using interrupt-driven I/O, the overhead for the CPU to handle one interrupt (context switch, ISR execution, context restore) is 500 clock cycles. The data transfer rate of the I/O device is 100 KB/s. The CPU clock speed is 100 MHz. If the I/O device transfers data one byte at a time (i.e., one interrupt per byte), what percentage of the CPU's time is spent handling I/O?

Data Transfer Schemes Hard
A. 5%
B. 50%
C. 25%
D. 10%

56 A CPU has a 16-bit Program Counter (PC) and an 8-bit Processor Status Word (PSW). A CALL instruction is executed from main memory location 0x2000. This instruction is 3 bytes long and pushes the return address onto a memory stack, which grows towards lower addresses. The Stack Pointer (SP) initially contains 0xA000. What are the final values of the PC and SP after the CALL instruction is executed, assuming the target address of the call is 0x4000?

Stack Organization Hard
A. PC = 0x4003, SP = 0x9FFE
B. PC = 0x2003, SP = 0x9FFD
C. PC = 0x4000, SP = 0x9FFE
D. PC = 0x4000, SP = 0x9FFD

57 A 16-bit processor executes a CMP R1, R2 instruction, which performs R1 - R2 and sets the flags. R1 contains 0x8000 and R2 contains 0x0001. Treating the operands as two's complement integers, what will be the state of the Sign (S), Zero (Z), and Overflow (V) flags after the operation?

Processor status word Hard
A. S=0, Z=0, V=0
B. S=1, Z=0, V=1
C. S=0, Z=0, V=1
D. S=1, Z=0, V=0

58 Consider a system with a 2-address instruction ADD P, Q which means [P] <- [P] + [Q]. The instruction format uses a 4-bit opcode. The CPU has a 16-bit address bus and 8 general-purpose registers. If the designers want to support both a register-direct mode and a memory-direct mode for each operand (P and Q), how many bits must the instruction be at minimum to accommodate all addressing mode combinations?

Addressing Modes Hard
A. 26 bits
B. 39 bits
C. 40 bits
D. 35 bits

59 A CISC machine includes a memory-to-memory MOVE instruction with an auto-increment addressing mode for both source and destination: MOVE (R1)+, (R2)+. R1 holds 0x1000, R2 holds 0x2000, and the machine is 32-bit (4 bytes per word) and byte-addressable. What are the final values in R1 and R2 after this instruction executes once?

Complex instruction set computer Hard
A. R1 = 0x1001, R2 = 0x2001
B. R1 = 0x1004, R2 = 0x2000
C. R1 = 0x1000, R2 = 0x2000
D. R1 = 0x1004, R2 = 0x2004