File Handling in C++ – MCQs

30 Score: 0 Attempted: 0/30 Subscribe
1. : What header file is used for file handling in C++?

3. : Which class is used to read from a file in C++?





4. : Which class allows both reading and writing to a file in C++?





5. : What function is used to open a file?





6. : Which function checks whether a file is open?





7. : Which mode opens a file for reading only?





8. : Which mode opens a file for appending data at the end?





9. : Which mode truncates the file to zero length if it exists?





10. : Which mode is used for binary file operations?





11. : What is the default mode for ofstream?





12. : What happens if a file cannot be opened?





13. : What function is used to write to a file?





14. : What function is used to read from a file?

16. : What is the full form of EOF?





17. : What does getline() do?





18. : Which function closes a file?





19. : Which stream is used for both input and output?





20. : What happens if you try to read from a file that does not exist?





21. : What happens if you write to a file opened in ios::in mode?





22. : Which operator is overloaded in C++ for file I/O?





23. : Which data type is used for file pointers in C++?





24. : What is the purpose of seekg()?





25. : What does tellg() return?





26. : What is the default file mode for ifstream?





27. : What happens when ofstream opens a file that already exists?





28. : Which function is used to skip whitespaces while reading?





29. : Which file mode ensures the file is not deleted when opened?





30. : Which C++ stream handles errors related to file I/O?





Leave a Comment

All copyrights Reserved by MCQsAnswers.com - Powered By T4Tutorials