Search Header Logo

C++ Files Review

Authored by Ferhat Travaci

Computers

9th - 12th Grade

Used 3+ times

C++ Files Review
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which C++ library allows us to work with files?

filestreams

fstream

string

vector

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class from the fstream library is used to create and write to files?

ifstream

ofstream

fstream

filemanager

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the following code. What will it do?

Reads from filename.txt

Creates a file but does not write anything

Creates a file named filename.txt and writes 'Writing to a file.' into it

Outputs 'Writing to a file.' on the console

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class would you use to read from a file in C++?

ofstream

fstream

ifstream

filemanager

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider the following code. What does it do?

Reads the content of filename.txt and prints it on console

Writes 'filename.txt' to the console

Creates a file called filename.txt

Deletes filename.txt

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of the ifstream class in C++?

To write data to files

To read data from files

To delete files

To manage file permissions

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to open a file for reading in C++?

ofstream file('example.txt');

ifstream file('example.txt');

fstream file('example.txt', ios::out);

filemanager file('example.txt');

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?