File I/O


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    FILE *fp = stdout;
    int m;
    fprintf(fp, "%d ", 55);
    fflush(stdout);
    fprintf(stderr, "%d", 85);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    55 85


  1. What does the following segment of C code do?
    fprintf(fp, "Interview Mania!");











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    It writes “Interview Mania!” into the file pointed by fp



  1. What is FILE reserved word?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    It is a type name defined in stdio.h


  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    FILE *fp = stdin;
    int num;
    fprintf(fp, "%d", 55);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Nothing



  1. What will be the output of the following C code?
    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    FILE *fp = stdout;
    int num;
    fprintf(fp, "%d", 102);
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    102