C++ File Handling Questions Answers
-
15. How to find the position at end of fileObject ?
- fileObject.seekg( 0, ios::end );
- fileObject.seekg( 0, ios::end );
- fileObject.seekg( 0, ios::end );
- fileObject.seekg( 0, ios::end );
Answer And Explanation
Answer: Option A
-
16. How to get position n bytes forward in fileObject ?
- fileObject.seekg( ios::cur, n );
- fileObject.seekg( n, ios:cur );
- fileObject.seekg( n, ios::cur );
- fileObject.seekg( ios:cur, n );
Answer And Explanation
Answer: Option C
-
17. How to get position to the nth byte of fileObject ?
- fileObject.seekg( 'filename',n );
- fileObject.seekg( n, 'filename' );
- fileObject.seekg( n );
- fileObject.seekg( n, ios::app );
Answer And Explanation
Answer: Option C
-
18. eof() is used to get
- easy code reivew
- end of file
- debug report
- file close
Answer And Explanation
Answer: Option B