Home / CSE MCQs / C-MCQs :: File Access

CSE MCQs :: C-MCQs

  1. The first and second arguments of fopen are?
  2. A.
    A character string containing the name of the file & the second argument is the mode.
    B.
    A character string containing the name of the user & the second argument is the mode.
    C.
    A character string containing file poniter & the second argument is the mode.
    D.
    None of the mentioned of the mentioned.

  3. If there is any error while opening a file, fopen will return?
  4. A.
    Nothing
    B.
    EOF
    C.
    NULL
    D.
    Depends on compiler

  5. Which is true about getc.getc returns?
  6. A.
    The next character from the stream referred to by file pointer
    B.
    EOF for end of file or error
    C.
    Both a & b
    D.
    Nothing

  7. When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?
  8. A.
    Standard input
    B.
    Standard output
    C.
    Standard error
    D.
    All of the mentioned

  9. What is the meant by 'a' in the following operation?
    fp = fopen("Random.txt, "a);
  10. A.
    Attach
    B.
    Append
    C.
    Apprehend
    D.
    Add

  11. Which of the following mode argument is used to truncate?
  12. A.
    a
    B.
    f
    C.
    w
    D.
    t

  13. Which type of files can't be opened using fopen()?
  14. A.
    .txt
    B.
    .bin
    C.
    .c
    D.
    None of the mentioned

  15. Which of the following fopen statements are illegal?
  16. A.
    fp = fopen(abc.txt", r");
    B.
    fp = fopen(/home/user1/abc.txt", w");
    C.
    fp = fopen(abc", w");
    D.
    None of the mentioned.

  17. FILE reserved word is?
  18. A.
    A structure tag declared in stdio.h
    B.
    One of the basic datatypes in c
    C.
    Pointer to the structure defined in stdio.h
    D.
    It is a type name defined in stdio.h

  19. stdout, stdin and stderr are?
  20. A.
    File pointer
    B.
    File desciptors
    C.
    Streams
    D.
    Structure