3 votes 3 votes Consider the function int func(int num) { int count=0; while(num) { count++; num>>=1; } return(count); } For $func(435)$ the value returned is $9$ $8$ $0$ $10$ Programming in C isrodec2017 + – gatecse asked Dec 17, 2017 • reopened Jul 11, 2022 by Arjun gatecse 1.7k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply sachin! commented Dec 20, 2017 reply Follow Share 9 no of bit to represent 435 0 votes 0 votes pawan kumarln commented Feb 12, 2018 i reshown by Arjun Jul 11, 2022 reply Follow Share https://gateoverflow.in/1964/gate2014-2-10 0 votes 0 votes Please log in or register to add a comment.
Best answer 5 votes 5 votes num>>1 is equivalent to num/2 in while loop , value of num will change as follows: 435 /2 =217 217 /2 =108 108 /2 =54 54 /2 =27 27 /2 =13 13 /2 =6 6 /2 =3 3 /2 =1 1 /2 =0 Since it looped 9 times value of count will be 9 Answer is A sh!va answered Jan 10, 2018 • selected Feb 12, 2018 by Prashant. sh!va comment Share Follow See all 0 reply Please log in or register to add a comment.
–1 votes –1 votes plz refer here: https://gateoverflow.in/1964/gate2014-2-10 Hira Thakur answered Dec 22, 2017 Hira Thakur comment Share Follow See all 0 reply Please log in or register to add a comment.