File Input Output - Study Mode

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

(A) Compile time error

[#212] What will be the output of the following C code? #include <stdio.h>
int main()
{
FILE *fp = stdout
stderr = fp
fprintf(stderr, "%s", "hello")
}
Correct Answer

(B) hello

[#213] Which of the following function can be used to terminate the main function from another function safely?
Correct Answer

(B) exit(expr)

[#214] What will be the output of the following C code? #include <stdio.h>
int f(char chr, ...)
int main()
{
char c = 97
f(c)
return 0
}
int f(char c, ...)
{
printf("%c
", c)
}
Correct Answer

(D) a

[#215] What will be the output of the following C code? #include <stdio.h>
#include <string.h>
int main()
{
char line[3]
fgets(line, 3, stdin)
printf("%d
", strlen(line))
return 0
}
Correct Answer

(B) 1