Consider the function func shown below:
1 2 3 4 5 6 7 8 9 10 |
|
The value returned by func(435)is _ _ .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
int func (int num) { int count = 0; while (num) //After each right shift, checks whether the num value is not zero// { count ++; num ≫= 1; //shifts all bits of num one slot to the right// } return(count); } Initially num = 110110011, count = 0 count = 1; num = 101100110 after 1st right shift count =2; num = 011001100 after 2nd right shift : : Count = 9; num = 000000000 after 9th right shift. After nine right shifts, num = 0; and while loop terminates count = 9 will be returned.