This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Functions Returning Non-integers – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What will be the output of the following C code?
#include <stdio.h>
int *m();
void main()
{
int k = m();
printf("%d", k);
}
int *m()
{
int a[2] = {5, 8};
return a;
}
a) 5
b) 8
c) Nothing
d) Varies
View Answer
Explanation: None.
2. What will be the output of the following C code?
#include <stdio.h>
void m(int k)
{
printf("hi");
}
void m(double k)
{
printf("hello");
}
void main()
{
m(3);
}
a) hi
b) hello
c) Compile time error
d) Nothing
View Answer
Explanation: 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
View Answer
Explanation: None.
4. What will be the output of the following C code?
#include <stdio.h>
int foo();
int main()
{
int i = foo();
}
foo()
{
printf("2 ");
return 2;
}
a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
View Answer
Explanation: None.
5. What will be the output of the following C code?
#include <stdio.h>
double foo();
int main()
{
foo();
return 0;
}
foo()
{
printf("2 ");
return 2;
}
a) 2
b) Compile time error
c) Depends on the compiler
d) Depends on the standard
View Answer
Explanation: None.
6. Functions can return structure in C?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
View Answer
Explanation: None.
7. Functions can return enumeration constants in C?
a) true
b) false
c) depends on the compiler
d) depends on the standard
View Answer
Explanation: None.
8. What will be the output of the following C code?
#include <stdio.h>
enum m{JAN, FEB, MAR};
enum m foo();
int main()
{
enum m i = foo();
printf("%d\n", i);
}
int foo()
{
return JAN;
}
a) Compile time error
b) 0
c) Depends on the compiler
d) Depends on the standard
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for C Internship
- Watch Advanced C Programming Videos
- Check C Books
- Practice BCA MCQs
- Apply for Computer Science Internship