Q10
Consider the function func shown below:
int func(int num) {
int count = 0;
while (num) {
count++;
num>>= 1;
}
return (count);
}The value returned by func(435) is __________.
Show answer without attempting
Answer: 9
GATE CS · Programming and Data Structures · 3 questions
3 C Programming questions from GATE CS papers (2014), each with the official answer key. Part of Programming and Data Structures. Answer any question right here and it is marked straight away, or practise them one at a time.
int func(int num) {
int count = 0;
while (num) {
count++;
num>>= 1;
}
return (count);
}Answer: 9
Answer: B
#include <stdio.h>
main()
{
int i;
int *pi = &i;
scanf("%d",pi);
printf("%d\n", i+5);
}Answer: D
0/30 correct0 marks