C Programming Questions and Answers – Standard Input & Output – 1

This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Standard Input & Output – 1”.

Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.

1. Which among the following is the odd one out?
a) printf
b) fprintf
c) putchar
d) scanf
View Answer

Answer: d
Explanation: None.

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

Answer: d
Explanation: None.
advertisement
advertisement

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
View Answer

Answer: c
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. What is the default return-type of getchar()?
a) char
b) int
c) char *
d) reading character doesn’t require a return-type
View Answer

Answer: b
Explanation: None.
advertisement

5. What is the value of EOF?
a) -1
b) 0
c) 1
d) 10
View Answer

Answer: a
Explanation: 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
View Answer

Answer: c
Explanation: None.
advertisement

7. Which of the following statement is true?
a) The symbolic constant EOF is defined in <stdio.h>
b) The value is -1
c) The symbolic constant EOF is defined in <stdio.h> & value is -1
d) Only value is -1
View Answer

Answer: c
Explanation: 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
View Answer

Answer: d
Explanation: None.

Sanfoundry Global Education & Learning Series – C Programming Language.

To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.