12.
What is the purpose of the C function?
int ferror(FILE *fp)

13.
What if size is zero in the following C statement?
realloc(ptr, size)

14.
Select the right explanation to the given code.
printf(“%*. *f”, 5,4,5700);

15.
Which of the following should be used for freeing the memory allocated in the following C code?
#include <stdio.h>
struct p
{
    struct p *next;
    int x;
};
int main()
{
    struct p *p1 = (struct p*)malloc(sizeof(struct p));
    p1->x = 1;
    p1->next = (struct p*)malloc(sizeof(struct p));
    return 0;
}

free(p1);
free(p1->next)

free(p1->next);
free(p1);

free(p1);

17.
What will be the output of the following C code?
#include <stdio.h>
struct p
{
    struct p *next;
    int x;
};
int main()
{
    struct p *p1 = calloc(1, sizeof(struct p));
    p1->x = 1;
    p1->next = calloc(1, sizeof(struct p));
    printf("%d\n", p1->next->x);
    return 0;
}

19.
How many characters for pushback is guaranteed per file while using ungetc(c, fp);?

Read More Section(File Input Output)

Each Section contains maximum 100 MCQs question on File Input Output. To get more questions visit other sections.