C Functions Questions and Answers

Practice Mode
Showing 10 of 151 questions
Q111
Every function internally creates
  • A Array of frames
  • B Linked list of frames
  • C Tree of frames
  • D None of these
Answer: Option B
Q112
Find the output void main ( ) { void show (int); int n=1000; show (n); } void show (int  x) { if (x !=0) { show (x/16); putchar("0123456789ABCDEF" [x%16]); } else return 0; }
  • A 2E8
  • B 2D7
  • C 3E8
  • D None of these
Answer: Option C
Q113
Find the correct output void main( ) { int n=5; printf("%d",f(n)); } int f(int n) { if (n>0) return (n+f(n-2)); else return 0; }
  • A 9
  • B 15
  • C 8
  • D None of these
Answer: Option A
Q114
Find the output void main ( ) { int a [ ]={1, 2, 3, 4}; int i, s=0; for (i=0; a[i];i++) s+=add (a[i]); printf("%d",s); } int add (int a) { static int d=1; return (a/d++); }
  • A 4
  • B 10
  • C 16
  • D None of these
Answer: Option A
Q115
The function strcmp(s1,s2) returns negative value if
  • A Length of s1 is less than s2
  • B Length of s2 is less than s1
  • C Length of s1 is less than or equal to s2
  • D Both s1 and s2 are same
Answer: Option A
Q116
Find the output fun ( ) { printf("Y"); } #define fun () printf ("N") void main ( ) { fun ( ); (fun) ( ); }
  • A YN
  • B NY
  • C Y
  • D N
Answer: Option B
Q117
Find the output void main ( ) { int a=5, b=10; swap (a,b); printf("%d %d", b, a); } swap (int x, int y) { int t=-x; -x=-y; y=t; }
  • A 5 10
  • B 10 5
  • C -5 -10
  • D Compilatio error
Answer: Option D
Q118
Find the output void main ( ) { void evaluate (int *); int a[3] [3]={{0,}, {2,3}, {4, 5}}; evaluate ((int *)a); } void evaluate (int *e) { printf ("%d", * (e+3)); }
  • A 4
  • B 2
  • C 0
  • D Compilation error
Answer: Option B
Q119
Find the output void main ( ) { int x; x=compute (4); printf("%d",x); } int compute (int n) { if (n<=1) return 2; else return (compute (n-2)* compute (n-1)); }
  • A 10
  • B 8
  • C 16
  • D 32
Answer: Option D
Q120
Which memory variable share the memory location in different fframes in function recursion
  • A Auto
  • B Static
  • C Extern
  • D Typedef
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test