Functions


Q31.

Consider the following C program. #include < stdio.h > void mystery(int *ptra,int *ptrb){ int *temp; temp =ptrb; ptrb =ptra; ptra =temp; } int main(){ int a=2016,b=0,c=4,d=42; mystery(&a, &b); if (a < c) mystery(&c, &a); mystery(&a, &d); printf("%dn", a); } The output of the program is _________.
GateOverflow

Q32.

Consider the following C functions. The value returned by pp(3,4) is _____
GateOverflow

Q33.

A language with string manipulation facilities uses the following operations. head(s)- returns the first character of the string stails(s)- returns all but the first character of the string sconcat(s1,s2)- concatenates string s1 with s2. The output of concat(head(s), head(tail(tail(s)))), where s is acbc is:
GateOverflow

Q34.

Consider the following code fragment void foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); }What is the final value of x in both call by value and call by reference, respectively?
GateOverflow

Q35.

The following program main() { inc(); inc(); inc(); } inc() { static int x; printf("%d", ++x); }
GateOverflow

Q36.

Consider the following C function. int fun(int n){ int x=1,k; if (n==1) return x; for (k=1; k \lt n; ++k) x = x + fun(k) * fun(n-k); return x; } The return value of fun(5) is ________.
GateOverflow

Q37.

Consider the following C program. #include < stdio.h > int f1(void); int f2(void); int f3(void); int x = 10; int main( ) { int x = 1; x += f1( ) + f2( ) + f3( ) + f2( ); printf("%d", x); return 0; } int f1() { int x = 25; x++; return x;} int f2() { static int x = 50; x++; return x;} int f3() { x *= 10; return x}; The output of the program is ________.
GateOverflow

Q38.

What is the time complexity for the following C module? Assume that n \gt 0. int module(int n) { if (n == 1) return 1; else return (n + module(n-1)); }
GateOverflow

Q39.

Consider the C function given below int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; } Which one of the following is TRUE?
GateOverflow

Q40.

Which of the following is true with respect to Reference?
GateOverflow