MCQ - File Handling in C++ Programming

15. 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

16.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

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

B. Null
C. Runtime error
D. Compiler dependent

View Answer

18.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

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

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

View Answer

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

A. Yes

View Answer

21.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

Also check :


* You must be logged in to add comment.