Question 1 of 25
Hints left: 3
Q1
How do you check if a file exists in C++ before opening it?
Q2
In C++, how do you check if a file has reached the end while reading?
Q3
Which file mode in C++ opens a file for reading and writing, and truncates it to zero length if it exists?
Q4
How do you delete a file in C++?
Q5
Which function is used to rewind the file pointer to the beginning of the file in C++?
Q6
Which of the following is not used as a file opening mode?
Q7
Which function is used to set the position of the file pointer in C++ file handling?
Q8
What is the purpose of the ios::binary flag in C++ file handling?
Q9
By default, all the files in C++ are opened in . . . . . . . . mode.
Q10
In C++, how do you check if a file operation has reached the end of the file?
Q11
Which function is used to check if a file is open or not in C++?
Q12
What is the difference between fstream and ofstream in C++?
Q13
What happens if you try to open a file that does not exist in C++ without specifying any flags?
Q14
What is the purpose of the ios::ate flag in C++ file handling?
Q15
Which function is used to set the file position in C++ file handling?
Q16
Which header file is required to use file I/O operations?
Q17
Which function is used to return the current file pointer position in C++?
Q18
Which file mode in C++ opens a file for reading and writing without truncating it if it exists?
Q19
Which of the following is used to close a file in C++?
Q20
What is the function used to read a single character from a file in C++?
Q21
What is the purpose of the ios::trunc flag in C++ file handling?
Q22
Which function is used to reposition the file pointer?
Q23
Which function is used to read a line from a file in C++?
Q24
Which of the following is not a valid file mode in C++?
Q25
How do you check if a file operation in C++ has encountered an error?