C++ FILE HANDLING

Quiz
•
Computers
•
University
•
Medium

Hannah G
Used 31+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Tes Awal AlPro Modul 6

Quiz
•
University
15 questions
QUIZ-5: MYSQL & File Handling

Quiz
•
University
10 questions
Programming in C

Quiz
•
University
15 questions
File Handling in C Programming Quiz

Quiz
•
University
14 questions
MATLAB Files and File Management

Quiz
•
University
10 questions
Web Quizizz 29

Quiz
•
10th Grade - University
10 questions
Cybersecurity Fundamentals Week 4 Quiz

Quiz
•
KG - University
10 questions
JAVA III

Quiz
•
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