Exercise

1. 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 stream
C. FILE is a buffered stream
D. FILE is a structure and fp is a pointer to the structure of FILE type

View Answer

2. Which of the following mode argument is used to truncate?

A. a
B. w
C. f
D. t

View Answer


3. 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 the mentioned

View Answer


4. FILE is of type ______

A. int type
B. char * type
C. struct type
D. None of the mentioned

View Answer


5. fseek() should be preferred over rewind() mainly because

A. rewind() doesn't work for empty files
B. rewind() may fail for large files
C. In rewind, there is no way to check if the operations completed successfully
D. All of the above

View Answer


6. FILE reserved word is?

A. A structure tag declared in stdio.h
B. One of the basic datatypes in c
C. Pointer to the structure defined in stdio.h
D. It is a type name defined in stdio.h

View Answer


7. For binary files, a ___ must be appended to the mode string.

A. "b"
B. "B"
C. "binary"
D. "01"

View Answer


8.Which of the following statements about stdout and stderr are true?

A. Same
B. Both connected to screen always.
C. Both connected to screen by default.
D. stdout is line buffered but stderr is unbuffered.

View Answer


9. Which type of files can’t be opened using fopen()?

A. .txt
B. .bin
C. .c
D. None of the above

View Answer


10. When a C program is started, O.S environment is responsible for opening file and providing pointer for that file?

A. Standard input
B. Standard output
C. Standard error
D. All of the above

View Answer


11.If there is any error while opening a file, fopen will return?

A. Nothing
B. EOF
C. NULL
D. Depends on compiler

View Answer


12.It is not possible to combine two or more file opening mode in open () method.

A. True
B. False

View Answer


13. Which of the following is not used to seek a file pointer?

A. ios::cur
B. ios::set
C. ios::end
D. ios::beg

View Answer


14.What is the return value of putchar()?

A. The character written
B. EOF if an error occurs
C. Nothing
D. Both character written & EOF if an error occurs

View Answer


15.Which is true?

A. The symbolic constant EOF is defined in
B. The value is -1
C. The symbolic constant EOF is defined in & value is -1
D. Only value is -1

View Answer



Discussion

* You must be logged in to add comment.