Topic: Microprocessors
Which of the following computation will take minimum number of clock cycles, if it is implemented on 8051 micro-controller?
Following is variable declaration in c code:
unsigned int a, b;
- A. b = a * a
- B. b = a * 3
- C. b = a / 3
- D. b = a / 4
Answer: D. b = a / 4
Explanation: Based on the official answer key, the correct option is (d). Dividing by powers of 2 (like 4) is often optimized as bitwise right-shift operations, which generally execute faster and take fewer clock cycles than multiplication or division by non-power-of-2 values.