MCQ - File Handling in C++ Programming

21. If we have object from ofstream class, then default mode of opening the file is _____

A. ios::in
B. ios::out
C. ios::in|ios::trunc
D. ios::out|ios::trunk

View Answer


22. Which is correct syntax for, position n bytes back from end of fileObject ?

A. FileObject.seekg(ios::end, n);
B. FileObject.seekg(n, ios:end );
C. FileObject.seekg(n, ios::end );
D. FileObject.seekg(ios:end, n);

View Answer


23. When fopen() is not able to open a file, it returns

A. EOF
B. Null
C. Runtime error
D. Compiler dependent

View Answer


24. By default, all the files are opened in which of the following mode?

A. Binary Mode
B. Text Mode
C. Sequential Mode
D. Both A and B

View Answer


25. How many objects are used for input and output to a string?

A. 1
B. 2
C. 3
D. 4

View Answer


26. Calling the stream's member function sync() causes an immediate synchronization.

A. Yes
B. NO
C. May Be
D. Can't Say

View Answer


27. Which of the following is not used to seek a file pointer?

A. ios::cur
B. ios::beg
C. ios::end
D. ios::set

View Answer


28. fseek() should be preferred over rewind() mainly because

A. In rewind, there is no way to check if the operations completed successfully
B. rewind() doesn't work for empty files
C. rewind() does work for empty file
D. All of the above

View Answer


29. Which function is used to position back from the end of file object?

A. Seekg
B. Seekp
C. Both seekg & seekp
D. None of the above

View Answer





Also check :


Discussion


* You must be logged in to add comment.