Loading...

C Multiple Choice Questions

Our C questions and answers focuses on all areas of C programming language covering 100+ topics in C

C File Management-3 MCQs

C File Management-3


1. Which is data type of file pointer is _______

a) int
b) double
c) void
d) File



2. When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?

a) Standard input
b) Standard output
c) Standard error
d) All of the above



3. If there is any error while opening a file, fopen will return?

a) Nothing
b) EOF
c) NULL
d) Depends on compiler



4. It is not possible to combine two or more file opening mode in open () method.

a) TRUE
b) FALSE



5. What is the return value of putchar()?

a) The character written
b) EOF if an error occurs
c) Nothing
d) Both character written & EOF if an error occurs



6. What is the purpose of "rb" in fopen() function used below in the code?
 FILE *fp; fp = fopen("demo.txt", "rb");

a) Open "demo.txt" in binary mode for reading
b) Create a new file "demo.txt" for reading and writing
c) Open "demo.txt" in binary mode for reading and writing
d) None of the above



7. getc() returns EOF when

a) When getc() fail to read the character
b) When end of file is reached
c) Both A and B
d) None of the above



8. If the mode includes b after the initial letter, what does it indicates?

a) text file
b) big text file
c) binary file
d) blueprint text



9. fflush(NULL) flushes all ____________

a) input streams
b) output streams
c) previous contents
d) appended text



10. _____removes the named file, so that a subsequent attempt to open it will fail.

a) remove(const *filename)
b) remove(filename)
c) remove()
d) fclose(filename)



- Related Topics