C Functions Questions and Answers

Practice Mode
Showing 10 of 151 questions
Q51
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); }
  • A 85, 53, 32, 21
  • B 10, 11, 21, 32, 53
  • C 32, 21, 11, 10
  • D none of the above
Answer: Option D
Q52
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)); }
  • A 10
  • B 16
  • C 14
  • D 15
Answer: Option D
Q53
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; }
  • A 1234567
  • B 2516941
  • C 9162514
  • D 1491625
Answer: Option D
Q54
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); }
  • A -24
  • B 24
  • C -2424
  • D -224
Answer: Option C
Q55
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; }
  • A numbers are 80 -80
  • B numbers are 80 80
  • C numbers are -80 80
  • D numbers are -80 -80
Answer: Option C
Q56
Which storage class can precede any data type in the parameter list ?
  • A Auto
  • B Static
  • C Register
  • D Extern
Answer: Option C
Q57
Which of the following is true about functions ?
  • A The formal parameters are also known as arguments.
  • B A static function will not be known outside its source file.
  • C Functions have internal linkage by defult.
  • D All the above.
Answer: Option D
Q58
Which of the following storage classes are used for function declaration ?
  • A Auto, register
  • B auto, static, extern
  • C Exetern, typedef
  • D Extern, static and typedef
Answer: Option D
Q59
Which of the following is not used for termination of recursion?
  • A if statement
  • B switch statement
  • C ternary operator
  • D relational operator
Answer: Option C
Q60
Find the output void main () { printf("%u", main ); }
  • A Garbage value
  • B Run time error
  • C Printing starting address of function main
  • D Infinite loop
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test