250+ TOP MCQs on File Access and Answers

C programming Objective Questions on “File Access”. One shall practice these Objective Questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C programming Objective Questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C programming Objective Questions on “File Access” along with answers, explanations and/or solutions:

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
Answer: a
Clarification: None.

2. For binary files, a ___ must be appended to the mode string.
a) Nothing
b) “b”
c) “binary”
d) “01”
Answer: b
Clarification: 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
Answer: c
Clarification: 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

Answer: b
Clarification: 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
Answer: d
Clarification: None.

6. In C language, FILE is of which data type?
a) int
b) char *
c) struct
d) None of the mentioned
Answer: c
Clarification: 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
Answer: b
Clarification: None.

8. Which of the following mode argument is used to truncate?
a) a
b) f
c) w
d) t
Answer: c
Clarification: None.

9. Which type of files can’t be opened using fopen()?
a) .txt
b) .bin
c) .c
d) none of the mentioned
Answer: d
Clarification: None.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top