This set of C Multiple Choice Questions & Answers (MCQs) focuses on “File Access – 1”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What are the first and second arguments of fopen?
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
View Answer
Explanation: None.
2. For binary files, a ___ must be appended to the mode string.
a) Nothing
b) “b”
c) “binary”
d) “01”
View Answer
Explanation: None.
3. What will fopen will return, if there is any error while opening a file?
a) Nothing
b) EOF
c) NULL
d) Depends on compiler
View Answer
Explanation: None.
4. What is the return value of getc()?
a) The next character from the stream is not referred by file pointer
b) EOF for end of file or error
c) Nothing
d) None of the mentioned
View Answer
Explanation: None.
5. 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 mentioned
View Answer
Explanation: None.
6. In C language, FILE is of which data type?
a) int
b) char *
c) struct
d) None of the mentioned
View Answer
Explanation: None.
7. What is meant by ‘a’ in the following C operation?
fp = fopen("Random.txt", "a");
a) Attach
b) Append
c) Apprehend
d) Add
View Answer
Explanation: None.
8. Which of the following mode argument is used to truncate?
a) a
b) f
c) w
d) t
View Answer
Explanation: None.
9. Which type of files can’t be opened using fopen()?
a) .txt
b) .bin
c) .c
d) none of the mentioned
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Watch Advanced C Programming Videos
- Apply for Computer Science Internship
- Practice BCA MCQs
- Check C Books
- Apply for C Internship