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 the odd one out?
a) printf
b) fprintf
c) putchar
d) scanf
Answer: d
Clarification: None.
2. For a typical program, the input is taken using _________
a) scanf
b) Files
c) Command-line
d) All of the mentioned
Answer: d
Clarification: None.
3. What does the following command line signify?
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
Answer: c
Clarification: None.
4. What is the default return-type of getchar()?
a) char
b) int
c) char *
d) reading character doesn’t require a return-type
Answer: b
Clarification: None.
5. What is the value of EOF?
a) -1
b) 0
c) 1
d) 10
Answer: a
Clarification: None.
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) The next input character each time it is called EOF when it encounters end of file
d) None of the mentioned
Answer: c
Clarification: None.
7. Which of the following statement is true?
a) The symbolic constant EOF is defined in
b) The value is -1
c) The symbolic constant EOF is defined in
d) Only value is -1
Answer: c
Clarification: None.
8. 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
Answer: d
Clarification: None.
