21. 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\n", strlen(line));
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
char line[3];
fgets(line, 3, stdin);
printf("%d\n", strlen(line));
return 0;
}
22. What will be the output of the following C code?
char str[] =”Good”;
scanf(“%s”, str);
char str[] =”Good”;
scanf(“%s”, str);
23. What type of return-type used in String operations?
24. The function . . . . . . . . obtains a block of memory dynamically.
25. What happens when we use the following C statement?
26. What will be the output of the following C code?
#include <stdio.h>
int main()
{
FILE *fp = stdout;
int n;
fprintf(fp, "%d ", 45);
fflush(stdout);
fprintf(stderr, "%d", 65);
return 0;
}
#include <stdio.h>
int main()
{
FILE *fp = stdout;
int n;
fprintf(fp, "%d ", 45);
fflush(stdout);
fprintf(stderr, "%d", 65);
return 0;
}
27. What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
#include <stdio.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
28. Explain the format string "%5d%s %c"
29. What is the difference between %e and %g?
30. Strcat() function adds null character.
Read More Section(File Input Output)
Each Section contains maximum 100 MCQs question on File Input Output. To get more questions visit other sections.