File Input Output - Study Mode
[#231] What will be the output of the following C code? #include <stdio.h>
int main()
{
int n
scanf("%d", &n)
ungetc(n, stdin)
scanf("%d", &n)
printf("%d
", n)
return 0
}
Correct Answer
(B) Whatever is typed by the user first time
[#232] What will be the output of the following C code? #include <stdio.h>
int main()
{
char buf[12]
stderr = stdin
fscanf(stderr, "%s", buf)
printf("%s
", buf)
}
Correct Answer
(C) Whatever user types
[#233] What form the data must be entered for the given C code? scanf(ā%d / %dā, &n1,&n2)
Correct Answer
(B) 6/9
[#234] 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
(C) Whatever user types
[#235] What will be the output of the following C code? #include <stdio.h>
int main()
{
FILE *fp = stdout
int n
fprintf(fp, "%d
", 45)
fprintf(stderr, "%d ", 65)
return 0
}
Correct Answer
(A) 45 65