C++ FILE HANDLING

C++ FILE HANDLING

University

11 Qs

quiz-placeholder

Similar activities

Quiz de Linguagem C

Quiz de Linguagem C

University

10 Qs

OS QUIZ

OS QUIZ

University

15 Qs

FTP & Port No

FTP & Port No

University

15 Qs

Data Compression

Data Compression

9th Grade - University

12 Qs

Flujos en Java/Android

Flujos en Java/Android

12th Grade - University

10 Qs

Archivos en JAVA

Archivos en JAVA

University

12 Qs

Quiz # 1 for Midterm Period

Quiz # 1 for Midterm Period

University

12 Qs

SDF_ˇBX_December24

SDF_ˇBX_December24

University

11 Qs

C++ FILE HANDLING

C++ FILE HANDLING

Assessment

Quiz

Computers

University

Medium

Created by

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

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?