Programming for Problem Solving (3110003) MCQs

MCQs of File management

Showing 1 to 10 out of 17 Questions
1.
When fopen() fails to open a file it returns
(a) NULL
(b) 1
(c) -1
(d) None of above
Answer:

Option (a)

2.
File manipulation functions in C are available in which header file?
(a) streams.h
(b) stdio.h
(c) stdlib.h
(d) files.h
Answer:

Option (b)

3.
Which of the following true about FILE *fp
(a) FILE is a keyword in C for representing files and fp is a variable of FILE type.
(b) FILE is a structure and fp is a pointer to the structure of FILE type
(c) FILE is a stream
(d) FILE is a buffered stream
Answer:

Option (b)

4.
Which of the following file open mode argument is used to truncate?
(a) a
(b) w
(c) r
(d) t
Answer:

Option (b)

5.
The first and second arguments of fopen() are
(a) A character string containing the name of the file & the second argument is the mode.
(b) A character string containing the name of the user & the second argument is the mode.
(c) A character string containing file pointer & the second argument is the mode.
(d) None of these
Answer:

Option (a)

6.
Which one of the following is correct syntax for opening a file.
(a) FILE *fopen(const *filename, const char *mode)
(b) FILE *fopen(const *filename)
(c) FILE *open(const *filename, const char *mode)
(d) FILE open(const*filename)
Answer:

Option (a)

7.
What is the function of the mode ‘ w+’?
(a) Create text file for writing, discard previous contents if any
(b) Create text file for update, discard previous contents if any
(c) Create text file for writing, do not discard previous contents if any
(d) Create text file for update, do not discard previous contents if any
Answer:

Option (b)

8.
If the mode includes 'b' after the initial letter, what does it indicates?
(a) text file
(b) big text file
(c) binary file
(d) bit file
Answer:

Option (c)

9.
getc() returns EOF when
(a) end of files is reached
(b) When getc() fails to read a character
(c) Both A and B
(d) None of these
Answer:

Option (c)

10.
A data of the file is stored in___
(a) RAM
(b) ROM
(c) Hard disk
(d) None of these
Answer:

Option (c)

Showing 1 to 10 out of 17 Questions