Here is a listing of C programming interview questions on “File Access” along with answers, explanations and/or solutions:
1. 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 poniter & the second argument is the mode.
d) None of the mentioned of the mentioned
View Answer
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
View Answer
Answer:a
2. For binary files, a ___ must be appended to the mode string.
a) Nothing
b) “b”
c) “binary”
d) “01″
View Answer
a) Nothing
b) “b”
c) “binary”
d) “01″
View Answer
Answer:b
3. If there is any error while opening a file, fopen will return
a) Nothing
b) EOF
c) NULL
d) Depends on compiler
View Answer
a) Nothing
b) EOF
c) NULL
d) Depends on compiler
View Answer
Answer:c
4. Which is true about getc.getc returns?
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.
View Answer
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.
View Answer
Answer:c
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 menitoned
View Answer
a) Standard input
b) Standard output
c) Standard error
d) All of the menitoned
View Answer
Answer:d
6. FILE is of type ______ ?
a) int type
b) char * type
c) struct type
d) None of the mentioned
View Answer
a) int type
b) char * type
c) struct type
d) None of the mentioned
View Answer
Answer:c
7. What is the meant by ‘a’ in the following operation?
fp = fopen(“Random.txt”, “a”);
a) Attach
b) Append
c) Apprehend
d) Add
View Answer
fp = fopen(“Random.txt”, “a”);
a) Attach
b) Append
c) Apprehend
d) Add
View Answer
Answer:b
8. Which of the following mode argument is used to truncate?
a) a
b) f
c) w
d) t
View Answer
a) a
b) f
c) w
d) t
View Answer
Answer:c
9. Which type of files can’t be opened using fopen()?
a) .txt
b) .bin
c) .c
d) None of the mentioned
View Answer
a) .txt
b) .bin
c) .c
d) None of the mentioned
View Answer
Answer:d
www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community
No comments:
Post a Comment