
C++ fstream Library Quiz
Authored by Anonymous Anonymous
Engineering
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the base class for ifstream, fstream, and ofstream?
filebuf
fstreambase
iostream
streambuf
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which function in C/C++ checks if the end-of-file indicator is set for a given stream?
ios::eof()
feof()
getc()
getchar()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the "wb" file mode in C/C++ do?
Opens a file for reading in binary mode.
Opens a file for writing in binary mode, truncating its contents if it exists.
Opens a file for appending in binary mode.
Opens a file for exclusive creation in binary mode.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which mode flag is used to open a file for reading in C++?
ios::out
ios::in
ios::app
ios::trunc
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the `ifstream` object in the given code example?
To write data to a file
To read data from a file
To delete a file
To create a new file
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the given code if the file "example.txt" contains the text "Hello, File I/O!" and "This is a new line."?
Hello, File I/O! This is a new line.
Error opening file!
File successfully read.
No output is displayed.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value assigned to the variable `j` in the code?
6.02
'x'
77
"File Handling"
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?