C Programming questions

Q10

GATE CS 2014 CS-2C ProgrammingNAT1 mark
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

Q11

GATE CS 2014 CS-2C ProgrammingMCQ1 mark−1/3 if wrong
Suppose n and p are unsigned int variables in a C program. We wish to set p to nC3^{n}C_{3}. If n is large, which one of the following statements is most likely to set p correctly?
Show answer without attempting

Answer: B

Q10

GATE CS 2014 CS-1C ProgrammingMCQ1 mark−1/3 if wrong
Consider the following program in C language:
#include <stdio.h>
main()
{
 int i;
 int *pi = &i;
 scanf("%d",pi);
 printf("%d\n", i+5);
}
Which one of the following statements is TRUE?
Show answer without attempting

Answer: D

0/30 correct0 marks

Related topics in Programming and Data Structures