Questions: Branch Prediction and Speculative Execution

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A loop executes exactly 100 times. A 1-bit branch predictor is used for the loop-back branch. How many times does the predictor mispredict across all 100 iterations?

A0 times — the predictor quickly learns the branch is always taken
B2 times — once when the loop first executes and once when it finally exits
C100 times — the predictor mispredicts every iteration
D50 times — the 1-bit predictor alternates predictions
Question 2 Multiple Choice

Why does branch misprediction penalty grow with pipeline depth?

ADeeper pipelines encounter branches more frequently because they execute more instructions per cycle
BEach misprediction requires flushing all instructions that were speculatively fetched after the branch, and deeper pipelines have fetched more of them
CDeeper pipelines use more complex prediction algorithms that introduce more errors
DBranch resolution happens earlier in deeper pipelines, giving the predictor less time to decide
Question 3 True / False

Static branch prediction can achieve 85–90% accuracy by usually predicting branches as not taken.

TTrue
FFalse
Question 4 True / False

When a branch prediction is incorrect, the processor must flush the speculatively executed instructions from the pipeline and restart fetching from the correct path.

TTrue
FFalse
Question 5 Short Answer

Explain why branch prediction is described as 'one of the most performance-critical components in a processor despite performing no actual computation.' What cost does a misprediction incur?

Think about your answer, then reveal below.