C MCQs: Standard Input and Output- Part 1

Welcome to MCQ QUIZ for preperation for C programming tests for various interviews:

Here is a listing of C multiple choice questions on “Standard Input and Output” along with answers, explanations and/or solutions:
1. Which among the following is odd one out?
a) printf
b) fprintf
c) putchar
d) scanf


2. For a typical program, the input is taken using
a) scanf
b) Files
c) Command-line
d) All of the mentioned

3. What does the following command line signify?
prog1|prog2
a) It runs prog1 first, prog2 second
b) It runs prog2 first, prog1 second
c) It runs both the programs, pipes output of prog1 to input of prog2
d) It runs both the programs, pipes output of prog2 to input of prog1

4. What is the default return-type of getchar()?
a) char
b) int
C. char *
D. Reading character doesn’t require a return-type

5. The value of EOF is_____
a) -1
b) 0
c) 1
d) 10

6. What is the use of getchar()?
a) The next input character each time it is called
b) EOF when it encounters end of file.
c) Both a & b
d) None of the mentioned

7. Which is true?
a) The symbolic constant EOF is defined in <stdio.h>
b) The value is -1
c) Both a & b
d) Only b

8. What is the return value of putchar()?
a) The character written
b) EOF if an error occurs
c) Nothing
d) Both a & b

 

Next –> C MCQs: Standard Input and Output- Part 2

Leave a Reply