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.

advertisement

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.
advertisement

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.

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!

advertisement
advertisement

Leave a Comment

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter

Check his free tutorial videos on Advanced C Programming. Join his Sanfoundry-Classes telegram channel for all videos and queries on Programming, Data-Structures, Kernel, Personality development and Mentoring.