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-1 MCQs

C File Management-1


1. Which of the following true about FILE *fp

a) FILE is a keyword in C for representing files and fp is a variable of FILE type
b) FILE is a stream
c) FILE is a buffered stream
d) FILE is a structure and fp is a pointer to the structure of FILE type



2. Which of the following mode argument is used to truncate?

a) a
b) w
c) f
d) t



3. The first and second arguments of fopen() are

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 pointer & the second argument is the mode
d) None of the mentioned



4. FILE is of type ______

a) int type
b) char * type
c) struct type
d) None of the mentioned



5. A data of the file is stored in _______

a) Ram
b) Hard disk
c) Rom
d) None



6. fseek() should be preferred over rewind() mainly because

a) rewind() doesn't work for empty files
b) rewind() may fail for large files
c) In rewind, there is no way to check if the operations completed successfully
d) All of the above



7. FILE reserved word is _______

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



8. For binary files, a ___ must be appended to the mode string.

a) "b"
b) "B"
c) "binary"
d) "01"



9. What is the function of the mode ‘ w+’?

a) create text file for writing, discard previous contents if any
b) create text file for update, discard previous contents if any
c) create text file for writing, do not discard previous contents if any
d) create text file for update, do not discard previous contents if any



10. Which of the following statements about stdout and stderr are true?

a) Same
b) Both connected to screen always
c) Both connected to screen by default
d) stdout is line buffered but stderr is unbuffered



- Related Topics