Loading...

C Multiple Choice Questions

Our C questions and answers focuses on all areas of C programming language covering 100+ topics in C

C Functions-3 MCQs

C Functions-3


1.It is necessary to declare the type of a function in the calling program if the function

a) Return an integer
b) Returns a non-integer value
c) is not defined in the same file
d) None of these



2. What will be the value returned by the following function, when it is called with a value 11?
recur(int num() {
  if((2) != 0 )
    return(recur(2) * 10+num% %2)
  else
    return 1;
}

a) Function does not return any value, because it goes into an infinite loop
b) 11
c) 1011
d) None of these



3. The function that actually created from a call to a template function is called

a) Generated
b) Inherited
c) Spawned
d) Declassified



4. The function fprintf is used in a program.

a) When too many printf calls have been alrady used in the program
b) In place of printf, since printf uses more memory
c) When output i to be printed on to a file
d) All of above



5. What is the output of C program with pointers.
int main() {
  int a = 20;
  //a memory location = 1234
  printf("%d %d %d %d", a, &a, *(&a));
  return 0;
}

a) 20 20 20
b) 20 1234 1234
c) 20 1234 20
d) 20 20 20



6. What is the output of C program with functions?
int main() {
  int a = 20;
  printf("CINEMA ");
  return 1;
  printf("DINOSAUR ");
  return 1;
}

a) CINEMA DINOSAUR
b) CINEMA
c) DINOSAUR
d) Compiler error



7. What is the output of C program with recursive function?
int sum(int x) {
  int k = 1
  if(x <= 1)
    return 1;
  k = x + sum(x - 1);
    return k;
}

a) 10
b) 11
c) 12
d) 15



8. A recursive function can be replaced with __ in C language.

a) for loop
b) while loop
c) do while loop
d) All the above



9. A recursive function is faster than __ loop.

a) for
b) while
c) do while
d) None of the above



10. What is the C keyword that must be used to achieve expected result using Recursion?

a) printf
b) scanf
c) void
d) return



- Related Topics