Vidyalelo
C++ Programming · all questions

File Handling in C++
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

56

Questions

1/3

Page

Pick an option on a question to see the right answer and solution.

Which header file is required for file handling in C++?

Select an option to see the answer and solution.

What is the function used to open a file in C++?

Select an option to see the answer and solution.

How do you close a file in C++?

Select an option to see the answer and solution.

Which mode is used to open a file for writing in C++?

Select an option to see the answer and solution.

What is the correct syntax for writing data to a file in C++?

Select an option to see the answer and solution.

How do you check if a file has been successfully opened in C++?

Select an option to see the answer and solution.

Which of the following is used to read data from a file in C++?

Select an option to see the answer and solution.

What does the seekg() function do in C++ file handling?

Select an option to see the answer and solution.

Which function is used to delete a file in C++?

Select an option to see the answer and solution.

Which file mode is used to open a file for reading and writing in C++?

Select an option to see the answer and solution.

How do you check if the end of a file has been reached in C++?

Select an option to see the answer and solution.

Which function is used to get the current position of the file pointer in C++?

Select an option to see the answer and solution.

What is the purpose of the ios::app flag in C++ file handling?

Select an option to see the answer and solution.

Which function is used to check if a file exists in C++?

Select an option to see the answer and solution.

How do you create a new file in C++?

Select an option to see the answer and solution.

What is the function used to create a new file in C++?

Select an option to see the answer and solution.

Which file mode is used to open a file for reading only in C++?

Select an option to see the answer and solution.

How do you check if a file exists before opening it in C++?

Select an option to see the answer and solution.

Which of the following is not a file stream class in C++?

Select an option to see the answer and solution.

What is the function used to write data to a file in C++?

Select an option to see the answer and solution.