Which function is used to read a line from a file in C++?
A. getline()
B. readLine()
C. file.getLine()
D. file.readline()
Select an option to see the answer and solution.
By default, all the files in C++ are opened in . . . . . . . . mode.
A. Text
B. Binary
C. ISCII
D. VTC
Select an option to see the answer and solution.
Which header file is required to use file I/O operations?
A. <ifstream>
B. <ostream>
C. <fstream>
D. <iostream>
Select an option to see the answer and solution.
Which function is used to reposition the file pointer?
A. moveg()
B. seekg()
C. changep()
D. go_p()
Select an option to see the answer and solution.
Which of the following is not used as a file opening mode?
A. ios::trunc
B. ios::binary
C. ios::in
D. ios::ate
Select an option to see the answer and solution.
Which of the following is used to create an output stream?
A. ofstream
B. ifstream
C. iostream
D. fsstream
Select an option to see the answer and solution.
What is the use of ios::trunc mode?
A. To open a file in input mode
B. To open a file in output mode
C. To truncate an existing file to half
D. To truncate an existing file to zero
Select an option to see the answer and solution.
Which of the following is not used to seek file pointer?
A. ios::set
B. ios::end
C. ios::cur
D. ios::beg
Select an option to see the answer and solution.
Which of the following is the default mode of the opening using the ifstream class?
A. ios::in
B. ios::out
C. ios::app
D. ios::trunc
Select an option to see the answer and solution.
Which of the following is used to create a stream that performs both input and output operations?
A. ofstream
B. ifstream
C. iostream
D. fstream
Select an option to see the answer and solution.
Which of the following is used to move the file pointer to start of a file?
A. ios::beg
B. ios::start
C. ios::cur
D. ios::first
Select an option to see the answer and solution.
Which of the following statements are correct?
1. It is not possible to combine two or more file opening mode in open() method.
2. It is possible to combine two or more file opening mode in open() method.
3. ios::in and ios::out are input and output file opening mode respectively.
A. 1, 3
B. 2, 3
C. 3 only
D. 1, 2
Select an option to see the answer and solution.
What is the return type open() method?
Select an option to see the answer and solution.
Which of the following is the default mode of the opening using the ofstream class?
A. ios::in
B. ios::out
C. ios::app
D. ios::trunc
Select an option to see the answer and solution.
Which function is used in C++ to get the current position of file pointer in a file?
A. tell_p()
B. get_pos()
C. get_p()
D. tell_pos()
Select an option to see the answer and solution.
Which of the following is the default mode of the opening using the fstream class?
A. ios::in
B. ios::out
C. ios::in|ios::out
D. ios::trunc
Select an option to see the answer and solution.