2.
What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
int main()
{
    char *str = "hello, world";
    char *str1 = "hello, world";
    if (strcmp(str, str1))
        printf("equal");
    else
        printf("unequal");
}

3.
What is the function of FILE *tmpfile(void)?

5.
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int n;
    scanf("%d", n);
    printf("%d\n", n);
    return 0;
}

8.
What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
int main()
{
    char *str = "hello, world";
    char str1[9];
    strncpy(str1, str, 9);
    printf("%s %d", str1, strlen(str1));
}

9.
What will be the output of the following C code if following commands are used to run and if myfile does not exist?
gcc -o test test.c
./test > myfile

#include <stdio.h>
int main(int argc, char **argv)
{
    char c = 'd';
    putchar(c);
    printf(" %d\n", argc);
}

Read More Section(File Input Output)

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