Branch Prediction & Instruction Format Interview Questions (Part 4)
The longest section in this series, covering two of the densest interview topics: branch prediction — from static prediction through BTB, BHT, and TAGE predictors — and instruction formats and addressing modes, the encoding-level questions that trip up even strong candidates.
Table of Contents
Intro Why This Guide
Branch prediction is one of the most consequential ideas in modern processor design — it's the reason a deeply pipelined CPU doesn't grind to a halt every time it hits an `if` statement. It's also one of the most commonly probed topics in mid-to-senior computer architecture interviews, because it touches prediction accuracy, speculative execution, and — since Spectre and Meltdown — hardware security.
This is Part 4 of our five-part series, and it's the largest: 55 questions spanning branch prediction (static and dynamic predictors, BTB, BHT, two-bit saturating counters, GShare, TAGE, and speculative execution) and instruction formats and addressing modes (MIPS instruction types, x86 ModR/M and SIB bytes, and every major addressing mode you'll be asked to explain with an example).
These two topics are grouped together because they tend to appear back-to-back in interviews once hazards are covered — branch prediction explains how the pipeline stays full, and addressing modes explain how instructions actually reference the operands the pipeline is executing.
Context Why These Questions Are Asked in Interviews
Branch prediction questions test whether you understand speculative execution — a concept that's now inseparable from processor security, given how Spectre and Meltdown exploit misprediction recovery.
Addressing mode questions test attention to encoding-level detail, which matters directly if you're working on instruction decoders, assemblers, or RTL that has to interpret an ISA correctly.
How to use this list
Use the search box below to jump to a specific question, or expand every answer at once to read through the whole section. Tap any question to reveal its full answer.
55 questions
Q91–Q102 Static & Dynamic Branch Prediction
Q91 Why is branch prediction important? ▸
Q92 What is static branch prediction? ▸
Q93 What is dynamic branch prediction? ▸
Q94 How does a 1-bit branch predictor work? ▸
Q95 How does a 2-bit saturating counter predictor work? ▸
Q96 What is a Branch Target Buffer (BTB)? ▸
Q97 What is a Branch History Register (BHR)? ▸
Q98 What is a correlating (two-level) branch predictor? ▸
Q99 What is a GShare predictor? ▸
Q100 What is a tournament (hybrid) predictor? ▸
Q101 What is a perceptron-based branch predictor? ▸
Q102 What is a Return Address Stack (RAS)? ▸
Q103–Q115 Advanced Predictors, Speculation & Security
Q103 What is speculative execution in the context of branch prediction? ▸
Q104 What is the misprediction penalty and how is it calculated? ▸
Q105 What is the difference between global and local branch prediction? ▸
Q106 What is TAGE branch prediction? ▸
Q107 How does branch prediction accuracy affect overall processor performance? ▸
Q108 What is branch target prediction vs branch direction prediction? ▸
Q109 What is an indirect branch and how is it predicted? ▸
Q110 What is the branch delay slot? ▸
Q111 What is predicated execution? ▸
Q112 How do Spectre and Meltdown attacks exploit branch prediction? ▸
Q113 What is a loop predictor? ▸
Q114 What is the Bimodal predictor? ▸
Q115 What is a Branch Target Address Cache (BTAC)? ▸
Q116–Q127 Instruction Formats & Basic Addressing Modes
Q116 What is an instruction format? ▸
Q117 What are the MIPS R-type, I-type, and J-type instruction formats? ▸
Q118 What is an addressing mode? ▸
Q119 Explain Immediate addressing mode. ▸
Q120 Explain Register (Direct) addressing mode. ▸
Q121 Explain Register Indirect addressing mode. ▸
Q122 Explain Base + Displacement (Offset) addressing mode. ▸
Q123 Explain Indexed addressing mode. ▸
Q124 Explain PC-relative addressing mode. ▸
Q125 Explain Direct (Absolute) addressing mode. ▸
Q126 Explain Indirect addressing mode. ▸
Q127 Explain Auto-increment and Auto-decrement addressing modes. ▸
Q128–Q139 Advanced Addressing Modes & Instruction Encoding
Q128 What is the difference between big-immediate and small-immediate instructions? ▸
Q129 What is the effective address and how is it calculated? ▸
Q130 How does the x86 ModR/M byte work in instruction encoding? ▸
Q131 What are RISC-V instruction formats? ▸
Q132 What is the concept of orthogonality in instruction set design? ▸
Q133 What is the difference between 2-address, 3-address, and 0-address instruction formats? ▸
Q134 How does ARM's flexible second operand (barrel shifter) work? ▸
Q135 What is position-independent code (PIC) and how do addressing modes support it? ▸
Q136 What is instruction alignment and why does it matter? ▸
Q137 What is a zero-operand (stack) instruction format? ▸
Q138 What is the SIB byte in x86 encoding? ▸
Q139 What is the concept of instruction encoding density? ▸
Q140–Q145 Where Performance Metrics Begin — CPI & IPC
Q140 What is CPI (Cycles Per Instruction)? ▸
Q141 What is the CPU performance equation? ▸
Q142 What is IPC (Instructions Per Cycle)? ▸
Q143 How do you calculate the effective CPI considering stalls? ▸
Q144 What is throughput in computer architecture? ▸
Q145 What is the difference between latency and throughput? ▸
Prep Tips for Freshers & Experienced Engineers
For Freshers
- Start with static vs dynamic prediction and the 2-bit saturating counter (Q92–Q95) — these are asked far more often than TAGE or perceptron predictors.
- Practice explaining a BTB and a BHT with a diagram — interviewers often ask you to sketch how they work together to predict both direction and target.
- For addressing modes, memorize one instruction example per mode (immediate, register, register indirect, base+displacement, indexed, PC-relative) — abstract definitions alone rarely satisfy interviewers here.
For Experienced Engineers
- Be ready to discuss Spectre/Meltdown at a conceptual level (Q112) if you're interviewing for a security-adjacent or high-performance core design role.
- Interviewers may ask you to compare GShare, tournament, and TAGE predictors and justify which you'd choose for a given workload — have a structured answer ready.
- For instruction encoding, be prepared to discuss orthogonality and encoding density trade-offs (Q132, Q139) — these come up when comparing RISC-V, ARM, and x86 design philosophies.
Avoid Common Mistakes
- Explaining branch prediction only in terms of direction (taken/not-taken) and forgetting target prediction, which is what the BTB actually solves.
- Confusing a Branch History Register (per-branch or global taken/not-taken history) with a Branch History Table (per-address prediction state) — these are different structures with related names.
- Not being able to explain why a 2-bit saturating counter outperforms a 1-bit predictor (it tolerates a single anomalous branch outcome without flipping its prediction).
- Treating addressing modes as pure memorization instead of connecting each mode to the kind of data access pattern it's optimized for (arrays → indexed, structs → base+displacement, etc.).
FAQ Frequently Asked Questions
Why are branch prediction and addressing modes grouped into one article?
Do I need to know TAGE predictors for a fresher interview?
How much detail do I need on Spectre and Meltdown?
Which addressing modes are asked most often?
Why does this section include a few CPI/IPC questions at the end?
Wrap-up Conclusion
Branch prediction and instruction encoding are dense but highly rewarding topics to master — they're where interviews test both conceptual depth (speculative execution, prediction accuracy) and precision (addressing modes, encoding formats). With this covered, Part 5 wraps up the series with performance metrics and advanced cross-cutting topics: CPI, memory hierarchy, out-of-order execution, and modern multicore and GPU architecture.
Ready for the next round?
Keep the momentum going — work through all five parts back to back, or jump straight to the topic your next interview is focused on.
Part 5: Continue Learning
Comments
Post a Comment