1. What is the output of this C code?

#include <stdio.h>
void main()
{
m();
void m()
{
printf(“SimpleWay2Code”);
}
}
a) SimpleWay2Code
b) Compile time error
c) Nothing
d) Varies

2. What is the output of this C code?

#include <stdio.h>
void main()
{
static int x = 3;
x++;
if (x <= 5)
{
printf(“hello”);
main();
}
}
a) Run time error
b) hello
c) Infinite hello
d) hello hello

3. The value obtained in the function is given back to main by using ________ keyword?
a) return
b) static
c) new
d) volatile

4. What is the problem in the following declarations?
int func(int);
double func(int);
int func(float);
a) A function with same name cannot have different signatures
b) A function with same name cannot have different return types
c) A function with same name cannot have different number of parameters
d) All of the mentioned

5. What is the return-type of the function sqrt()
a) int
b) float
c) double
d) depends on the data type of the parameter

6. What is the output of this code having void return-type function?

#include <stdio.h>
void foo()
{
return 1;
}
void main()
{
int x = 0;
x = foo();
printf(“%d”, x);
}
a) 1
b) 0
c) Runtime error
d) Compile time error


7. The output of the code below is

#include <stdio.h>
void main()
{
int k = m();
printf(“%d”, k);
}
void m()
{
printf(“hello”);
}
a) hello 5
b) Error
c) Nothing
d) Garbage value


8. The output of the code below is

#include <stdio.h>
int *m()
{
int *p = 5;
return p;
}
void main()
{
int *k = m();
printf(“%d”, k);
}
a) 5
b) Junk value
c) 0
d) Error

9. What will be the output of the program?
#include<stdio.h>

int main()
{
int i=1;
if(!i)
printf(“SimpleWay2Code,”);
else
{
i=0;
printf(“C-Program”);
main();
}
return 0;
}
A. prints “SimpleWay2Code, C-Program” infinitely
B. prints “C-Program” infinetly
C. prints “C-Program, SimpleWay2Code” infinitely
D. Error: main() should not inside else statement


10. How many times the program will print “SimpleWay2Code” ?
#include<stdio.h>

int main()
{
printf(“SimpleWay2Code”);
main();
return 0;
}
A. Infinite times
B. 32767 times
C. 65535 times
D. Till stack overflows