Test Your skill on Input Output in C Language
In this article, lets test or analyse our skill How the input and outputs are used in C programming language.
Lets Study Some MCQ (Multiple choice questions)and FAQ(Frequently Asked Questions).
1. Which one of the following is Odd one?
a.printf()
b.putchar()
c.scanf()
d.puts()
Ans: c .scanf():
all function printf(),putchar() and puts() are used to display message or text on console.
scanf(): reads input from console and store it in a variable.
2. What is return type of getchar()?
a.char
b.int
c.char*
d.reading character does not require return-type.
e. Return type depends upon compiler.
f. EOF
g. all of above.
ans:
both b and f.
The getchar() function obtains a character from standard input i.e. stdin. or keyboard. It returns the character that was read in from of an integer or EOF if an error occurs.
3. Which one of the following is formatted input output functions?
a.printf() and scanf()
b.printf() and print()
c.getchar() and putchar()
d.gets() and puts()
e. getc() and putc()
ans:
a. printf() and scanf(). :-> In the list give above only a. printf() and scanf() are int the category of formatted functions. where as other functions are in the cateory of unformatted functions.
3. Which one of the following is formatted input output functions read character from std input(keyboard)?
a.printf()
b.print()
c.getchar()
d. puts()
e.putc()
ans:
c. getchar(). :->Read single character from the std. input stream stdin, regardles of what it is, and return it to the program.
4. Which one of the following functions writes character to any output stream and returns an integer value?
a.printf()
b.print()
c.getchar()
d. puts()
e.putc()
ans:
e. putc(). :->Return type of of putc is int. this function returns the character written as an unsigned char cast to an int or EOF on error. EOF has the value-1 and this cannnot be unsigned char cast to int. the return value of putc is of type int.
5. Which one of the following not the standard formatted input or output function in C Language?
a.printf()
b.print()
c.getchar()
d. puts()
e.putc()
ans:
b. print(). :->The print() function is not the function in c programming. Other functions are inbuilt function available in C Library.