File Input Output - Study Mode
[#246] What is the output of the following C code if there is no error in stream fp? #include <stdio.h>
int main()
{
FILE *fp
fp = fopen("newfile", "w")
printf("%d
", ferror(fp))
return 0
}
Correct Answer
(B) 0
[#247] Which of the following is used during memory deallocation in C?
Correct Answer
(C) free(p)
[#248] In the following C program, every time program is run different numbers are generated. #include <stdio.h>
int main()
{
srand(time(NULL))
printf("%d
", rand())
return 0
}
Correct Answer
(A) True
[#249] What will be the output of the following C code if 2 characters is typed by the user? #include <stdio.h>
#include <string.h>
int main()
{
char line[3]
fgets(line, 3, stdin)
printf("%d
", line[2])
return 0
}
Correct Answer
(C) 0
[#250] What will be the output of the following C code? char str[] =”Too Good”
printf(“
%7s”,str)
Correct Answer
(A) Too Good