C Functions Questions and Answers
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
141. Find the output void call (int); void main () { call (3); } void call (int a) { if (a<6) call (++a); printf("%d",a); }
- 4 5 6
- 6 5 4 3
- 6 6 5 4
- 5 5 4
142. Find the output void func( ) } printf("Function"); } void main ( ) { void main ( ) { func; func ( ); }
- Function
- Function
- Compilation error
- None of these
143. Which functions are used to mapping program from user area to kernel area.
- Standard Library function
- User defined function
- System call cunction
- None of the above
144. Find the output int i; int increment (int i) { i++ -2; return; } int main ( ) { for (i=2; increment (i);) { if (i>0) break; } printf("%d\n",i); return 0; }
- 1
- 2
- iniinite loop
- Compilation error
145. Find the output void fun(int [ ] [3]); void main( ) { int a[3] [3]={1 , 2, 3} {4, 5, 6), {7, 8, 9}}; fun (a); printf("%d", a[2] [1]); } void fun( int b [ ] [3]) { ++b; b[1+0] [1%2]= -9; }
- -8
- -9
- 9
- Compilation error
146. Find the output void main ( ) { static int val=7; int data; if (--val) { data=main( )+val; printf(%d ", data); } return 0; }
- 1 2 3 4 5 6
- 0 0 0 0 0 0
- INFINITE LOOP
- Compilation error
147. Which of the following three functions are likely to cause problem with pointers int *f1(void) { int x=10; return (&x); } int *f2(void) { int *ptr; *ptr=10; return ptr; } int *f3(void) { int *ptr; ptr=(int*) malloc(sizeof (int)); return ptr; }
- only f3
- only f1 and f3
- only f1 and f2
- f1, f2, f3
148. Find the output void main ( ) { int a,b; a=sd (123); b=sd (123); printf("%d %d",a,b); } sd (int n) { static int s=0; int d; if (n!0); { d=n%10; n=(n-d)/10; s=s+d; sd(n); } else return (s); }
- 12 6
- 6 12
- 3 15
- Compilation error
150. Find the output void fun (char**); void main() { har *argv [ ]={"ab", "cd" "er", "gh", "ij", "k1"); fun (argv); } void fun (char **p) { char *t; { char *t; t=(p+=sizeof (int)) [-1]; printf("%s", t); }
- ab
- cd
- ef
- gh