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
51. what will be result of the following program ? main ( ) { void f (int, int); int i = 10; f (i, i++); } void f(int i, intj) { if (i >50) return; i+=j; f (i, j); printf ("%d, ", i); }
- 85, 53, 32, 21
- 10, 11, 21, 32, 53
- 32, 21, 11, 10
- none of the above
52. What is the output of the following code ? main ( ) { printf ("%d\n", sum (5)); } int sum (int n) { if (n<1) return n; else return (n + sum (n-1)); }
- 10
- 16
- 14
- 15
53. What is the output generated by the following program ? # include <stdio.h> main ( ) { int i, x; for (i = 1, i<=5; i++) { x = sq (i); printf ("%d",x); } } sq (int x) { return x*x; }
- 1234567
- 2516941
- 9162514
- 1491625
54. What is the output of the following code ? int n = -24; main ( ) { printd (n); } printd (int n) { if (n < 0) { ptintf ("-"); n = -n; } if (n % 10 ) printf ("%d", n); else printf ("%d", n/10); printf ("d", n); }
- -24
- 24
- -2424
- -224
55. What is the output of the following code ? main ( ) { int x = 80, a= -80 void swap (intt, int); swap (x, a); printf ("numbers are %d\t%d", a, x), } void swap (int y, int b) { int t=y; y = b; b = t; }
- numbers are 80 -80
- numbers are 80 80
- numbers are -80 80
- numbers are -80 -80
56. Which storage class can precede any data type in the parameter list ?
- Auto
- Static
- Register
- Extern
57. Which of the following is true about functions ?
- The formal parameters are also known as arguments.
- A static function will not be known outside its source file.
- Functions have internal linkage by defult.
- All the above.
58. Which of the following storage classes are used for function declaration ?
- Auto, register
- auto, static, extern
- Exetern, typedef
- Extern, static and typedef
59. Which of the following is not used for termination of recursion?
- if statement
- switch statement
- ternary operator
- relational operator
60. Find the output void main () { printf("%u", main ); }
- Garbage value
- Run time error
- Printing starting address of function main
- Infinite loop