--:--









Quiz for File streams fstream

Course: C++ Language | Subject: Unit 12 | Topic: File Handling



Logo

Q1: Which class allows both reading and writing to files?

Logo

Q2: Which header file must be included to use fstream?

Logo

Q3: How do you open a file named "data.txt" for both reading and writing using fstream?

Logo

Q4: What mode should be used to append data when opening a file with fstream?

Logo

Q5: Which function is used to check if the file stream is open?

Logo

Q6: What happens if you open an existing file with ios::trunc flag?

Logo

Q7: Which operator is used to write data to a file with fstream?

Logo

Q8: Which operator is used to read data from a file with fstream?

Logo

Q9: How to close a file stream object?

Logo

Q10: Which method flushes the output buffer to the file?

Logo

Q11: How to reposition the file pointer to the beginning?

Logo

Q12: How to reposition the write pointer to the beginning?

Logo

Q13: What does ios::binary mode mean when opening files?

Logo

Q14: Can fstream be used to read from and write to the same file simultaneously?

Logo

Q15: Which of the following is NOT a valid open mode flag?

Logo

Q16: What is the default mode when opening fstream without specifying flags?

Logo

Q17: How to enable exceptions for a file stream?

Logo

Q18: Which function returns the current position of the get pointer?

Logo

Q19: Which function returns the current position of the put pointer?

Are you ready to start test? Set your time limit