C Functions Questions and Answers

Practice Mode
Showing 10 of 151 questions
Q101
Default return value of a function is
  • A int
  • B char
  • C float
  • D double
Answer: Option A
Q102
Find the output. void main ( ) { int x, y=5; x=come (y); y=go (x); printf("%d",x); printf ("%d", y); } come (int x) { if (x) return x++; else return x--; } go (int y) { if (y) return y++; else return y--; }
  • A 55
  • B 67
  • C 43
  • D None of these
Answer: Option A
Q103
Find the output. void main ( ) { char *p="cite"; char *q="good"; if (strcmp (p,q)) printf ("equal"); else printf("not equal"); }
  • A equal
  • B not equal
  • C Compilation error
  • D None of these
Answer: Option A
Q104
Find the output void main ( ) { char c [ ] = "rama"; put (c); } put (char *p) { while (++*p) printf("%c", *p); }
  • A rama
  • B ama
  • C ama\0
  • D none of these
Answer: Option D
Q105
Find the output. int a [ ] = {a, 3, 5, 7}; int count; add ( ) { return ++count; } void main ( ) { a [count++]=add ( ); pintf ("%d", a[count]); }
  • A 3
  • B 4
  • C 5
  • D None of these
Answer: Option C
Q106
Find the output void main ( ) { int a [ ] = {1, 2, 3, 4, 5}, i=0; while (a[i]) callme (a[i++]); for (i=0;i<5;i++) printf("%d", a [i]); } callme (int x) { *(&x)=x+1; }
  • A 1 2 3 4 5
  • B 2 3 4 5 6
  • C No output
  • D None of these
Answer: Option A
Q107
The function strcat( ) append what value at the end of the string ?
  • A NULL
  • B '\0'
  • C Nothing
  • D None of these
Answer: Option B
Q108
Find the output void main( ) { void rev (int); rev (3); } void rev (int v) { if (n>0) rev (--n); printf("%d",n); }
  • A 0012
  • B 123
  • C 012
  • D None of these
Answer: Option A
Q109
Find the output void main ( ) { int i=1; do { printf("%d",i); } while (end (i)); } end (int i) { i--; }
  • A 1
  • B Print 1 infinite time
  • C Error, function should return a value
  • D None of these
Answer: Option B
Q110
Find the output void main ( ) { f ( ); f ( ); } f ( ) { static i=1; printf("%d", i++); }
  • A 11
  • B 12
  • C 13
  • D None of these
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test