Programming for Problem Solving (3110003) MCQs

MCQs of File management

Showing 11 to 17 out of 17 Questions
11.
Select a function which is used to write a string to a file______
(a) pits()
(b) putc()
(c) fputs()
(d) fgets()
Answer:

Option (c)

12.
fflush(NULL) flushes all ________
(a) input streams
(b) output streams
(c) previous contents
(d) appended text
Answer:

Option (b)

13.
Choose the right statement for fscanf() and scanf()
(a) fscanf() can read from standard input whereas scanf() specifies a stream from which to read
(b) fscanf() can specifies a stream from which to read whereas scanf() can read only from standard input
(c) fscanf() and scanf() has no difference in their functions
(d) fscanf() and scanf() can read from specified stream
Answer:

Option (b)

14.
What does the following C statement mean?
 char *gets(char *s)
(a) Reads the next input line into the array s.
(b) Writes the line into the array s.
(c) Reads the next input character into the array s.
(d) Write a character into the array.
Answer:

Option (a)

15.
Which function will return the current file position for stream?
(a) fgetpos()
(b) fseek()
(c) ftell()
(d) fsetpos()
Answer:

Option (c)

16.
Choose a correct statement about C file mode "a".
FILE *fp;
fp=fopen("abc.txt","a");
(a) "a" is for append operation. You can append or add new content to the existing contents.
(b) If file is not found, new file is created.
(c) You cannot write read file contents.
(d) All of these
Answer:

Option (d)

17.
What is the C function used to move current pointer to the beginning of file?
(a) rev()
(b) rewind()
(c) rew()
(d) begin()
Answer:

Option (b)

Showing 11 to 17 out of 17 Questions