250+ TOP MCQs on Basics of Functions and Answers

C Objective Questions on “Basics of Functions”. One shall practice these Objective Questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C Objective Questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C Objective Questions on “Basics of Functions” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         m();
  5.         void m()
  6.         {
  7.             printf("hi");
  8.         }
  9.     }

a) hi
b) Compile time error
c) Nothing
d) Varies
Answer: b
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         m();
  5.     }
  6.     void m()
  7.     {
  8.         printf("hi");
  9.         m();
  10.     }

a) Compile time error
b) hi
c) Infinite hi
d) Nothing
Answer: c
Clarification: None.

3. What will be the output of the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         static int x = 3;
  5.         x++;
  6.         if (x <= 5)
  7.         {
  8.             printf("hi");
  9.             main();
  10.         }
  11.     }

a) Run time error
b) hi
c) Infinite hi
d) hi hi
Answer: d
Clarification: None.

4. Which of the following is a correct format for declaration of function?
a) return-type function-name(argument type);
b) return-type function-name(argument type){}
c) return-type (argument type)function-name;
d) all of the mentioned
Answer: a
Clarification: None.

5. Which of the following function declaration is illegal?
a) int 1bhk(int);
b) int 1bhk(int a);
c) int 2bhk(int*, int []);
d) all of the mentioned
Answer: d
Clarification: None.

6. Which function definition will run correctly?
a)

   int sum(int a, int b)
   return (a + b);

b)

   int sum(int a, int b)
   {return (a + b);}

c)

   int sum(a, b)
   return (a + b);

d) none of the mentioned
Answer: b
Clarification: None.

7. Can we use a function as a parameter of another function? [Eg: void wow(int func())].
a) Yes, and we can use the function value conveniently
b) Yes, but we call the function again to get the value, not as convenient as in using variable
c) No, C does not support it
d) This case is compiler dependent
Answer: c
Clarification: None.

8. The value obtained in the function is given back to main by using ________ keyword.
a) return
b) static
c) new
d) volatile
Answer: a
Clarification: None.

  250+ TOP MCQs on Register Variables and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top