A. B. C. D.: Module - 4 1
A. B. C. D.: Module - 4 1
A. void
B. int
C. double
D. short int
Answer: Option B
int foo();
int main()
{
int i = foo();
}
foo()
{
printf("2 ");
return 2;
}
A. 2
void main()
{
static int x = 3;
x++;
if (x <= 5)
{
printf("hi");
main();
}
}
B. hi
C. infinite hi
D. hi hi
Answer: Option D
A. int
B. float
C. double
Answer: Option C
Answer: Option D
A. a
B. b
C. c
D. d
Answer: Option D
7. How many times is ‘a’ printed when the following C code is executed?
#include<stdio.h>
main()
{
int a;
a=f1(10);
printf("%d",a);
}
f1(int b)
{
if(b==0)
return 0;
else
{
printf("a");
f1(b--);
}
}
a) 9 times
b) 10 times
c) 0 times
d) Infinite number of times
Answer: d
8. In the following 'C' code, in which order the functions would be called ?
a = ( f1(23,14 ) * f2 (12/14)) + f3 () ;
A f1,f2,f3
.
B f3,f2,f1
.
C The order may vary from compiler to compiler
.
D None of these
.
Option: A
9. It is necessary to declare the type of a function in the calling program if the function
A Returns an integer
.
B Returns a non-integer value
.
C Is not defined in the same file
.
D None of these
.
Option: B
void function1(int)
B. Returns nothing
D. None of these
Option: B