C++ File Handling Questions Answers
-
8. What is use of eof() ?
- Returns true if a file open for reading has reached the next character.
- Returns true if a file open for reading has reached the next word.
- Returns true if a file open for reading has reached the end.
- Returns true if a file open for reading has reached the middle.
Answer And Explanation
Answer: Option C
-
9. Which functions allow to change the location of the get and put positions ?
- sg() and sp()
- sekg() and sekp()
- gog() and gop()
- seekg() and seekp()
Answer And Explanation
Answer: Option D
-
10. offset counted from the current position using ?
- ios::curr
- ios::cr
- ios::cur
- ios::current
Answer And Explanation
Answer: Option C
-
11. Calling the stream's member function sync() causes an immediate synchronization.
- True
- False
Answer And Explanation
Answer: Option A
-
12. Which among is used for positioning relative to the beginning of a stream ?
- ios::start
- ios::beg
- ios::begin
- ios::beginning
Answer And Explanation
Answer: Option B
-
13. Which is among following is used to Open a file for output and move the read/write control to the end of the file ?
- ios::ate
- ios::at
- ios::ann
- ios::end
Answer And Explanation
Answer: Option A
-
14. Which is correct syntax for, position n bytes back from end of fileObject ?
- fileObject.seekg(ios::end, n);
- fileObject.seekg(n, ios:end );
- fileObject.seekg(n, ios::end );
- fileObject.seekg(ios:end, n);
Answer And Explanation
Answer: Option C