C Functions Questions and Answers

Take Exam

C Functions Questions with Answers provide an in-depth look at one of the most fundamental concepts in C programming. Understanding how to define, call, and manage user-defined and library functions is key to mastering structured programming. These C programming MCQs are widely used in technical interviews and coding tests conducted by companies like TCS, Wipro, and Infosys. Each question includes explanations to help you grasp parameter passing, recursion, return types, and scope. Practicing programming questions with answers strengthens your coding logic and prepares you for real-world software challenges. Download C programming MCQ PDFs and practice online to enhance your technical aptitude efficiently.

C Functions

Showing 10 of 151 questions

121. Function is used to

  • Convert a generic style program to modular style
  • Convert a modular style program to object oriented style
  • Convert a program into function oriented
  • None of the above
Show Answer Report

122. 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.P.J
  • A.P
  • APJ
  • None of these
Show Answer Report

123. 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); }

  • Garbage 4 1
  • 5 4 2
  • 54 1
  • None of these
Show Answer Report

124. 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); }

  • justdoit
  • jusdoi
  • justtdoitt
  • None of these
Show Answer Report

125. 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); } }

  • res 204
  • res 12083
  • res 202
  • None of these
Show Answer Report

126. Function can return at a time

  • One value
  • More than one value
  • Return nothing
  • None of these
Show Answer Report

127. Function prototype is not required if return type is

  • int
  • float
  • struct
  • None of the above
Show Answer Report

128. find the output void main ( ) { int x; x=3; f (x); printf ("MAIN"); } f (int n) { printf("F"); if (n !=0) f (n-1); }

  • FFFMAIN
  • FFFFMAN
  • FFMAIN
  • None of these
Show Answer Report

129. 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); }

  • 0 2 3 3 3 11 11
  • 0 2 3 3 0 11 11
  • 0 2 3 3 3 11 12
  • 0 2 3 3 0 11 12
Show Answer Report

130. 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); }

  • 10 15
  • 8 15
  • Garbage 15
  • None of these
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test