21.
Identify X library function for line input and output in the following C code?
#include <stdio.h>
int X(char *s, FILE *iop)
{
    int c;
    while (c = *s++)
    putc(c, iop);
    return ferror(iop) ? EOF : 0;
}

23.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char n[20];
    fgets(n, 19, stdin);
    ungetc(n[0], stdin);
    scanf("%s", n);
    printf("%s\n", n);
    return 0;
}

25.
What will be the output of the following C code?
#include <stdio.h>
#include <stdarg.h>
void func(int, ...);
int main()
{
    func(2, 3, 5, 7, 11, 13);
    return 0;
}
void func(int n, ...)
{
    int number, i = 0;
    va_list start;
    va_start(start, n);
    while (i != 3)
    {
        number = va_arg(start, int);
        i++;
    }
    printf("%d", number);
}

26.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char n[] = "hello\nworld!";
    char s[13];
    sscanf(n, "%s", s);
    printf("%s\n", s);
    return 0;
}

27.
What will be the output of the following C code?
#include <stdio.h>
#include <ctype.h>
int main()
{
    int i = 32;
    if (isspace(i))
        printf("space\n");
    else
        printf("not space\n");
        return 0;
}

28.
What will be the output of the following C code?
#include <stdio.h>
#include <stdarg.h>
int f(int c, ...);
int main()
{
    int c = 97;
    float d = 98;
    f(c, d);
    return 0;
}
int f(int c, ...)
{
    va_list li;
    va_start(li, c);
    float d = va_arg(li, float);
    printf("%f\n", d);
    va_end(li);
}

30.
Which is true about isalnum(c), where c is an int that can be represented as an unsigned?
char or EOF.isalnum(c) returns

Read More Section(File Input Output)

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