Class 12 Computer Science Chapter 13 Notes
Important Notes of complete Class 12 Computer Science Chapter 13 Notes written by Professor Mr. Faraz Qasir Suib. These notes are very helpful in the preparation of Class 12 Computer Science Chapter 13 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:
- Important Class 12 Computer Science Chapter 13 Notes for Intermediate part-II students.
- Describe Unstructured and Structured Programming ?
Define Function and differentiate between Unstructured and Structured Programming: Overview : The idea of modular programming is the result of inspiration from the
hardware manufacturing where replicable components of different items are available.
If a component of an item gets out of order, it is replaced with a newer one. Many
different components from different manufacturers can be combined together to form
a hardware device such as computers, cars, and washing machines.
Functions : Functions are the building blocks of C programs. They encapsulate pieces
of code to perform specific operations. Functions allow us to accomplish the similar
kinds of tasks over and over again without being forced to keep adding the same code
into the program. Functions perform tasks that may need to be repeated many times.
Unstructured Programming : When the whole program logic is contained in a single
main function, the style of writing programs is known as unstructured programming.
Structured Programming : It is a modular way of writing programs. The whole
program logic is divided into number of smaller modules or functions. The main
function calls these functions where they are needed. A function is a self-contained
piece of code with a specific purpose.
Difference between Unstructured and Structured Programming : In Unstructured
Programming, the entire logic of the program is implemented in a single module
(function), which causes the program error prone, difficult to understand, modify and
debug. Whereas in Structured Programming, the entire logic of the program is divided
into number of smaller modules, where each module (piece of code) implements a
different functionality.
- Describe Importance / Benefits of Use of Functions.
- Explain the TWO Types of Functions.
- Explain the procedure of writing a Function in C.
- Explain the Function Prototype in C.
- Explain the Function Call in C: Answer :
Function Call In C : Function call is a mechanism that is used to invoke a function to
perform a specific task. A function call can be invoked at any point in the program. In
C the function name, the arguments required and the statement terminator ( ; ) are
specified to invoke a function call.
When function call statement is executed, it transfers control to the function that is
called. The memory is allocated to variables declared in the function and then the
statements in the function body are executed. After the last statement in the function is
executed, control returns to the calling function.
- Explain Local Variables in C, their Life Time,
Memory Allocation / De-allocation and The Scope of a Local Variable with an
example program.
- Explain Global Variables in C, their Life Time,
Memory Allocation / De-allocation and The Scope of a Local Variable with an
example program.
- Explain Functions Without Arguments with an
example program.
- Explain Functions that Return a Value and Accept
Arguments / Parameters with example program(s): Functions that Return a Value and Accept Arguments / Parameters : We may
need a function that could return a value and arguments could be passed to it. We have
seen a number of such built-in library functions e.g., sqrt( ), toupper( ), tolower( ) etc.
Let’s consider the general form of function header :
return_type FunctionName (parameter_list)
The return_type specifies the data type of the value that the function returns.
Parameter_list is a comma separated list which specifies the data type and the name of
each parameter in the list.