Functions


Q41.

The output of the following C program is__________. void f1(int a, int b) { int c; c=a; a=b; b=c; } void f2(int *a, int *b) { int c; c=*a; *a=*b; *b=c; } int main(){ int a=4, b=5, c=6; f1(a,b); f2(&b, &c); printf("%d",c-a-b); }
GateOverflow

Q42.

Consider the following function written in the C programming language. void foo(char *a){ if ( *a && *a != ' '){ foo(a+1); putchar(*a); } } The output of the above function on input "ABCD \; \; EFGH" is
GateOverflow

Q43.

Suppose c=(c[0],...,c[k-1]) is an array of length k, where all the entries are from the set {0,1}. For any positive integers a and n, consider the following pseudocode. If k=4, c=(1,0,1,1), a=2 and n=8, then the output of DOSOMETHING(c,a,n) is _____.
GateOverflow

Q44.

Consider the following recursive C function. void get(int n) { if (n<1) return; get(n-1); get(n-3); printf("%d", n); } If get(6) function is being called in main()then how many times will the get()function be invoked before returning to the main()?
GateOverflow

Q45.

Consider the following function double f (double x) { if ( abs (x*x - 3) < 0. 01) return x; else return f (x / 2 + 1.5/x); } Give a value q (to 2 decimals) such that f(q) will return q:______
GateOverflow