Class 12 Computer Science Chapter 10 Notes

Important Notes of complete Class 12 Computer Science Chapter 10 Notes written by Professor Mr. Faraz Qasir Suib. These notes are very helpful in the preparation of Class 12 Computer Science Chapter 10 Notes of for the students of the intermediate and these are according to the paper patterns of all Punjab boards.

Summary and Contents:
Topics which are discussed in the notes are given below:
  • Describe Standard Input / Output Library (stdio.h) in C Language: Answer : Standard Input / Output Library : In C, the standard input / output library provides functions to perform input and output operations. By standard input and output, we mean the keyboard and monitor respectively. In C, these input / output operations are performed by two standard input / output functions, these are printf( ) and scanf( ). These functions can be accessed by including the standard input / output library (stdio.h) in the program.
  • Describe Standard Input / Output Library (stdio.h) Function printf.
  • Describe Format Specifiers in Standard Input / Output Library (stdio.h) Function printf: Answer : Format Specifier : Format specifiers specify the format in which the value of a variable should be displayed on the screen. Format specifiers are specified in the format string. For instance, in the above program the printf( ) statement contains the symbol %d, which is format specifier for the variable area. For different types of variables, different format specifiers are used :
  • Describe Field-Width Specifiers in Standard Input / Output Library (stdio.h) Function printf: Answer : Field-Width Specifier : In a C program, 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. Formatting Integers : Add a number between the % and d of the %d format specifier 56 in the printf format string, This number specifies the field-width or the number of columns to be used for the display of the value. The statement : printf (“Area = %4d”, area) ; indicates that four columns will be used to display the value of area. Suppose the value of the variable area is 25. Two extra spaces will be padded before 25 (least significant) on the screen to complete the length of 4. The output of the above statement will be : Area = 25.  represents a blank space. This space will not be displayed as a printed character in actual output. In this way the value of 25, which requires two spaces to be displayed, will occupy four spaces (columns) on the screen. The reason is that the format specifier for area (%4d) allows spaces for four digits to be printed. Because the value of area is 25, therefore its two digits are right justified, preceded by two blank spaces.
  • Explain Escape Sequences in Standard Input / Output Library (stdio.h) Function printf( ): Answer : Escape Sequences : Escape sequences are characters which are specified in the format string of the printf statement in combination with a backslash (\). These cause an escape from the normal interpretation of a string so that the next character is recognized as having a special meanings.
  • Explain Standard Input / Output Library (stdio.h) Function scanf. 
  • Explain Standard Library Functions for Character Input: Answer : Standard Library Functions for Character Input : In C, there are many functions to accept character input. The versatile scanf can also be used for this purpose. 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. For example, in a game while controlling the movement of a space ship through arrow keys we can’t afford to press return key each time after pressing an arrow key. To overcome such situations, C is equipped with many other functions specialized for character input. Function getch and getche are good examples. These are part of the conio.h (Console Input Output) library.

Loading your document...