Question 21
void f(int, short);
void main()
{
int i = 100;
short s = 12;
short *p = &s;
__________ ; // call to f()
}
Question 22
int f(int *p, int n)
{
if (n <= 1) return 0;
else return max(f(p+1,n-1),p[0]-p[1]);
}
int main()
{
int a[] = {3,5,2,6,4};
printf(\"%d\", f(a,5));
}
Question 23
Question 24
Count (x, y) { if (y !=1 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y-1; Count (1024, y); } } }The number of times that the
print
statement is executed by the call Count(1024, 1024)
is _______ .
Note -This was Numerical Type question.Question 25
int fun(x: integer) { If x > 100 then fun = x – 10; else fun = fun(fun(x + 11)); }For the input x = 95, the function will return
Question 26
int func(int num) { int count = 0; while(num) { count++; num >>= 1; } return(count) ; }For func(435) the value returned is
Question 27
void swap ( int x, int y ) { int tmp; tmp = x; x= y; y = tmp; }In order to exchange the values of two variables a and b:
Question 28
Question 29
#includeWhat would the program print?void main() { double pi = 3.1415926535; int a = 1; int i; for(i=0; i < 3; i++) if(a = cos(pi * i/2) ) printf("%d ",1); else printf("%d ", 0); }
Question 30
int f(int n) { static int i = 1; if(n >= 5) return n; n = n+i; i++; return f(n); }The value returned by f(1) is
There are 41 questions to complete.