Computer Architecture MCQs set 2 for PU CET Lahore (Engineering & CS) computer science — 20 solved questions.
Q1. What is the primary function of the Instruction Register (IR) in the CPU?
Answer: To store the current instruction being executed
Explanation: IR holds the current instruction, decoding it for execution. It is a crucial register in the CPU's control unit.
Q2. Which of the following cache mapping techniques uses a tag to identify the block?
Answer: All of the above
Explanation: All three mapping techniques use tags to identify blocks. Direct mapping uses a fixed location, while associative and set-associative use tags for flexibility.
Q3. What is the hit ratio if a cache access takes 1 cycle, miss penalty is 5 cycles, and average memory access time is 2 cycles?
Answer: 0.75
Explanation: Using the formula: Average Access Time = Hit Ratio * Cache Access Time + (1 - Hit Ratio) * (Cache Access Time + Miss Penalty), we get 2 = Hit Ratio * 1 + (1 - Hit Ratio) * (1 + 5). Solving for Hit Ratio gives 0.75.
Q4. In a 2-level memory hierarchy, the access time of the cache is 10 ns and that of the main memory is 100 ns. If the hit ratio is 0.8, what is the average access time?
Answer: 28 ns
Explanation: Average Access Time = Hit Ratio * Cache Access Time + (1 - Hit Ratio) * Main Memory Access Time = 0.8 * 10 + 0.2 * 100 = 8 + 20 = 28 ns.
Q5. Which of the following is NOT a type of instruction-level parallelism?
Answer: Multithreading
Explanation: Multithreading is a technique to improve utilization by switching between threads. It is not a type of instruction-level parallelism, which involves executing multiple instructions simultaneously.
Q6. What is the main advantage of using a Harvard architecture over a von Neumann architecture?
Answer: Faster execution due to separate instruction and data buses
Explanation: Harvard architecture has separate buses for instructions and data, allowing for simultaneous access and improving overall system performance.
Q7. In a pipelined processor, what is the primary function of the 'IF' stage?
Answer: Instruction Fetch
Explanation: The 'IF' stage is responsible for fetching the next instruction from memory, which is then processed in subsequent stages.
Q8. What is the purpose of the 'TLB' in a virtual memory system?
Answer: To cache translation of virtual to physical addresses
Explanation: The Translation Lookaside Buffer (TLB) caches the translation of virtual to physical addresses, speeding up memory access.
Q9. What is the main benefit of out-of-order execution in a processor?
Answer: Improved instruction-level parallelism
Explanation: Out-of-order execution allows the processor to execute instructions as soon as their operands are available, improving overall instruction-level parallelism.
Q10. Which of the following cache replacement policies is based on the least recently used block?
Answer: LRU
Explanation: LRU (Least Recently Used) is a cache replacement policy that replaces the block that has not been accessed for the longest time.
Q11. What is the primary function of the 'ID' stage in a pipelined processor?
Answer: Instruction Decode
Explanation: The 'ID' stage is responsible for decoding the instruction, determining the operation to be performed, and fetching operands.
Q12. In a virtual memory system, what is the purpose of the 'page table'?
Answer: To store the mapping of virtual to physical addresses
Explanation: The page table stores the mapping of virtual pages to physical page frames, enabling the translation of virtual to physical addresses.
Q13. What is the main advantage of using a multi-core processor?
Answer: Better multithreading support
Explanation: Multi-core processors provide multiple processing cores, allowing for better support of multithreaded applications and improved overall system throughput.
Q14. Which of the following is a characteristic of a CISC (Complex Instruction Set Computer) architecture?
Answer: Microcode-based instruction execution
Explanation: CISC architectures often use microcode to implement complex instructions, allowing for a wide range of operations to be performed in a single instruction.
Q15. What is the purpose of the 'branch predictor' in a processor?
Answer: To predict the outcome of a branch instruction
Explanation: The branch predictor predicts the outcome of a branch instruction (taken or not taken), allowing the processor to speculatively fetch instructions and improve overall performance.
Q16. In a pipelined processor, what is the effect of a 'stall' or 'bubble'?
Answer: It reduces the instruction-level parallelism
Explanation: A stall or bubble in a pipelined processor introduces a delay, reducing the instruction-level parallelism and overall system performance.
Q17. What is the primary function of the 'MEM' stage in a pipelined processor?
Answer: Memory Access
Explanation: The 'MEM' stage is responsible for accessing memory, either to load or store data, as required by the instruction.
Q18. Which of the following is a type of parallelism that involves executing multiple threads or processes simultaneously?
Answer: Thread-level parallelism
Explanation: Thread-level parallelism involves executing multiple threads or processes simultaneously, improving overall system utilization and throughput.
Q19. What is the main benefit of using a 'write-through' cache policy?
Answer: Simplified cache coherence
Explanation: Write-through cache policy ensures that data is written to both the cache and main memory, simplifying cache coherence and reducing the risk of data inconsistency.
Q20. Which bus is responsible for transferring data between the CPU and memory?
Answer: Data Bus
Explanation: The Data Bus transfers data between the CPU and memory or I/O devices, facilitating data exchange.