File Handling C++

File Handling C++

University

13 Qs

quiz-placeholder

Similar activities

php file handling

php file handling

University

10 Qs

Simdig

Simdig

12th Grade - University

10 Qs

SLR05.3 Open or Closed?

SLR05.3 Open or Closed?

9th Grade - University

16 Qs

File Handling in Python, Serialization in Python

File Handling in Python, Serialization in Python

University

15 Qs

File Systems

File Systems

University

14 Qs

ASP. NET QUIZ_1

ASP. NET QUIZ_1

University

10 Qs

ArchivosBinarios

ArchivosBinarios

University

10 Qs

Quiz MS. Word 2023

Quiz MS. Word 2023

University

10 Qs

File Handling C++

File Handling C++

Assessment

Quiz

Computers

University

Medium

Created by

Long Trần

Used 4+ times

FREE Resource

13 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class is used for reading data from a file in C++?

`ofstream`

`ifstream`

`fstream`

`iostream`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following classes can be used for both reading and writing to a file in C++?

`ifstream`

`ofstream`

`fstream`

`istream`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the `ofstream` class in C++?

To handle standard input

To handle standard output

To write data to a file

To read data from a file

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the first step in handling files in C++?

Closing the file

Writing to the file

Reading the file

Opening the file

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which function is used to close a file in C++ after performing file operations?

`close()`

`exit()`

`closefile()`

`end()`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you open a file for both reading and writing in C++?

By using an `ifstream` object

By using an `ofstream` object

By using an `fstream` object

By using an `iostream` object

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to write data to a file in C++?

>>

> operator

Using `ifstream` with `getline()`

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?