ICS Notes Computer Science Part 2 Chapter 10 Input Output of C Short Questions

ICS Notes Computer Science Part 2 Chapter 10 Input Output of C Short Questions 2nd Year Notes Online Taleem Ilm Hub

If you want to view other notes of ICS FA Computer Part 2 Please Click Here.



Q 1. What is input statement?
Ans. The data or instructions given to a program are called input. The data is provided to program by using some input device. Keyboard is standard input device. The input given by keyboard is called standard input. The C language instructions that are used to take input are called input statements.

Q 2. What is output statement?
Ans. The processed input data produced by program is called output. Output is sent by program to some output device. The standard output device is monitor. So the output sent to monitor is called standard output. In C language built-in functions are used for output. The C language instruction that is used to send output is called output statement.

Q 3. What are standard input functions?
Ans. Some important functions used for standard input are:

  • scanf()
  • gets()
  • getch()
  • getche()


Q 4. What are standard output functions?
Ans. Some important functions used for standard output are:

  • printf()
  • puts()


Q 5. What are is printf() function?
Ans. printf() function is used to send output of the program towards monitor. It can display text, constants or value of variables on monitor. It can display text, constants and value of variables in our desired format. It is also called formatted output function. It is a library function defined in stdio.h header file. The syntax of printf() function is as follow:
printf("string");

Q 6. What is a format specifier?
Ans. A string that is used to specify the format in which the value of the variable will display on monitor is called format specifier. Format specifier start with % symbol. It is also used to specify the format according to which the values will be displayed on output device or read from an input device. The general syntax of format specifier is as follow:

  • % Flag Field_Width Precision Conversion_Character


Q 7. What is field width in format specifier?
Ans. The number of columns used to display a value on monitor screen is called field width. A number in format specifier that determines the field width is called field width specifier. It specifies the minimum number of columns that should be used to print a value. It used is optional in format specifier.

Q 8. What is an escape sequence?
Ans. A combination of characters in printf() function used to control printing on the output device is called escape sequence. Escape sequence are not printed. Escape sequence begins with backslash (\). A specific character is used after backslash. Escape sequence can be used at the beginning, middle or end of a string. Any number of escape sequence can be used in a string.

Q 9. What is getch() function?
Ans. This function is used to take a single character as input from keyboard. The character taken from keyboard is transferred to variable. After typing a character there is no need to press enter key. It is used to transfer a character to a variable without pressing enter key. The character typed does not appear on screen.

Q 10. What is getche() function?
Ans. The function getche() is used to take a single character as input from keyboard.  The character taken from keyboard is transferred to char type variable. After typing a character there is no need to press enter key. It is used to transfer a character to a variable without pressing enter key.

Q 11. What is the function of \n escape sequence?
Ans. New line: It is used to move the cursor at the beginning of next line.
For example
printf("Hello \n Pakistan");

The output of the above statement will be
Hello
Pakistan

Q 12. What is the function of \t escape sequence?
Ans. Tab: It is used to move the cursor on one tab forward from current position.
For example
printf("Hello \t Pakistan");

The output of the above statement will be
Hello Pakistan

Written by: Asad Hussain & Sana Hussain

Post a Comment

Previous Post Next Post