Input Output Short Questions and Answers

Input Output Short Questions and Answers. This is the 1st post of Chapter No.102nd Year | ICS Part-II Computer Subject.


We have tried our best to make the most important short questions and answers from this chapter for students to succeed in the final examinations of all boards.

input output short questions and answers

Chapter No.10: Input Output Statements

Short Questions and Answers

Q.1: Which library header file is used to access the standard input output functions? 


The standard input-output functions can be accessed by including the standard input-output library header file (stdio.h) in the program.


Q.2: What is printf ( ) function?


The standard library functions printf is used for formatted output. It takes as arguments a format string and an optional list of variables to output.


printf(format string, var1, var2, var3, ….);

                Printf(format string);


Q.3: Define the signature of function?


The signature of function describes the number and type of its arguments and the return type of the function.


Q.4: What is a format specifier?


A format specifier specifies the format in which the value of variables should be displayed on the screen or which type of value should be stored in the variables. Format specifiers are specified in the format string along with the symbol %.


Q.5: Define field-width specifier?


The number of columns used to display a value on the screen is referred to as field width. Field-width specifiers describe the number of columns that should be used to print a value.


Q.6: Define field-width specifier for integers?


Simply need to add a number between the % and d of the %d format specifier in the printf format string. This number specifies the field width or the number of columns to be sued for the display of the value.


prinft(“format string=%3d”,var);


Q.7: Define the general form of format specifier for floating-point numbers?


The general form for the format specifier for a floating-point value will be, where m represents the total field width and n represents the desired number of decimal places.


printf(“Result=%6.3f”, result);


Q.8: What is the escape sequence?


The escape sequences are characters that are specified in the format string of the printf statement in combination with a backslash (\).


Q.9: Differentiate between (\b) and (\f) escape sequences?


The escape sequence \b causes the cursor to move one space left whereas the \f moves to the next page on the printer.


Q.10: Define scanf ( ) function?


The scanf function is versatile as it is equally good for numeric as well as string input. It takes as arguments a format string and a list of variables to hold the input values.

Following is the syntax of scanf function:

scanf(format string, &var1, &var2, &var3, …);


Q.11: What is the function of & in scanf statement?


In C, & is actually the address of operator. In scanf, the address of operator (&) tells the scanf function the address of the variable where the input value is to store. If & is omitted, the scanf will not be able to locate the variable in memory, hence it will be unable to store the value into the variable and the program will find a garbage value in the variable.


Q.12: What is the problem with scanf function for character input? OR Define character input?


The scanf can also be used for character input. But scanf requires pressing the return key at the end of input value. In some cases, it is desirable to input characters without pressing the return key. To overcome such situations, many other functions specialized for character input. getch and getche are examples of such functions.


Q.13: Differentiate between getch ( ) and getche ( ) functions?


The getch ( ) and getche ( ) functions are very handy in character manipulation. In contrast to the getch ( ) function which does not echo the character typed, the getche ( ) function echo the typed character. Both of these functions do not accept any argument.


Q.14: Define conio.h?


The conio.h (console input output) is a library header file that is used to access the standard functions such as getch ( ) and getche ( ). These functions are very handy for character manipulation.


Q.15: Describe the \ddd escape sequence?


The \ddd escape sequence defines the ASCII (American Standard Code for Information Interchange) code in octal notation (each d represents a digit).

Post a Comment

Your feedback is highly appreciated and will help us to improve. So, please give your good suggestions.

Previous Post Next Post