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;

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; Correct Answer b = a/4

A 8051 Microcontroller can perform addition, subtraction, left shifting of bits and right shifting of bits. 

When there is a multiplication by nth power of 2, then there is n times left shift.

When there is a division by nth power of 2, then there is n times right shift.

The shifting operations requires the least clock cycles, hence option 4 is the correct answer.

As, there is a division of the square of 2, hence it involves just 2 times right shift. 

Related Questions