C Miscellaneous - Study Mode

[#86] What will be the output of the following C code? #include<stdio.h>
main()
{
signed char a[]= “BAT”
printf(“%c”, a[1])
return 0
}
Correct Answer

(C) A

[#87] What will be the output of the following C code? #include <stdio.h>
void inline func1(int a, int b)
{
printf ("a=%d and b=%d
", a, b)
}
int inline func2(int x)
{
return x*x
}
int main()
{
int tmp
func1(1,4)
tmp = func2(6)
printf("square val=%d
", tmp)
return 0
}
Correct Answer

(A) a=1 and b=4 square val = 36

[#88] 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--)
}
}
Correct Answer

(D) Infinite number of times

[#89] Comment on the output of following C code. #include <stdio.h>
main()
{
char *p = 0
*p = 'a'
printf("value in pointer p is %c
", *p)
}
Correct Answer

(D) Run time error

[#90] What will be the output of the following C code? #include <stdio.h>
void inline f1(char b)
{
printf ("%d
",b)
}
int main()
{
f1('a')
return 0
}
Correct Answer

(D) 97