
C++ FILE HANDLING
Authored by Hannah G
Computers
University
Used 32+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
char buffer[100];
FILE *p1, *p2;
p1 = fopen("myfile.txt", "w");
p2 = fopen("myfile2.txt", "a");
fputs("Buffered stream", p1);
fflush(p1);
setbuf(p2, NULL);
fputs("Unbuffered stream", p2);
fclose(p1);
fclose(p2);
What is the output in myfile.txt?
Error
Buffered stream
Unbuffered stream
Buffered and unbuffered stream
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
char buffer[100];
FILE *p1, *p2;
p1 = fopen("myfile.txt", "w");
p2 = fopen("myfile2.txt", "a");
fputs("Buffered stream", p1);
fflush(p1);
setbuf(p2, NULL);
fputs("Unbuffered stream", p2);
fclose(p1);
fclose(p2);
What is the output in myfile2.txt?
Error
Buffered stream
Unbuffered stream
Buffered and unbuffered stream
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
It writes a string (which need not contain a newline) to a file. It returns EOF if an error occurs, and a non-negative error otherwise.
fputc
fgetc
fputs
fopen
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
It writes the character c to the file and returns the character written or EOF if an error occurs.
fopen
fputc
fgetc
fgets
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
It points to a structure that contains things about the file
file pointer
file handling
node pointer
file structure
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When fopen() is not able to open a file, it returns ________
EOF
NULL
runtime error
compiler dependent
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following is true about FILE *fp; ?
FILE is a stream
FILE is a keyword in C for representing files and fp is a variable of FILE type
FILE is a structure and fp is a pointer to the structure of FILE type
FILE is a buffered stream
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?
Similar Resources on Wayground
15 questions
Pengantar Teknologi Informasi 3
Quiz
•
University
15 questions
RLNVSP - Buổi 1 - Ôn tập
Quiz
•
University
14 questions
CompTIA A+ U6
Quiz
•
9th Grade - Professio...
10 questions
GODOT ENGINE
Quiz
•
University
10 questions
Clase 1 TM Scilab
Quiz
•
University
13 questions
MULTIMEDIA ANIMATION
Quiz
•
University
10 questions
Quiz CodeIgniter 4
Quiz
•
University
15 questions
Шаблоны проектирования
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University