File Input Output - Study Mode

[#241] What will be the output of the following C code? #include <stdio.h>
int main()
{
short int i
scanf("%*hd", &i)
printf("%hd", i)
return 0
}
Correct Answer

(B) Somegarbage value

[#242] What will be the output of the following C code? printf(“
Output: %5d %x %#x”, 234,234,234)
Correct Answer

(C) Output: xa0xa0 234 EA 0xEA

[#243] What will be the output of the following C code? #include <stdio.h>
#include <stdlib.h>
int main()
{
srand(9000)
printf("%d
", rand())
return 0
}
Correct Answer

(B) An integer in the range 0 to RAND_MAX

[#244] What will be the output of the following code? char t=’N’
printf(“
%c
%3c
%5c”,t,t,t)
Correct Answer

(B) N N N

[#245] What will be the output of the following C code? #include <stdio.h>
int main(int argc, char** argv)
{
char *s = "myworld"
int i = 3
printf("%10.*s", i, s)
}
Correct Answer

(A) myw(note:7 spaces before myw)