C Functions Questions and Answers

Practice Mode
Showing 10 of 151 questions
Q121
Function is used to
  • A Convert a generic style program to modular style
  • B Convert a modular style program to object oriented style
  • C Convert a program into function oriented
  • D None of the above
Answer: Option A
Q122
Find the outputt void main ( ) { char c[ ] = "A.P.J"; display (c); } display (char *p) { while (*p!='\0') { if (*p++!='.') printf("%c",*p); p++; } }
  • A A.P.J
  • B A.P
  • C APJ
  • D None of these
Answer: Option D
Q123
Find the output void main ( ) { int i=3, j; j=add (++i); printf("%d %d",i,j); } add (ii) int ii; { ii++; printf("%d ",ii); }
  • A Garbage 4 1
  • B 5 4 2
  • C 54 1
  • D None of these
Answer: Option B
Q124
Find the output void insert ( char a[ ], int n) { int i,j; for (i=j=0; a[i]!='\0';i++) if (a [i]!=n) a [j++]=a[i]; a[j]='\0'; } void main ( ) { char a[ ] = "justdoit"; insert (a, 't'); printf("%s", a); }
  • A justdoit
  • B jusdoi
  • C justtdoitt
  • D None of these
Answer: Option B
Q125
Find the output void main ( ) { int i, n, m, b, x [25]; int f1 (int, int, int j[25]); for ( i=0; i<25; i++) x[i]=i; i=0;m=24; b=f1 ( i, m, x); printf("res %d\n", b); } int f1(int p, int q, int a[25]) { int m1, m2; if (q==0) return (a[p])' else [ m1=f1 (p,q/2, a); m2=f1 (p+q/2+1, q/2, a); if (m1<m2) return (m2); else return (m1); } }
  • A res 204
  • B res 12083
  • C res 202
  • D None of these
Answer: Option B
Q126
Function can return at a time
  • A One value
  • B More than one value
  • C Return nothing
  • D None of these
Answer: Option A
Q127
Function prototype is not required if return type is
  • A int
  • B float
  • C struct
  • D None of the above
Answer: Option A
Q128
find the output void main ( ) { int x; x=3; f (x); printf ("MAIN"); } f (int n) { printf("F"); if (n !=0) f (n-1); }
  • A FFFMAIN
  • B FFFFMAN
  • C FFMAIN
  • D None of these
Answer: Option B
Q129
Find the output void main ( ) { auto int i=0; printf("%d ",i); { int i=2; printf("%d ",i); { int i=2; printf("%d ",i); { i+=1; printf("%d ",i); } printf ("%d ",i); } printf ("%d ",i); printf("%d ",ret10 ( ) ); printf("%d ",ret10 ( ) ); } int ret10 ( ) { static int i=10; i+=1; return (i); }
  • A 0 2 3 3 3 11 11
  • B 0 2 3 3 0 11 11
  • C 0 2 3 3 3 11 12
  • D 0 2 3 3 0 11 12
Answer: Option D
Q130
Find the output f (int x, int *y) { x=*(y)+=2; } void main ( ) { static int a[5]={2, 4, 6, 8, 10}; int i, b=5; for (i=0; i<5;i++) { f (a[i], &b); } printf("%d %d\n", a[i], b); }
  • A 10 15
  • B 8 15
  • C Garbage 15
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test