250+ TOP MCQs on Functions Returning Non-integers and Answers

’s MCQs on C helps anyone preparing for placement in Hexaware and other companies. Anyone looking for Hexaware placement papers should practice these questions continuously for 2-3 months, thereby ensuring a top position in placements.

Here is a listing of online C test questions on “Functions Returning Non-integers” along with answers, explanations and/or solutions:

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

  1.     #include 
  2.     int *m();
  3.     void main()
  4.     {
  5.         int k = m();
  6.         printf("%d", k);
  7.     }
  8.     int *m()
  9.     {
  10.         int a[2] = {5, 8};
  11.         return a;
  12.     }

a) 5
b) 8
c) Nothing
d) Varies
Answer: d
Clarification: None.

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

  1.     #include 
  2.     void m(int k)
  3.     {
  4.         printf("hi");
  5.     }
  6.     void m(double k)
  7.     {
  8.         printf("hello");
  9.     }
  10.     void main()
  11.     {
  12.         m(3);
  13.     }

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

3. What is the default return type if it is not specified in function definition?
a) void
b) int
c) double
d) short int
Answer: b
Clarification: None.

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

  1.     #include 
  2.     int foo();
  3.     int main()
  4.     {
  5.         int i = foo();
  6.     }
  7.     foo()
  8.     {
  9.         printf("2 ");
  10.         return 2;
  11.     }

a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
Answer: a
Clarification: None.

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

  1.     #include 
  2.     double foo();
  3.     int main()
  4.     {
  5.         foo();
  6.         return 0;
  7.     }
  8.     foo()
  9.     {
  10.         printf("2 ");
  11.         return 2;
  12.     }

a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
Answer: b
Clarification: None.

6. Functions can return structure in C?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
Answer: a
Clarification: None.

7. Functions can return enumeration constants in C?
a) true
b) false
c) depends on the compiler
d) depends on the standard
Answer: a
Clarification: None.

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

  1.     #include 
  2.     enum m{JAN, FEB, MAR};
  3.     enum m foo();
  4.     int main()
  5.     {
  6.         enum m i = foo();
  7.         printf("%dn", i);
  8.     }
  9.     int  foo()
  10.     {
  11.         return JAN;
  12.     }

a) Compile time error
b) 0
c) Depends on the compiler
d) Depends on the standard
Answer: a
Clarification: None.

Leave a Reply

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