
C++ Files Review

Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Ferhat Travaci
Used 3+ times
FREE Resource
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
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
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');
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If the input.txt file has the following numbers:
123 245 58 187 231 456 217
what will be the written into the output.txt file after the execution of the following program?
123 187 231 217
123 245 187 231 217
245 58 456
58 456
Similar Resources on Wayground
10 questions
Files and Directories

Quiz
•
9th Grade
10 questions
perintah dasar linux 1

Quiz
•
11th Grade
10 questions
File Handling

Quiz
•
12th Grade
13 questions
Raspberry Pi OS Terminal Quiz

Quiz
•
9th Grade
10 questions
G10 CS File Handling

Quiz
•
12th Grade
10 questions
File Management: File Types

Quiz
•
8th - 9th Grade
10 questions
Python Basic files

Quiz
•
10th - 12th Grade
10 questions
File Type Extensions

Quiz
•
8th Grade - University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade
Discover more resources for Computers
50 questions
Trivia 7/25

Quiz
•
12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade
6 questions
RL.10.1 Cite Evidence

Quiz
•
10th Grade
10 questions
Characteristics of Life

Quiz
•
9th - 10th Grade
14 questions
Algebra 1 SOL Review #1

Quiz
•
9th Grade