31. What is the size of array "line" used in fgets(line, maxline, *fp) function?
32. What will be the output of the following C statement?
int ungetc(int c, FILE *fp)
int ungetc(int c, FILE *fp)
33. In the below C program, every time program is run different numbers are generated.
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%d\n", rand());
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("%d\n", rand());
return 0;
}
34. What does the ungetc function return for the following C expression?
ungetc(c, fp);//where declarations are int c and FILE *fp
ungetc(c, fp);//where declarations are int c and FILE *fp
35. If the user enters 1 3.2 s, what value will be returned by the scanf()?
scanf("%d %f %c", &s1, &s2, &s3);
scanf("%d %f %c", &s1, &s2, &s3);
36. Why do we write (int *) before malloc?
int *ip = (int *)malloc(sizeof(int));
int *ip = (int *)malloc(sizeof(int));
37. What type of inputs are accepted by mathematical functions?
38. What will be the output of the following C code?
#include <stdio.h>
int main()
{
FILE *fp;
char c;
int n = 0;
fp = fopen("newfile1.txt", "r");
while (!feof(fp))
{
c = getc(fp);
putc(c, stdout);
}
}
#include <stdio.h>
int main()
{
FILE *fp;
char c;
int n = 0;
fp = fopen("newfile1.txt", "r");
while (!feof(fp))
{
c = getc(fp);
putc(c, stdout);
}
}
39. What will be the output for the given code.
printf("\n The number is %07d",1212);
printf("\n The number is %07d",1212);
40. Which of the following will return a result most quickly for searching a given key?
Read More Section(File Input Output)
Each Section contains maximum 100 MCQs question on File Input Output. To get more questions visit other sections.