
Mastering File Handling in C
Authored by Dean CSE
Education
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following file modes is used to open a file for reading only in C?
`"w"`
`"a"`
`"r"`
`"rw"`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the file mode `"w"` do when used with `fopen()` in C?
Opens a file for reading only
Opens a file for writing, creating it if it doesn't exist and truncating it if it does
Opens a file for appending data at the end
Opens a file for both reading and writing without truncating
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which function is used to open a file in C?
`openfile()`
`fileopen()`
`fopen()`
`open()`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the return type of the `fopen()` function in C?
`int`
`char`
`void`
`FILE *`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following functions is used to read a single character from a file in C?
`fscanf()`
`fgetc()`
`fread()`
`fgets()`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What value does `fopen()` return if it fails to open a file?
`0`
`-1`
`NULL`
`EOF`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which file mode should be used to add data to the end of an existing file without deleting its current contents?
`"w"`
`"r+"`
`"a"`
`"w+"`
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 Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?