6.
Guess the output:
main()
{
printf(“%d”, sizeof(‘a’));
//same as → sizeof(97)
}
A) 2 or 4
B) 1 or 3
C) Garbage value
D) ASCII value of a
7.
Predict the output of following code:
main()
{
int a=b=c=d=10;
printf(“%d,%d,%d,%d”,a,b,c,d);
}
A) Error
B) 10,10,10,10
C) Garbage Value,Garbage Value,Garbage Value,10
D) Garbage Value,Garbage Value,Garbage Value,Garbage Value
8.
Select the missing statement?
#include<stdio.h>
long int fact(int n);
int main()
{
\\missing statement
}
long int fact(int n)
{
if(n>=1)
return n*fact(n-1);
else
return 1;
}
A) printf(“%ll\n”,fact(5));
B) printf(“%u\n”,fact(5));
C) printf(“%d\n”,fact(5));
D) printf(“%ld\n”,fact(5));
9.
If a function’s return type is not explicitly defined then it’s default to ______ (In C).
A) int
B) float
C) void
D) Error
10.
How many times the below loop will be executed?
#include<stdio.h>
int main()
{
int i;
for(i=0;i<5;i++) printf(“Hello\n”);
}
A) 5
B) 1
C) 0
D) 3