Feed Headline Animator

WAP to find the greater value

Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = InputBox("Enter first value", "first value")
b = InputBox("Enter second value", "second value")
If a > b Then
MsgBox ("First value is greater")
Else
MsgBox ("Second value is greater")
End If
End Sub



Posted by: Wasim Javed

Math Calculation Project.

Private Sub cmdclear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End Sub

Private Sub cmdclos_Click()
Unload Me
End Sub

Private Sub cmdmulti_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub cmdsum_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub


Posted by: Wasim Javed

WAP to multiply the two integers

Private Sub Command1_Click()
Dim a, b, c As Integer
a = InputBox("Enter 1st value", "input box")
b = InputBox("Enter 2nd value", "input box")
c = a * b
MsgBox a & "*" & b & "=" & c, -0, "Multiplication"
End Sub


Posted by: Wasim Javed

WAP to print a messege on the screen

Private Sub Command1_Click()
MsgBox "Testing messege", vbOKCancel + -vbExclamation, "messege box
window”
End Sub


Posted by: Wasim Javed

WAP to find Hide/Show forms

Private Sub Command1_Click()
Form2.Show vbModeless
End Sub

Private Sub Command2_Click()
Form3.Show vbModeless
End Sub


Posted by: Wasim Javed

WAP to find the got focus and lost focus

Private Sub Command1_GotFocus()
Command1.Caption = "Got Focus"
End Sub

Private Sub Command1_LostFocus()
Command1.Caption = "Lost Focus"
End Sub

Private Sub Command2_GotFocus()
Command2.Caption = "Got Focus"
End Sub

Private Sub Command2_LostFocus()
Command2.Caption = "Lost Focus"
End Sub

Private Sub Command3_GotFocus()
Command3.Caption = "Got Focus"
End Sub

Private Sub Command3_LostFocus()
Command3.Caption = "Lost Focus"
End Sub


Posted by: Wasim Javed

WAP to find the events

Private Sub Form_Click()
Form1.Caption = "Form was clicked"
End Sub

Private Sub Form_DblClick()
Form1.Caption = "Form was double clicked"
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
Form1.Caption = "Key was press on keyboard"
End Sub


Posted by: Wasim Javed

Steps of Development of R.B.C's




Pro erythroblast is the first cell which is responsible for the formation of many red blood cells because when these cells formed ,divide several times and form many mature red blood cells.

The 1st generated cells are called besophil erythroblast because they can be stained with basic dyes. The at this time the cell has very little hemoglobin. However in succeeding generation the cell becomes filled approx 33% hemoglobin. At the same time the endoplasmic reticulum is reabsorbed. The cell at this steps is called reticul: eytes.

The remaining bchophilic materiel in reticnlocyte disappear with in 1--2 days and the cell is then converted into mature erythrocytes.

Posted by: Wasim Javed

Development of red blood corpucles




Areas of the body that produce Red cells

1. Embyonic Life:-

In early few weeks of Embyonic life, the primitive nucleated red blood cells are produced in the yolk sea.

Later on in the middle trimester of gestation red blood cells are produced by liver. Through reasonable no of R.B.C's are produced by the spleen and lymph nodes

2. After birth:-

The bone marrow is the main site of erythrogesis during the early year all bones are filled up with blood forming red marrow but by twentieth year almost all the long bones are replaced with inactive yellow and in this location. R.B.C formation stops only the upper ends of femur and humerus certain red marrow and continue to form red cells throughout the life.

In addition to this the vertebrae, the ribs and flat bones produce R.B.C's continuously.

Posted by: Wasim Javed

Composition of R.B.C




Composition of R.B.C:-

Each red blood cell contains
1. Water-----65%
2. Solid-----35%

A) Solid Portion 35% contains:-

The solid portion contains,

i. Hemoglobin -----33%
ii 2% of phospholipids, cholesterol, cholesterol aster, amino acid and proteins.
iii. But very small amount of Urea, Uric acid Phosphate are also present

B) Total lipids of R.B.C:-

Total lipids,

i. Phospholipids -----60%
ii. Free Cholesterol -----30%
iii. Fat and cholesterol aster -----10%

of the salts in the corpuscles potassium phosphate is the chief slat.


Posted by: Wasim Javed

Formed Elements of blood





There are three types of cellular elements in the blood which constitute about 45% of the blood i.e

i. red blood corpuscles (R.B.C) or erythrocytes.
ii. White blood corpuscles (W.B.C) or leukocytes
iii. Platelets or thrombocytes

These are collectively known as formed aliments of the blood.

Red blood Corpuscles (R.B.C):-

(R.B.C's are also known as erythrocytes). They canto no nucleic acid or mitochondria and can reproduce R.B.C' have a little aerobic metabolic and have no protein, fat or carbohydrate synthetics activity. These substances and function are lost where normoble and reticuloblast are converted into mature re blood cells.

Shape:-

The mature human or mammalian red blood cells camel are circular , biconvex in shape and lack nucleus. In came they are oval in shape.

In mammalian vertebrates red cells are oval, biconvex and nucleated. In foctus. They are nucleated but in later part the nucleated cells disappear from the circa the edges are rounded and thicker then the center and looks like dumb-bell from the side.

Size:-

Red blood cells are 7.5 um in diameter 7.2u

1.1 um in thickness

1 um in the contve

7.2 u means diameter.



Posted by: Wasim Javed

C Language Coversions

Decimal to binary

Divide by 2 and start bottom to top.

Decimal to octal

Divide by 8 and start bottom to top.

Decimal to hexadecimal

Divide by 16 and start bottom to top.

Binary to decimal

Multiply by 2 and power start on 2.

Octal to decimal

Multiply by 8 and power start on 8.

Hexadecimal to decimal

Multiply by 16 and power start on 16.

Binary to octal

Make table start 3 marks right to left and 3 mark look in the table and write below 3 marks and write them.

Octal to binary

Make table mark 3 below the octal numbers and write them.

Binary to hexadecimal

Make table 4 mark below the binary numbers and write them.

Hexadecimal to binary

Make table 4 mark below the hexadecimal numbers and write them.

Octal to hexadecimal

Step one: convert octal into binary.
Step second: convert binary of octal into hexadecimal.

Hexadecimal to octal

Step one: convert hexadecimal into binary.
Step second: convert binary of hexadecimal into octal.

Decimal to binary in points

Before point same as decimal to binary conversion after point all the numbers multiply by 2 the result again multiply by 2 when same result begin then stop and write start top to bottom and count before the same result.

Posted by: Wasim Javed

Write note on the following topics

(1) Local variable: -

These variables which are used with in only that function, in which these are declared are called local variable. These variables cannot be used in the main ( ) program or in another program.

(2) Global variable: -

Those variables which are declared before main ( ) function and can be used any ware in the program.

(3) Return statement: -

This statement is use to bring a value from any function main ( ) program.

(4) Calling function: -

The written function of the main ( ) function is called calling function.

(5) Called function: -

A function which is written in main ( ) program is called function.

(6) Source program: -

A computer program written in a high level language is called source program. It is also called the source code.

(7) Object program: -

A computer program in a machine language is called the object program. It is also called the object code.


Posted by: Wasim Javed

What are unions in C language, explain

Unions: -

A union is a memory location just like a structure which has number of variables of different data type. The syntax of a union in C language is just like the structure syntax, such that:
Union name of union
{
Type member variables;
}
Union name of union using new name;
In this topic we also use a dot (.) operator with its new reference name.
For example
Union mem
{
Int a;
Char b;
};
Union name value;
So we can use its reference name value with its member variables as:
Value . a;
Value . b;


Posted by: Wasim Javed

What is structure, explain

Structure: -

As we know that an array is the collection of same data type but structure is the collection of different data types or different variables or different field.

A structure is written as:
Struct name of structure
{
Type member’s variables;
};
Where the word struct is used for structure and it is a reserved word, which tells the compiler that we are introducing the structure and fields.
For example
Struct student record
{
Char name [15];
Char exam [10];
Int phy, che, math’s;
};
So the student name is the name of structure and name, exam are the fields of character type and phy, che, math’s are the fields of integer type.


Posted by: Wasim Javed

What is pointer and pointer operators, explain

Pointer: -

A pointer is a variable, which is used to store the address of another variable.
For example
If we have a variable ‘T’ whose address is 1000 and its value is 5 let ‘B’ another variable which has the address number 1000 of ‘t’ and it has address 1003 then it will be as:
Variable Address Values
T 1000 5
B 1003 1000
So we can say ‘B’ is keeping the address of variable ‘T’ so it will be a pointer.

Pointer operators: -

The operators ‘&’ and ‘*’ are called the pointer operators. These operators are used to point the address of a variable as well as the content (value) of a variable.
So the operator ‘&’ is used to store the address of operator and the operator ‘*’ is used to store the content of that variable.
The pointer variable is declared as:
Data type
Data type * variable name;
For example
Int *a;
So a will be a pointer variable if this variable a has value 5 and it is started on address 1000 then
Printf (“%d”, a); --------------- (i)
Printf (“%d”, &a); ------------- (ii)
Printf (“%d”, *a); -------------- (iii)
So the result of (i) will be 5 and the result of (ii) will be 1000 and the result of (iii) will be 5.


Posted by: Wasim Javed

What is function, discus its types in C language

Function: -

A function is the collections of statements, which are used for any specific task.
Types of function: - There are two types of function in C language.
(1) Built in function
(2) User define function

(1) Built in function: -

Those functions which are already the parts of C language. The compiler already has known these functions. These functions are called built in functions. A built in function is also called a library function, a system defined functions.
For example
Scanf ( ), printf ( ), gets ( ), puts ( ), sin ( ), cos ( ) etc.

(2) User define function: -

These functions which a user create by it self and are not the part of the library file, are called user defined functions. These functions can only be use with in that program in which these are created and cannot in other program.
For example
Factorial of a number etc.


Posted by: Wasim Javed

What is a string discuss its input and output functions

String: -

The collection of characters is called a string.
For example
“Pakistan” is a string
A string is always enclosed in double quotes.

String input function: -

To input a string we use get ( ) function and its format is:
Get (variable);

String output function: -

To display a string on screen we use puts ( ) function. The syntax of a string output function will be as:
Puts (variable);


Posted by: Wasim Javed

What is ARRAY, explain its types

ARRAY: -

It is the combination of same data type or if same data is needed more then none time then we use array.

Types Normally there are two types of array.
(1) One dimensional array
(2) Two dimensional array

(1) One dimensional array: -

This array is in form a list (vertical\Horizontal) the data input output or process in one dimensional array with the help of loop.
The syntax of one dimensional array will be as:
Array name [strength]
For example
A [5];
The structure of above syntax will be as:

A (0)
A (1)
A (2)
A (3)
A (4)


(2) Two dimensional array: -

Two dimensional array is also called a table because it consist of rows and columns. The syntax of two dimensional arrays will be as:
Data type array name [rows] [columns]
For example
Int [3] [2];
The structure of above syntax will be as:


A [0] [0] A [0] [1]
A [1] [0] A [1] [1]
A [2] [0] A [2] [1]

The data input output are process in this array with the help of nested loop.


Posted by: Wasim Javed

Explain Continue & Break statement

Continue statement: -

The “continue” statement shifts the control break to the beginning of the loop. It is used inside the body of a loop. When this statement is executed inside the body of loop, the control shift to the first statement of the body of the loop and the statement within the body of loop following the continue statement are not executed. Its syntax will be as:
Continue;

Break statement: -

The “break” statement is used to terminate execution of a loop when it is used inside the body of the loop.

Different between continue and break statement:

The “break” statement terminates the loop during execution. The other statements of the body of the loop that come under the “break” statement are not executed.

The “continue” statement does not terminate the loop but it shifts the control at the beginning of the body of the loop. The statements of the body of the loop that come under the “continue” statement are not executed.


Posted by: Wasim Javed

What is the difference between simple if and compound if statement

Simple if statement: -

It is a conditional statement. Ifs syntax will be as:
If (condition)
Statement;
So first of all condition is checked if it will become true then statement will be executed otherwise not.
For example
If (a>b)
Great = a;

Compound if statement: -

Its syntax will be as:
If (condition)
{
Statement 1;
Statement 2;
------------
}


Posted by: Wasim Javed

What is nested loop

Nested loop: -

When one loop is enclosed with in other loop, then this kind of loop is called nested loop.
It may be a nested loop for loop.
It may be a nested while loop.
It may be nested do while loop.
If it is nested for loop then its syntax will be as:
For (variable 2 = initial value; condition; increment \ decrement)
{
For (variable 2 = initial value; condition; increment \ decrement)
{
} body of loop
}
}
The start loop is called outer loop and the end loop is called inner or internal loop. For each number of outer, the inner loop completes its whole cycle.


Posted by: Wasim Javed

What are loop and its types

Loop: -

A cycle process to called loop. Or if some kind of task is required more then one times then we use loop.

Types of loop: -

In C language there are three types of loop.

(1) For loop (2) While loop (3) Do-while loop

(1) For loop: -

If the number of cycles or repetition is already known then we use for loop.
Its syntax is:
For (variable = initial value; condition; increment or decrement ;)
{
Body of loop
}

So in the above structure first of all the value is initialized in the given variable, then in the second part that value is checked in the given condition, it is prove that body will process and if it is will become false then body of loop will not process in the tired part the value in variable is increment or decrement and then it is again checked in the condition part.

(2) While loop: -

The numbers of cycles or repetitions or iterations are already not known then we use while loop.
The syntax is:
While (condition)
{
Body of loop
}
So in this loop, first of all condition is checked, if it remains true the body of loop will process otherwise it will be stopped.

(3) Do-while loop: -

It is also a conditional loop like while loop, but in this loop condition is checked in the end, where as in the whole loop condition is checked first.
Its syntax will be as:
Do
{
Body of loop
}
While (condition);
So in this loop the body of loop will be processed one time at any case, whether the condition is true or false.


Posted by: Wasim Javed

what is switch statement, explain

Switch statement: -

The switch statement is also called the conditional statement like else – if statement. But by this statement we can take multi values with our condition.
Its syntax is:
Switch (condition)
{
Case value 1:
Statement 1;
Break;
Case value 2:
Statement 2;
Break;
Case value 3 :
Statement 3;
Break;
Default:
Statement 4;
}

In this structure first of all value of condition is checked, if it methods with case value 1 then statement is executed. If it method with case value 2, then statement 2 is executed. If the method with case value 3, then statement 3 is executed otherwise in false situation, default statement is executed.


Posted by: Wasim Javed

Explain “else – if” statement

The else – if statement: -

This is also a conditional statement like a “if – else” statement, but in this statement there is also a part of else – if statement.
Its syntax will be as:
If (condition)
Statement 1;
Else – if (condition)
Statement 2;
Else
Statement 3;
So in this structure first of all condition 1 is checked if it becomes true the statement 1 is executed. But if it become false then condition 2 with else if in checked and if it become true then statement 2 is executed otherwise statement 3 is executed.


Posted by: Wasim Javed

Explain the “if – else” statement

The “if – else” statement: -

This statement is also called a conditional statement structure like simple if statement. But there is some extra statement ELSE is used with false case.
The syntax will be as:
If (condition)
Statement 1;
Else
Statement 2;
So in the above structure first of all condition is checked if it become true then statement 1 will be executed and if it become false then statement 2 will be executed.
If this kind of statement will compound then its syntax will be as:
If (condition)
{
Statement 1;
Statement 2;
}
Else
{
Statement 3;
Statement 4;
}


Posted by: Wasim Javed

Explain the “if” statement

The “if” statement: -

The “if statement” is used to execute a set of statements after testing a condition. The “if statement” evaluates the condition. If the given condition is true, the statement (or a block of statements) following the “if statement” is executed. If the condition is false, the statement (or block of statements) following the “if statement” is ignored and the control transfers to the statement immediately after the if structure.

The syntax of the “if statement” is:
If (condition)
Statement - 1;
Statement - 2;
In the above syntax, statement -1 will be executed if the given condition is true. If the given condition is false, statement - 1 is ignored and statement - 2 will be executed.
The execute a block of statements following the “if statement” the block of statements is enclosed in curly, i.e. within {}.
The syntax of “if statement” for executing a block of statements is:
If (condition)
{
Statement - 1;
Statement - 2;
Statement - 3;
}


Posted by: Wasim Javed

Explain Goto and label statement

Goto and label statement: -

A goto statement can cause the program control to the end up almost any where in the program. The general syntax of goto statement is:
Goto label name;
…...
Label name:
Statement 1:
Statement 2:
…….
Where label name is a label name that tell goto statement where to jump. You have to place label name in two places. One is at that place following the goto statement and the other is the place where the goto statement is going jump.
Also the program place for the goto statement to jump can be appeared either before or after the statement.


Posted by: Wasim Javed

What are header files or library files, explain

Header files (library files):-

Header file are part of C compiler. These files contain definitions of standard library functions. There are several header files. Each header file contains definitions of one type of function only.

For example, the math.h header file contains definitions of mathematical functions available in C language. Each header file has an execution .h. The preprocessor directive “include” is used to add a header file into the program. The name of the file is written in angle brackets (< >) after “#include” directive. The syntax to include a header file is:

#include
Given the name of the header file in angle rackets specifies that the header file is located in the include directory of the compiler program.


Posted by: Wasim Javed

What is the main ( ) function in C program

The main( ) function:-

The main( ) function indicates the beginning of a C program. This function must be included in every C program. When a C program executed, the control goes to main ( ) function. It is the entry point of all C programs.
The statements within this function are the main body of the C program. If main ( ) function is not included, the program is not compiled and an error massage is generated.
The syntax of the main ( ) function is:
Void main (void)
{
Program statements……
}
The main ( ) function may take one or more values. Similarly, it may also output one value.


Posted by: Wasim Javed

What is pre-processor directive and its types

Pre-processor directive: -

The instructions that are given to the compiler before the beginning of the actual program are called preprocessor directives. These arte also called compiler directives. These are written at the beginning of the source program. These preprocessor directives start with a number sign (#) and the key word “include” or “define”.

These are the instructions or directives that tell the compiler to take the actions before compiling the source program. The program that handles the preprocessor directives is called the preprocessor because it does some processing before the compilation process actually starts.

There are two types of pre-processor in C language.

The # include directive: -

The # include is a pre-processor directive. It is used to include or import a source text into source program. It is usually used to import header files into a program.

The syntax to use the # include directive is:
# include

Giving the name of the header file in angle brackets specifies that the file is located in the include directory of the compiler program.
The name of the file to be imported can also be written in double quotes. When the name of the file is written in double quotes, it specifies that the file is to be loaded from the directory which contains the source program file.
The syntax to include a header file is:

# include “name of the header file”

The # define directive: -

The # define is a pre-processor directive. It is used to assign a constant quantity to an identifier. This directive can be used any where in the program. Its syntax is:
# define identifier constant
Where

Identifier specifies the identifier name to which the constant value is to be assigned.

Constant specifies the constant value that is to be assigned to the identifier.

The identifier specified in the define directive is not a variable. It does not have any data type. The pre-processor simply replaces all occurrences of the identifier with its value in the program statements that follow the directive.


Posted by: Wasim Javed

Write naming rules or rules to identify the variable

Rules:-
The rules for identification of variables in the programming are

1. The first character of a variable must be alphabetic one.

2. The maximum length of a variable in turbo C version is up to 31 characters.

3. There should no blank space in between two characters of a variable like AR EA (invalid variable).

4. There should no special character in the variable name, instead of standard core line like spe-d.

5. The variable must be meaningful it may be the first character of that thing or full name like area or a.

6. Reserved C word cannot be used as variable name.

Posted by: Wasim Javed

What is an Expression

Expression: -

An expression is used for calculating the value of a formula. It is formed by combining different operands and operator. Its evaluation gives a single value. The operands may be constant values, different variable names and functions. Parenthesis may also be used in an expression.
For example, to calculate the value of box with sides A, B, C the expression is written as:
A **B **C
Where A, B, C are variable names and are called operands. The multiplication sign ‘**’ is called operator. The combination of operands and operators makes an expression.

Posted by; Wasim Javed

Define size of operator

Size of operator:-

The size of operator is used to know the size of a data type being used.
The general form of the size of operator is:
Sizeof (expression)
There expression is the data type or variable, whose size is measured by the size of operator.


Posted by: Wasim Javed

Explain the address of operator

Address of operator: -

In C language the ampersand operator i.e. & is called addresses of operator. It is used proceeding with the variable name. It would seem more reasonable to use the name of the variable enough with out the ampersand as we did in printf ( ) statement. However the C language compiler requires the arguments to scanf ( ) to be the addresses of variables, rather then the variables themselves.
In other words we can say every variable name occupies a certain location in the memory and the first character (byte) it occupies is the address of that variable. There fore C language compiler provides ampersand to be places as a prefix with the variable name to over come this problem.


Posted by: Wasim Javed

How many operators in C language explain

Operator: -

These are the symbols which are used in mathematical calculations or the solution of mathematical problems. There are several types of operators in C language. The following types are commonly used in C language.

(1) Arithmetic operator: -

These operators which are used in arithmetic calculations are called arithmetic operator. These operator are

1. + ( Adding operator ) 2+3 or a+b
2. – ( Subtraction operator ) 2-3 or a-b
3. * ( Multiplication operator ) 2*3 or a*b
4. / ( Division operator ) 2/3 or a/b
5. % ( Mod operator ) 2%3 or a%b

(2) Relational operator: -

Those operators which are used show the relationship between two constant or variable are called relational operator. These are
< (Less then) 5<7 or a> (Grater then) 7>5 or x>y
<= (Less then or equal) 2<=3 or a<=b
>= (Grater then or equal) 3>=2 or a>=b
== (Equal) 5==5 or a==b
!= (Not equal) 5!=7 or k!=m

(3) Logical operator: -

Those operators which are used to join the relational operators. These are
&& (AND operator)
|| (OR operator)
! (NOT operator)

(4) Assignment operator: -

The assignment operator is (==).

(5) Compound assignment operator: -

The compound assignment operators are (+ = > - =, * = > /=, %).

(6) Increment operator: -

The increment operator adds one to the value of the variable. If n is variable having value 10 then following code adds one two the value of n, so that after the statement is executed, n has a value of 11.
Int n =10;
n++;

(7) Decrement operator: -

The decrement operator subtracts one from the value of the variable. The expression --n;
Decrement the value of n one time.

(8) Unary operator: -

These operators are used with single operator or single variable. These are ++ or-- variable operators.

(i) Prefix unary operators: -

These are used before the variables are operators. For example ++! (Prefix) Prefix decrement).

(ii) Post fix unary operator:-

Those unary operators which are used after the unary variable or operators called post fix unary operators. For example! ++ (Postfix).


Posted by: Wasim Javed

What is variable and what are its types

Variable: -

It is a space or a location where we keep some constant value. There are four types of variable in C language. (1) Integer variable (2) Float variable (3) Character variable (4) String variable

(1) Integer variable: -

A variable or a place we keep or put only integer constant is called integer variable. It is declared a deserved word ‘int’. For example a=5, then a will be integer variable.

(2) Float variable: -

A location or variable where we put some float or real data is called float variable. It is declared a deserved word ‘float’. For example a=5.55 then a will be a float variable.

(3) Character variable: -

A variable which keep only the character constant is called character variable. It is declared a deserved word ‘char’. For example a=’1’, now a will be a character variable.

(4) String variable: -

A variable which can store a string constant is called a string variable. For example a[8]= “ pakistan ” ; then a[8] will be string variable.


Posted by: Wasim Javed

What is constant and explain its types

Constant: -

A fix or unchangeable value in the program is called a constant value. There are four types of constant in C language. (1)Integer constant (2) Real or Float constant (3) Character constant (d) String constant

(1) Integer constant: -

A numerical value without a decimal is called integer constant. Or A non-frictional (+,-) fix value is called integer constant. For example +225, -555, 500 etc.

(2) Real or Floating constant: -

A frictional (+,-) fix value is called real or floating constant or Numeric values that an integer as well as a decimal part are called real or floating constant. For example +25.32, -58.679, 28.321 etc.

(3) Character constant: -

A single character when it is enclosed in single quotes is called character constant. For example ‘a’, ‘1’, ‘M’ etc.

(4) String constant: -

The combinations of characters when those are enclosed in double quotes are called string constant. For example “Pakistan”, “Phone-0966” etc.

Posted by: Wasim Javed

What are identifier and its types

Identifier: -

An identifier is the name that presents a variable, constant, data types, function, or label in a program. In the C language, an identifier consists of a combination of alphanumeric characters, such that:

• The first is always a letter of the alphabet or an (_) underscore.

• The remaining can be any letter, numeric digit, or the underscore.

There are two types of identifier in C language.
(1) Standard identifier (2) User-define identifier

(1) Standard identifier: -

The names of defined operations in C language are called identifier. For example, scanf and printf represent input and output functions. These are the standard identifiers.

(2) User- defined identifier: -

These are the names that a programmer assigns to function, data type, variable, etc. in a program.


Posted by: Wasim Javed

Write the structure of data type and its memory size in C language

S.No Data type Format specifier Data range Memory occupied

1 Int % d -32768----- +32767 2 bytes

2 Long % ld -2147483648------ +2147483647 4 bytes

3 Float % f 3.4*10-38------- 304*10+38 4 bytes

4 Double % lf 107*10-108------ 1.7*10+108 8 bytes

5 Char % C -128------ +127 1 bytes


Posted by: Wasim Javed

Write advantages of C language

Advantages:-

1. As the syntax of C language is very easy and short so it is easier to understand at the begging stage.

2. As its syntax is like by machine language so it is also called middle level language.

3. It is modular programming.

4. It is portable language, portable means that one program witch be written in one computer can easily be run or checked on another computer.

5. It is graphical language that is why its modern version likes C++ and visual C etc. They are use in graphical programming.


Posted by: Wasim Javed

What is ampersand sign

Ampersand sign:-

When we input data with scanf ( ) function, then variable is joined with a special character and which is called ampersand sign and it is used for the address of that data and without this character we can not input any data in to variable.

Posted by: Wasim Javed

What is an input and output statement in C language

The input statement: -
Input is that statement which is used to give data to the variable in the program. For C language the main input statement is scanf ( ). It is used in the program will be as:

Scanf (“format specifier”, ampersand sign variable);

For example:

Scanf (“%d or %f or %c or %s”, &a);
%d format specifier is used for integer type data.
%f format specifier is used for real type data.
%c format specifier is used for character type data.
%s format specifier is used for string type data.
The symbol & (ampersand sign) is used with scanf ( ) function and it is used to show the address of data.

The output statement: -

The output statement is that statement is used to display the result on screen. For this purpose the function printf ( ) is used. We can use it
Printf (“Message”);
Printf (“format specifier”, variable);
Printf (“%d or %f or %w”, sum);

Posted by: Wasim Javed

Explain introduction and history of C language

Introduction: -

C is a programming language developed by Dennis Ritchie in 1972. Programs are structured by defining and calling functions. Program flow is controlled using loops, if statements and function calls. Input and output can be directed to the terminal or to files. Related data can be stored together in arrays structures. C allows the most precise control of input and output.

History of C language: -

C is a general purpose programming language. It was developed at AT&T Bell Laboratories, USA in 1972. It was designed and developed by Dennis Ritchie. It was based on an earlier computer language called B. The B language was developed by Ken Thompson in 1969-70. For this reason, earlier version of the C language was called K&R C (Kernighan and Ritchie C).

The C language is a simple, easy to learn and powerful language. As more and more people started using C language, need to standardize its rules was felt. To meet this need, the American National Standards Institute (ANSI) developed a standard for the C language in late 80s. This version of the C language is known as ANSI C.

Posted by: Wasim Javed

Difference between low and high level languages

Low level language: -

It is actually initial computer language. It is categorized into two types

(1) Machine language (2) Assembly

(1) Machine language: -

It is the directly computer understood language. That computer language with does not need convert into any other interface or language for the understanding of computer. This language consists of binary digit these are (0, 1).

(2) Assembly language: -

It is low level language but one step higher then machine language. This language is always needed to first convert in to machine language and then computer can understood it. For this purpose a converter program “Assembler”.
High level language: - The programming languages that are close to human language are called high level language. The instructions in those languages are more like human language. Unlike low level language, these languages are sassier to learn. These languages are BASIC, FORTRAN, COBEL, PASCAL, C, C ++, etc. These languages are used for writing application programs. Every high level language has its own set of rules for writing program.

These rules are called the syntax of the language. A program written in a high level language is called source program or source code. Source code cannot be run directly on the computer. It is first translated or converted into the machine language. The application that is used to convert a source program into machine program is called compiler.

Posted by: Wasim Javed

Briefly describe the basic structure of C program

Basic structure of C program: -
The logic according to witch a program is written is called the structure of the program. The structure of basic C program consists of two main parts. These are:
. Preprocessor Directives
. The main ( ) function
The structure of a C language program will be as:
Main ( )
{
Declaration phase
Input phase
Processing phase
Output phase
}
Every program of C language must be given and to save program with extension .C with its name. It is the name which is given to our work when we save it permanently in computer.
The symbol dot (.) one, two or three character are given differentiate or to specify the name of file with respect to its program.


Posted by: Wasim Javed

Programming languages

A computer programs is written in a specific manner and according to a set of rules. These rules are called the computer language. It is also interface between computer and user.

Posted by: Wasim Javed

language, computer language and compiler

Language: -
It is an interface between the people like Urdu, English etc.

Computer language: - It is also an interface between computer and user.

Compiler: - This translator or converter program is used to convert a program in to machine language but as a whole.

Posted by: Wasim Javed

English medium education

English medium education

An English medium education system is one that uses English as the primary medium of instruction. A medium of instruction is the language that is used in teaching. The language used may or may not be the official language of the territory. Most schools and institutions of education in modern-day mainly English-speaking countries such as the UK, United States, Ireland, Australia and New Zealand use English as the medium of instruction.

Because a working knowledge of English is perceived as being required in many fields, professions, and occupations, many states throughout the world mandate the teaching of English, at least a basic level, in an effort to increase the competitiveness of their economies.

The language researcher David Graddol predicts that the global spread of English will lead to serious economic and political disadvantages in the future in the UK unless plans are put in place immediately to remedy the situation. Graddol concludes that monolingual English graduates face a bleak economic future as qualified multilingual young people from other countries are proving to have a competitive advantage over their British counterparts in global companies and organisations.

Historical background

English medium education has long been associated with the expansion of English from its homeland in England and the lowlands of Scotland and its spread to the rest of Great Britain and Ireland.

The influence of the British Empire is the primary reason for the language's initial spread far beyond the United Kingdom. Following World War II, the increased economic and cultural influence of the United States led to English permeating many other cultures, chiefly through development of telecommunications technology.

English linguistic imperialism as "the dominance asserted and maintained by the establishment and continuous reconstitution of structural and cultural inequalities between English and other languages."

Phillipson's theory provides a powerful critique on the historical spread of English as an international language and how it continues to maintain its current dominance particularly in postcolonial contexts like India but also increasingly in "neo-colonial" contexts such as continental Europe. His theory draws mainly on Johan Galtung's imperialism theory, Antonio Gramsci's social theory and in particular his notion of cultural hegemony.

The Islamic Republic of Pakistan

The Government of Pakistan has recently announced the introduction of English lessons on a phased basis to all schools across the country. This new policy states that "English language has been made compulsory from Class-1 onwards" and the "Introduction of English as medium of instruction for science, mathematics, computer science and other selected subjects like economics and geography in all schools in a graduated manner." Caretaker Minister for Education Mr. Shujaat Ali Beg declared January 25, 2008 that eighteen colleges of the city of Karachi would be made "Model English Medium Colleges,"

Posted by: Wasim Javed

Course Outline for B.Sc Physics Paper B

PAPER B TH: 30, PRACTICAL: 15(Only one Practical with Both Papers A and B)

Paper-B

{Waves and Oscillation}

Main Topics
Harmonic Oscillations


Simple harmonic oscillation
(SHM)


(Obtaining and solving the basic equations of motion x (t), v (t), and a (t). Energy)

Consideration in S.H.M

Application of SHM

(Torsional oscillation, Physical pendulum, Simple pendulum)

SHM and uniform
Circular motion,
Combination of Harmonic
Motion


(Lissaajous patterns)

Damped Harmonic
Motion


(Equation of damped harmonic motion, Discussion of its solution)

Forced Oscillation
And Resonance


(Equation of forced oscillation, Discussion of its solutions, Examples of resonance)

Waves

Mechanical waves
Traveling waves


(Phase velocity of traveling waves, Sinusoidal waves, Group speed and dispersion)

Waves speed

(Mechanical analysis)

Wave equation

(Discussion of solution)

Power and intensity
In waves motion

(Derivation & Discussion)

Principle of superposition
(Basic Ideas)


(Interference of waves, Standing waves, Phase changes on reflection, Natural frequency, Resonance)

Sound

Beats phenomenon

(Analytical treatment)



Doppler Effect

(Moving source, Moving observer, both object and source moving)

Light

Nature of light

(Visible light {Physical characteristics})

Light as an electromagnetic
Wave


(Speed of light in matter, Physical aspects, Path difference, Phase difference etc)

Interference

Adding of electromagnetic
Waves using phasors


(Coherence of sources, double slit interference, Analytical treatment)

Interference from films

(Newton’s ring {Analytical treatment})

Michelson interferometer


(Discussion to include use of a compensating plates, Michelson interferometer use in determining velocity of light)

Fresnel’s biprism and its use

Diffraction


(Diffraction at single slit, Intensity in single slit diffraction using phasor treatment and analytical treatment using addition of waves, Double slit interference & diffraction combined, Diffraction at a circular aperture)

Diffraction from
Multiple slits


(Discussion to include width of the maxima)

Diffraction grating

(Discussion, Use in spectrographs, Dispersion and resolving power of gratings)

Holography

(Qualitative discussion)

Polarization


(Basic definition, production of polarization
By polarizing sheets, by reflection, by double refraction and double scattering)

Description of
Polarization states


(Linear, Circular, elliptic polarization)

Rotation of plane
Of polarization


(Use of Polari meter)


Thermodynamics
And Statistical
Mechanics


Temperature, Kinetic
Theory of the ideal gas,
Work done on an ideal
Gas


(Review of previous concepts)

Internal energy of
And ideal gas


(To include the Equipartation of energy)

Intermolecular forces
Qualitative discussion


(Vander Waals equation of state)

Statistical
Mechanics


Statistical Distribution
And mean values

(Mean free path and microscopic Calculations of mean free path)

Distribution of molecular
Speeds, Distribution of
Energies


(Maxwell distribution, Maxwell
Boltzmann energy distribution, internal
Energy of an ideal gas)


Brownian motion

(Qualitative description, Definition, Conduction and

Thermodynamics
And Statistical
Mechanics



Temperature, Kinetic
Theory of The ideal gas,
Work done on an ideal
Gas


(Review of previous concepts)

Internal energy of and
Ideal gas


(To include the Equipartation of energy)

Intermolecular forces
Qualitative discussion


(Vander Waals equation of state)

Statistical Mechanics

Statistical Distribution
And mean values


(Mean free path and microscopic Calculations of mean free path)

Distribution of molecular
Speeds, Distribution of
Energies



(Maxwell distribution, Maxwell
Boltzmann energy distribution, internal
Energy of an ideal gas)

Brownian motion

(Qualitative description, Definition, Conduction and
Viscosity)



Heat

Review of previous
Concepts, First law
Of thermodynamics,
Transfer of heat


(First law of thermodynamics & its application to adiabatic, isothermal, cyclic and free expansion)


Entropy &
Second law Of
Thermodynamics

Reversible an irreversible
Processes, Second law
Carnot cycle, Carnot
Engines


(Definition, discussion, Heat engine,
Refrigerators & Second Law, Calculation of Efficiency of heat engines)


Posted by: Wasim Javed

Course Outline for B.Sc Physics Paper A

PAPER A TH: 30, PRACTICAL: 15(Only one Practical with Both Papers A and B)

Paper-A

{Mechanics}

Main Topics

Vector Operations:

Vector in 3 dimensions

(Introduction, Direction of cosines, Spherical polar coordinates, Applications)

Vector Derivatives and
Operations


(Divergence and curl of a vector, Gradient of a scalar)

Gradient, Divergence
And curl of a vector


(Physical applications of each types, Divergence and flux of a vector field, Curl and line integral {Mutal Relation}

Divergence Theorem

(Derivation, Physical importance and applications to specific cases, converting from differential to integral forms)

Stokes Theorem

(Derivation, Physical importance and applications to specific cases, converting from differential to integral forms)

Particle Dynamics

Advanced applications
Of Newton’s Law


(Electrical forces, Microscopic basis of this force)

Dynamic of uniform
Motion


(Conical pendulum, the rotor, Circular the banked curve)

Equation of motion

(Deriving kinematics questions X {V}, V {T} using integrations, Constant and non constant, Forces and special examples)

Time dependent forces

(Obtaining X {T}, V {T} for this case using integration method)

Effect of drag forces
On motion


(Applying Newton’s law to obtain V {T} for the case of motion with time dependent drag {Viscous} forces, Terminal velocity, Projectile motion / air resistance)

Non inertial frames
And pseudo forces


(Qualitative discussion to develop understanding, Calculation of pseudo forces for simple cases {linearly accelerated references frame}, Centrifugal forces as an example of pseudo forces, Carioles forces)

Limitations of Newton’s
Law discussion


Work and Energy

Work done by a constant
Forces, Work done by a


Variable force {1 Dimensional}

(Essentially a review of grade-XII concepts use of integration technique to calculate work done, {e.g. in vibration of a spring obeying Hooke’s law}

Work done by a variable
{2 Dimensional cases}


(Obtaining general expression force and applying to simple cases e.g. pulling a mass at the end of a fixed sting against gravity)

Work energy theorem.
General proof of work
Energy theorem


(Qualitative review of work energy theorem, Derivation using integral calculus, Basic formula, Applications)

Power

Reference frame

(Energy changes with respect to observers in different inertial frames)


Conservation of energy

Conservative, None
Conservative forces


(Definition of either type of force & examples, Work done in a closed path)

(1-D conservative system, Force as the gradient of potential energy, Application to the case a spring and force of gravity)

1 dimensional
Conservative system


(Obtaining velocity in the terms of U and E, Stable, Unstable and neutral equilibrium, Analytic solution for X {T})

2, 3 dimensional
Conservative system


(Change in P.E, for motion in 3-d, Force as the gradient of the potentials, Work done in 2, 3dimensional motion)

Conservation of energy
In a system of particles


(Law of conservation of total energy of an isolated system)

System of Particles

Two particle systems
And generalization to
Many particle systems


(Centre of mass, its position velocity and equation of motion)

Centre of mass of
Solid objects


(Calculation of centre of mass of solid objects using integral calculus, Calculating C.M of
1. Uniform rod
2. Cylinder
3. Sphere

Momentum changes
In a system of variables
Mass


(Derivation of basic equations, Application to motion of a racket {Determination of its mass as a function of time})

Collision

Elastic collision:

Conservation of
Momentum during collision


(a) One dimension
(b) Two dimension {oblique collision}

Inelastic collision,
Collision in centre
Of mass reference frame


(One and two dimensions, Simple application, Obtaining velocities in C.M frame)


Rotational Dynamic

Overview of rotational
Dynamics


(Relation ship between linear & angular variables, Scalar vector form, Kinetic energy of rotation, Moment of inertia)

Parallel axis theorem

(Prove and illustration, Apply simple mass)

Determination of moment
Of inertia of various shapes,
Rotational dynamic of rigid
Bodies


(Equation of rotational motion and effects of application of torques)

Combine rotational
And transnational motion


(Rolling without slipping)

Angular Momentum

Angular velocity


(Definition, Conversion of angular momentum, Effect of torque)

Stability of spinning
Objects


(Discussion with example)

The spinning top

(Effects of torque on the angular momentum, Processional motion)

Gravitation

Review of basic concepts
Of gravitation, Gravitational
Effect of a spherical mass
Distribution


(Mathematical treatment)


Gravitational potential
Energy


(Develop using integration techniques, Calculation of escape velocity)

Gravitational field &
Potential


(Develop the idea of field of force)

Universal gravitational
Law


(Motion of planets and Keplers law {Derivation & Explanation} Motion of satellites, Energy considerations in planetary and satellite motion, Qualitative discussion on application of gravitational law to the galaxy)

Bulk Properties of
Matters


Elastic properties of matter

(Physical basis of elasticity tension, Compression & shearing, elastic modulus, Elastic limit)

Fluid Statics

(Variation of pressure in fluid at rest and with height in the atmosphere)

Surface tension

(Physical basis, Role in formation of drop and bubbles)

Fluid Dynamics

(General concept of fluid flow streamline and the torque of continuity)

Bernoulli’s Equation

(Derivation and some applications such as dynamic lift thrust on a rocket)

Viscosity

(Physical basis, obtaining the coefficient of viscosity, Practical example of viscosity, Fluid flow through a cylindrical pipe {poisenille’s law})

Special Theory of Relativity

Trouble with classical
Mechanics


(Qualitative discussion of the inadequacy or paradoxes in classical ideas of time, Length, and velocity)

Postulates of relativity

(Statements and discussion)

The Lorentz transformation
Inverse transformation


(Derivation, Assumption on which derived, Application of the same transformation of velocities)

Consequences of Lorentz
Transformation


(Relativity of time, Relativity of length)

Relativity momentum

(Derivation)

Relativistic energy



(Derive E=mc2), {E=mc Square}


Posted by: Wasim Javed

The array of 5 element in the main function and call a function to sort the given the array and the sorted list will be displayed in the main function

Main()
{
int n[5],I;
for(i=0;i<=4;i++)
{
printf(“Enter the number\n”);
scanf(“%d”,&n[i]);
}
sorting(n[0]);
printf(“The sorted list\n”);
for(i=0;i<=4;i++)
printf(“%d\n”,n[i]);
getch();
}
sorting (int *k)
{
int I,j,t;
for(i=0;i<4;i++)
for(j=i+1 ;j<=4 ;j++)
if(*(k+i)>* (k+j ))
{
t=*(k+I );
*(k+i)=*(k+j);
*(k+j )=t;
}
}


Posted by: Wasim Javed

Problem 6

main()
{
int l[10] ,I ,j, s;
for(i=0; < 10 ;i++)
{
printf(“Enter a number \n”);
scanf(“%d”,&l[i]);
s= summation (&l[0]);
printf(“sum=%d\n”,s);
}
summation (int *p)
{
int j,sum=0;
for(i=0 ;j<10 ;j++)
sum +=*(p+j);
return( sum);
}


Posted by: Wasim Javed

Problem 5

main()
{
int n,m,c;
printf(“Enter two number \n”);
scanf( “%d %d “,&n, &m);
c=addition (&n, &m);
printf(sum of sequres =%d”,c);
}
addition ( int* p1 ,int *p2)
{
intr ;
r=* p1 *p2 +p2 *p2;
return ( r);
}


Posted by: Wasim Javed

Palindrome

main()
{
char ch [10];
int I, l;
printf(“Enter string \n”);
gets ( ch);
l= strlen (ch);
printf(“In reverse order \n”);
for( i=l; i>=0; i- -)
printf(“%c\n”,ch [i]);
}
Declare pointer of pointer
Example
Main()
{int x=20;
int *px;
px =&x;
print{“%d”,*px);
}
Proto typing
Int *a ,b ,c;
B=10;
A=&b;
C=*a;

Pointer to function
Example
Main()
{
int display ( );
func-ptr =display ;
printf(“address of function display is %, fun-ptr”);
}
int display ( )
{
puts (“Wasim javed \n”);
}
Swap Function
(1) Function swap(int a, int b);
{
int temp;
temp =a;
a =b;
b= temp;
}
(2) function swap (int*a, int*bb);
{
int temp;
temp =*a;
*a =*b;
*b = temp;
}


Posted by: Wasim Javed

Problem 4

Main()
{
char source [ ] = “folks”, target[30] =”Hello”;
strcat( target ,source)
printf(source =%s\n”, source );
printf(“target =%s \n”,target);
}


Posted by: Wasim Javed

Problem 3

Main()
{
char source [ ] =”Hello”;
char target [20];
strcpy (target , source);
printf(%s %s “, source , target );
}


Posted by: Wasim Javed

Problem 2

Main()
{
char arr[ ] =”Wasim”
int l 1, l2;
l 1=strlen (arr);
l 2=strlen(Hello How are you\n”);
printf(“string =%s length =%d\n”,arr ,[1);
printf(“string =%s length =%d\n”, Hello How are you ,l 2);
}


Posted by: Wasim Javed

Problem 1

Main()
{
char arr[ ] =”Wasim”
int l 1, l2;
l 1=strlen (arr);
l 2=strlen(Hello How are you\n”);
printf(“string =%s length =%d\n”,arr ,[1);
printf(“string =%s length =%d\n”, Hello How are you ,l 2);
}


Posted by: Wasim Javed

To remove a specified character.

Main()
{
char s[80];
int p;
printf(“Type string and position to removed \n”);
gets ( s );
scanf(“%d”,&p);
strcpy (&s[p], &[p+1] );
puts (s);
}


Posted by: Wasim Javed

WAP to read a sentence and print all lower case to upper case and upper case to lower case.

Main()
{
char s[32];
int I,l;
printf(“Enter Sentence\n”);
gets( s);
l=strlen( s);
for(i=0 ;i<= l;i++)
{
if (( s[i]>=’a’ && (s[i]<=’z’)
s[i]- =32;
s[i]+=32;
}
puts(s);
}


Posted by: Wasim Javed

WAP to read a sentence and count a specific letter (LOOP)

Main()
{
char s[30],ch;
int c,l,t=0;
printf(“Enter letter to counted\n”);
ch =getche();
l = strlen( s);
for(i=0 ;i<=l ;I ++)
{
if(s[i] = =c)
t++;
}
printf(“%c comes %d times “,ch ,t);
}


Posted by: Wasim Javed

Read a sentence and count vowel ,uppercase to lower case

main()
{
char s[20];
int v, l , u ,l g;
gets (s);
lg= strlen (s)
for (i=0; i<=lg ;i++)
{
if (s [i]>= ‘A’ && s[i]<= ‘Z’)
u++;
if( s[i]>=’a’ && s[i]<=’z’)
l++;
if (s [i] ==’a’)II s[i]==’z’) II( s[i] == ‘I’) II(s[i] ==’o’) II(s[i] = =’u’)
v++;
}
printf (“Total upper case letter = %d”, u);
printf(“Total lower case letter = %d”, u);
printf(“Total vowel case letter =%d “,u);
}


Posted by: Wasim Javed

Program

main()
{
char name[25];
printf” Enter your name\n”);
scanf(“Hello %s !”, name );
}


Posted by: Wasim Javed

Program to display a string

main()
{
char name[ ]=”Wasim javed “;
int l;
for(i=0 ;i<=7 ;i++)
printf (“%c”, name [i]);
}


Posted by: Wasim Javed

Sorting in Descending order

main()
{
int l[30],I, j, t;
for(i=1 ;i<=10;i++)
{
printf(Enter a number\n”);
scanf(“%d,&l[l]);
}
for(i=1 <10;i++)
if( j=l+;j<=10;j++)
if(l[i]>l[j=1])
{
t=l[i];
l[i]=l[i];
l[j+1]=t;
}
printf(sorted list\n”);
for(i=1 ;i<=10;j++)
printf(“%d\n”,l[i]);
}


Posted by: Wasim Javed

sorting in ascending order

main()
{
int l [30]; I; j;t;
for(i=l; i<=10; i++)
{
printf(“Enter a number \n”);
scanf(“%d”,&l[l]);
}
for(i=l; i<10; i++)
for(j=l+1; j<=10 ;j++)
if( l[l]>l[j])
{
t=l[i];
l[i]=l[i];
l[i]=t;
}
printf(“sorted list \n”);
for(i=1; i<=10; i++)
printf(“%d\n”,l[i]);
}


Posted by: Wasim Javed

Binary Search

main()
{
int a[10] ,f=0,l=0 ,loc=0, n,l,md;
printf(Enter the data in sorted order\n”);
for(l=0 ; l <10 ;l++)
{
printf((Enter no\n”);
scanf(“%d”,&a[l]);
printf(Enter no to be searched \n”);
scanf(“%d”,&n);
while(f{
mid=f+l)/2;
if(a[mid]==n);
{
loc=mid+1;
break;
}
if(a[mid]>n)
l=mid-1;
if(a[mid]f=mid+1;
}
jif(loc>=0);
printf(element is not found\n”);
else
printf(“element at location=%d\n”loc);
}


Posted by: Wasim Javed

Bubble sort

main()
{
int a[50],l,j,t,n;
pritnf(“Enter total element to be sorted\n”);
scanf(“%d”,&n);
for(l=0;l{
printf(“enter a number\n”);
scanf(“%d”,&a[l]);
}
for(l=0; lfor(j=0 ;jif(a[j]< a[a+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
printf(sorted list\n”);
for(l=0; lprintf(“%d\n”,a[j]);
getch();
}


Posted by: Wasim Javed

Example of linear or sequential search

main()
{
inta[10],sr,I,loc=0, f=0;
for(i=0, i<=10,i++)
{
printf(“Enter the number\n”);
scabf(“%d”,&a[i]);
}
printf(Enter the number to search\n”);
scanf(“%d”,&sr);
i=0;
while(i<10&&f==0)
{
if(sr==a[i])
{
f=1;
loc=i+1;
}
else
i++;
}
if(f==1)
printf(“Element is found at location=%d\n”,loc);
else
printf(Element is not found\n”);
getch();
}
}


Posted by: Wasim Javed

Sum of Dignal matrix

main()
{
int r,c sum=0 ,mat[3][3];
printf(“Enter first matrix\n”);
for(r=0; r<2; r++)
for(c=0; c<2; c++)
scanf(“%d”,&mat[r][c]);
for(r=0; r<2; r++)
{
printf(“%d/t”,mat[r][c]);
sum=sum+mat[r][c];
}
printf(“\n”);
printf(“Sum of matrix =%d\n”,sum);
getch();
}


Posted by: Wasim Javed

Multiplication of two matrix

main()
{
intr,c,k,n[3][3],m[3][3],res[3][3];
printf (Enter first matrix \n”);
for(r=0; r<3;r++);
for(c=0; c<3 ;c++);
scanf(“%d”,&n[r][c]);
printf(“Enter second matrix\n”);
for(r 0;r<3 ;r++);
for(c 0;c<3 ; c++);
scanf(“%d”,&m[r][c]);
for(r 0;r <3;r++);
for( c0; c<3; c++);
{
res[r][c]=0;
for(k=0 ;k<3 ;k++);
res[r][c]=res[r][c]+n[r][k]*m[k][c]);
}
printf(“Multiplication of matrix\n”);
for(r=0; r<3;r++)
{
for(c=0; c<3 ;c++)
printf(“%d/t”,res[r][c]);
printf(“\n”);
}
}


Posted by: Wasim Javed

Addition of two matrix

main()
{
int n[5][5], m[5][5],l ,j ,res[5][5];
printf(Enter first matrix\n”);
for(i=0<5;l++)
for(i=0; j<5; j++)
scanf(“%d”,&n[l][j]);
printf(“Enter second matrix\n”);
for(i=0 ;l< 5;l++)
for( j=0; j<5 ;j++)
res[l][j] =n[l][j] +m[l][j];
printf(“Resultant matrix\n”);
for(i=0 ;l<5 ;l++)
{
for(i=0; l<5 ;j++)
printf(“%d/t “,res [l][j]);
printf(“\n”);
getch();
}
}


Posted by: Wasim Javed

Sum of matrix

main()
{
int r,c sum =0, mat[3][3];
printf((“Enter first matrix\n”);for(r=0; r<2; r++);
for(c=0; c<2; c++)
{
printf(“%d/f”,mat[r][c]);
sum= sum+mat[r][c];
}
printf(“\n”);
printf(Sum of matrix =%d\n”,sum);
getch();
}
}


Posted by: Wasim Javed

Display the Largest number and position

main()
{
int l[10], lg, ps =1;
for(i=0 ;i<=9;i++)
{
printf(“Enter number\n”);
scanf(“%d”,&l[i] );
}
lg=l[1];
for(i=2; i<=9 ;i++);
}
if(lg{
if (lg=l[i];
ps= I;
}
printf(“largest No =%d/t\n”, lg);
printf(“position of numbers =%d\n”,ps);
getch();
}


Posted by: Wasim Javed

Display the smallest Number And Position

main()
{
int t[10],sam,I,p=0;
for(i=0;i<=9;i++);
{
printf(“Enter numbers\n”);
scanf(“%d”,&t[i]);
}
sam =t[10];
for(i=0;i<=9;i++);
{
if(sam>t[i] )
{
sam=t[i];
p=++I;
}
printf(“smallest = %d/t %d”,sam,p);
getch();
}


Posted by: Wasim Javed

Sum of ten numbers

main()
{
int a[10],sum =0,I;
float avg;
for (i=0<=9;i++);
{
printf(“Enter numbers\n”);
scanf(“%d”,&a[i]);
}
for (i=0,i<=9;i++);
sum +=a[i];
avg =aum/10;
printf(“Sum =%d”,sum);
printf(“average =%f”,avg);
getch();
}


Posted by: Wasim Javed

Display The List Of Numbers

main()
{
inta[10],I;
for(i=0;i<=9,i++)
{
printf(“Enter the number\n”);
scanf(“%d”,&a[i]);
}
printf(“The list of number \n”);
for(i=0<=9,i++)
{
printf(“%d\n”,a[i]);
}
}


Posted by: Wasim Javed

Write a program to perform simple arithmetic operation by using switch statement.

Main()
{
int a,b;
char opt;
clrscr();
printf(“Enter any two integer value\n”);
scanf(“%d %d “,&a, &b);
printf(“Enter your option for operation +,-, *, /n”);
scanf(“%c”,opt);
switch(opt)
{
case ‘+’;
printf(“\n\t %d+%d+%d”,a,b,a+b);
break;
case’-‘;
printf(“\n \t %d =%d”, a,b, a-b;
break;
case’*’;
prinff(“\n \t %d+%d=%d”, a,b, a*b);
break;
case’/’;
printf(“\n \t %d %d =%d”,a,b,a/b);
break;
printf(“\n \n press any key to list”);
getch();
}
}


Posted by: Wasim Javed

Write a program that will find the sum of those integers. Which are divisible by 2 and are not complete square. The integers should be less then 100

main()
{
int sum=0,I,t;
for(i=2;i<=100; i=i+2)
}
t=sqrt(i);
if(t*t t=i)
sum=sum+I;
}
printf(“%d”,sum);
}


Posted by: Wasim Javed

Program to find sum of digits (1-20) using if and goto statement

main()
{
int
clrscr();
n=1;
s=0;
abc;
s=s+n;
n=n+1;
if(n>=20)
goto abc;
print(“Sum of digits =%d\n”,s);
getch();
}


Posted by: Wasim Javed

This program will perform arithmetic operation depending on your choice (Switch Statement).

Main()
{
int a,b,ch;
printf(“Enter first number\n”);
scanf(“%d”,&a);
printf(“Enter second number\n”);
scanf(“%d”,&b);
printf(“ Enter your choice\n”);
scanf(“%d”,&ch
}
case 1: printf(“Addition =%d\n”,a+b);
break;
case 2: printf(“Subtraction =%d\n”,a-b);
case 3: printf(“Multiplication =%d\n”,a*b);
break;
case 4:printf (“Division=%d\n”,a/b);
break;
default:
printf(Invalid Choice\n”);
}


Posted by: Wasim Javed

A quick demo of nested if-else statement(Nested “If –Else” Statement)

main()
{
int l;
printf(“Enter either 1 or 2”);
scanf(“%d”,&l);
if (I == 1)
printf(“You would go to heavent\n”);
else
{
if(I ==2)
printf(“Hell was created with you in mind”);
else
printf(“How about mother earth l”);
getch();
}
}


Posted by: Wasim Javed

Write a program to input three integer values. Compare the three values to find out if they are equal .Use “ nested if statement”

Main()
{
int r,n,b;
clrscr();
printf(Enter first value ?\n”);
scanf(“%d”,&r);
printf(“Enter second value ?\n”);
scanf(“%d”,&n);
printf(“Enter third value ?\n”);
scanf(“%d”,&b);
if(r==n)
{
if(r==b)
printf(“All values are equal\n”);
}
else
printf(“These values are different\n”);
}


Posted by: Wasim Javed

Write a program to calculate the division obtained by the student(Using Else-if Statement).

Main()
{
int mks;
float per;
char g;
printf(“Enter your marks\n”);
scanf(“%d”,&mks);
per=mks*100/850;
if((per>=80)&&(per<=100))
g=’A’
else if ((per>=60)&&(per<=80))
g=’B’
else if ((per>=40)&&(per<=60))
g=’C’
else if ((per >= 30)&&(per< = 40))
g=’D’
else
printf (marks = %d\n”,mks);
printf (“marks = %f \n”,per);
printf(“marks =%c\n”,g);
getch();
}


Posted by: Wasim Javed

Write a program to calculate the division obtained by the student (Block of Statements).

Main()
{
int m1,m2,m3,m4,m5,per;
print(“Enter marks in five subjects”);
scanf(“%d %d %d %d %d”,&m1,&m2,&m3,&m4,&m5);
per=(m1+m2+m3+m4+m5)/5;
if(per>= 60)
printf(“First division”);
else
{
if ( per>=50)
printf(“Second division”);
else
{
if ( per >=40)
printf(“Third division”);
else
printf(“Fail”);
}
}
}

Posted by: Wasim Javed

Program using if-else statement to find the largest number in the given three numbers (If Else Statement).

Main()
{
int n,m,k;
printf(“Enter three numbers\n”);
scanf(“%d%d%d”,&n,&m,&k);
if((n>m)&&(n>k))
printf(“Greater no=%d\n”,n);
else
if(m>n&&m>k)
printf(“Greater no=%d\n”,m);
else
if(k>n&& k>m)
printf(“Greater no =%d\n”,k);
getch();
}


Posted by: Wasim Javed

Determine whether the number is positive or negative or zero(If Statement).

Main()
{
int num;
printf(“Enter the number\n”);
scanf(“%d”,&num);
if(num >0)
printf(“num is pocitve =%d\n”,num);
if(num<0)
printf(“num is negative =%d\n”,num);
if(num=0)
printf(“num is zero =%d\n”,num);
getch();
}


Posted by: Wasim Javed

Write a program to input the age of a person in years. Convert the age into months and days and print the result in the center of the screen

Main()
{
long int age,mon,days;
clrscr();
printf(“Enter age in years ?”);
scanf(“%d”,& age );
mon=age*12;
days=age*365;
gotoxy(35,12);
printf(“Age in months = %d”, mon);
gotoxy(35,13);
printf(“Age in days =%d”,days);
getch();
}


Posted by: Wasim Javed

Write a program to compute the area of a triangle

main()
{
int a,b,c;
double area, s;
a=115;
b=163;
c=210;
s=(a+b+c)/2..0;
area=sqrt (s* (s-a)* (s-b)* (s-c);
clrscr ();
printf( “/n Calculate Area= %f”,area);
}


Posted by: Wasim Javed

Program to declare and initialize data into string type variables name & city and print these variables on the screen by using the printf function.

main( )
{
char name [15]=”wasim javed”;
char city[25]=”D-I-khan”;
clrdcr ();
printf(“ Name: % s/n”,name);
printf(“city: % s/n”,city);
getch();
}


Posted by: Wasim Javed

Write a program to input a string by using “gets” function and thenprintit on the screen by using the “puts” fuction.

main( )
{
char str[20];
clrscr ();
puts (“Enter a string ? ”);
gets (str);
puts( The string is :”);
puts(str);
getch ();
}


Posted by: Wasim Javed

Kinetic Energy of a body of mass “m” moving with velocity “v” input the mass and velocity of a body during program execution(Kinetic Energy=1/2 mv^2).

main( )
{
float m,v,ke;
printf(“/n enter value of m,v”);
scanf(“%f % f”,&m,&v);
ke=1/2*m*v*v;
printf(
‘/n KR= %f “,ke);
}

Posted by: Wasim Javed

Program to compute the distance covered by a car in 50 seconds. The initial velocity is m/sec and acceleration is 5m/sec^2. Use formula s=vit+1/2 at^2

main( )
{
int t,vi,a;
double s;
t=50;
vi=10;
a=5;
s=vi*t+0.5*a*t*t;
clrscr ();
printf(“Distance Covered =%f m”,s);
}


Posted by: Wasim Javed

If a five digit number is input through the keyboard, write a program to reverse the number.

main( )
{
int n,r;
printf(“/n Enter a number”);
scanf(“%d”, &n);
Printf(“/n The number in revers”);
r= n%10;
n=n/10;
printf(“Reminder=%d”,r);
r=n%10;
n=n/10;
printf(“Reminder=%d”,r);
r=n%10;
n=n/10;
printf(“Reminder=%d”,r);
r=n %10;
n=n /10;
printf(“Reminder of r % d Reminder of n %d”,r,n);
}


Posted by: Wasim Javed

Temperature of a city in Fahrenheit degrees is input through the keyboard.Write a program to convert this temperature into centigrade degrees.

main( )
{
float f,c;
printf(“/n Enter temperature”);
scanf(“%f”,&f);
c=5.0/9.0*(f-32.0);
printf(“/n f=%f /t c=%f, fc);
}


Posted by: Wasim Javed

Find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that con be obtained in each subject is 100.

Main( )
{
int m1,m2,m3,m4,m5, sum;
float agg,per;
printf(“/n Enter the marks of five subjects”);
scanf(“% d % d % d %d % d “,&m1,&m2,&m3,&m4,&m5);
sum=m1+m2+m3+m4+m5;
agg=sum/5.0;
per=sum*100.0/500.0;
printf(“/n percentage =%f”,per);
}


Posted by: Wasim Javed

Write a program to input the age of a person in years. Convert the age into months and days and print the result in the center of the screen.

main( )
{
long int age, mon, day;
clrscr();
printf(“Enter age in years?”);
scanf(“%d”,&age);
mon=age * 12;
days= age *365;
gotoxy(365,12);
printf(“Age in days=%d”, days);
}


Posted by: Wasim Javed

If a four digit number is input through the keyboard. Write a program to obtain the sum of the first and last digit of this number.

main( )
{
int n,sum ,fd,ld;
Printf(“/n Enter the four digit number”);
Scanf(“%d”,&N);
Id=n%10;
Fd=n/1000;
Printf(“/n First digit is%d and last digit is “,fd,id);
Sum=fd+id;
Printf(“/n Sum of first and last digit =%d”,sum);
}

Posted by: Wasim Javed

Write a program to calculate the area & perimeter of the rectangle, and the area of circumference of the circle.

Main( )
{
int len, wid, r;
float por, aoc, coc;
float pi=3.1417;
printf(“/n Enter the value of length, width &radius “);
scanf(“%d %d %d “,&len, &wid, &r);
por=2*(len+wid);
aor=len+wid;
aoc=pi*r*r;
coc=2*pi*r;
prontf(“/n perimeter of rectangle is % f”,por);
Printf(“/n area of rectangle is %f”,aor);
Printf(“/n arear of circle is %f”,aoc);
Printf (“/n circumference of circle id %f”, coc);
}

Posted by: Wasim Javed

The distances between two cities (in km)is input through the keyboard write a program to convert and print this distance

main( )
{
float km,m ,ft,inc,cm;
printf(“/nEnter the distance b/w two cities in km”);
scanf(“%f”,&km);
m=km*1000;
cm=m*100;
inc=cm/2.54;
ft=inc/12
printf(“/n meter=%f/n centimeter/n %f”,m,cm);
printf(“/n inches=%f/n feet /n %f”,inc,ft);
}

Posted by: Wasim Javed

Nawaz basic salary is input through the keyboard. His dearness allowances us 40% of basic salary. Write a program to calculate his gross salary.

main( )
{
int b_pay;
float d all.h rent, g_pay
printf(“/nEnter The Basic Salary Of Employer”);
scanf(“%d%d”,&b,&pay”);
d_all=b_pay*40.0/100.0
g_pay=b_pay+d_all+h_rent;
Prnitf(“Gross salary of employer is= %f”,g_pay);
}

Posted by: Wasim Javed

Get two numbers display addition, subtraction, multiplication, division of the numbers.

main( )
{
float a,b, ad,sb,mul,div;
printf(“/n enter value of a,b”);
scanf(“%f%f”,&a,&b);
ad=a+b;
sb=a-b;
mul=a*b;
div=a/b;
printf(“/n addition =%f”,ad);
printf(“/n subtraction=%f”,sb);
printf(“/n multiplication =%f”,mul);;
printf(“/n division =%f”, div);
}

posted by: Wasim Javed

write a program to input a string by using “gets” function and then print it on the screen by using the “puts” function (Gets Function)

main( )
{
charstr[20];
clrscr();
puts(“/n Enter a string ?”);
gets(gets);
puts(“The string is”);
puts(str);
getch();
}


Posted by: Wasim Javed

String type variables name &city and print their contents on the screen in left –justified and in right –justified format with field width 30

main( )
{
char name[25]=”wasim javed”;
char city[25]=”D-I-khan”;
clrscr();
printf(“Left – justified /n”);
printf(“%-30s/n”,name);
printf(“%-30s/n”,city);
printf(“Right –justified /n”);
printf(“%-30s/n”,name);
printf(“%-30s/n”,city);
getch();
}

Posted by: Wasim Javed

Input the radius of a sphere. Compute its valume and surface area(“Formula for surface area=4 TT r2 and volume=4/3TTr3 and TT=3.1417(Scanf)

main( )
{
float r,v, area;
clrscr();
printf(“Enter radius of sphere?”);
scanf(“%F”,&r);
area=4.0*3.1417*r*r;
v=(4.0/3.0)*3.1417*r*r*r;
printf(“Volume of sphere =%f/n”,v);
printf(“area of sphere=%f/n”,area);
getch();
}


Posted by: Wasim Javed

write a program to declare and initialize the values to variables x,y&z of char type and then print their contents on screen by(Using printf Function)

main( )
{
char x=’r’ ,y=’n’ ,z =’b’;
clrscr ();
printf(“”Data in x=%c/n”,x);
printf(“”Data in y=%c/n”,y);
printf(“”Data in z=%c/n”,z);
}

Posted by: Wasim Javed

write a program to print a message on the screen by using the printf function (Printf Function)

main ( )
{
clrscr();
printf(“The casting vote of the speaker decided the matter”);
printf(“Examination proved a hard pill for me to swallow”);
getch();
}

Posted by: Wasim Javed

write a program in C to assign three values to three integer type variables r,n &b. Add variables r&n and multiply their sum to variable b

main ( )
{
int r,n, b;
clrscr();
r=2;
n=4;
b=6;
b *=r+n
printf(“Result =%d \n”,b);
getch();
}

Posted by: Wasim Javed

write a program to exchange the values of two variables using assignment and print the exchanged values on the screen( Arithmetic assignment)

main( )
{
int a,b,c;
clrscr();
a=200;
b=100;
c=a;
a=b;
b=c;
printf(“value of a =%d/n”,a);
printf(“ value of b=%d/n”,b);
}

Posted by: Wasim Javed

write a program to find out the greater value from two given values(NOT Operator)

main( )
{
int s,a;
printf(“/n Enter 1st integer value “);
scanf(“%d”,&s);
printf(“/n Enter 2nd Value”);
scanf(“%d”,&a);
! (s>a)? s:a;
printf( “1st is greater”): printf (“ 2nd is greater “);
getch();
}

Posted by: Wasim Javed

write a program in C to implement the “OR” operator (OR Operator)

main( )
{
int s;
char op;
pintf(“Enter Any Character/n”);
sanf(“%c”,&op);
pintf(“Enter Any integer value/n”);
sanf(“%d”,&s);
if((s>o)ll (op==’y’)ll (op==’n’))
printf(“ok, condition is True”);
else
printf(“All relational expression are false”);
}

Posted by: Wasim Javed

Write a program to find out the largest number from three given numbers(AND Operator)

Main( )
{
int r,n,b;
clrscr();
printf(“/n Enter Three Value /n”);
Scanf(“%d %d %d”,&r, &n, &b);
If (( r>n)&& (n>b))
Printf(“1st value is greater”);
Else
If((n>r)&&(n>b))
Printf(“2nd value is greater”);
Else
Printf(“3rd value is greater”);
Getch();
}


Posted by: Wasim Javed

Input two values use conditional operator to find out which value is greater. Print a message on the screen to indicate the greater value

Main( )
{
int r,b,max;
clrscr();
printf(“Enter 1st value\n”);
scanf(“%d”,&r);
printf(“Enter 2nd value\n”);
scanf(“%d”,&b);
max=(r>b)? r;b;
printf(“Greater value is =%d\n”,max);
getch();
}

Posted by: Wasim Javed

Write a program to perform the arithmetic operations by using all arithmetic operators. Also print the result on the screen( Arithmetic Operators)

Main( )
{
int p,s,m,d,r;
p=8+2;
s=8-2;
m=8*2;
d=8/2;
r=8%3;
printf(“Addition of 8 & 2 is = %d/n”,p);
printf(“Subtraction of 8&2 is=%d/n”,s);
printf(“Multiplication of 8&2 is=%d/n”,m);
printf(“Division of 8&2 is=%d/n”,d);
printf(“Remainder of 8/2 is=%d/n”,r);
}

Posted by: Wasim Javed

Difference between Buffer and Spooler

Both buffer and spoolers are used for storing data temporary. The main difference between buffer and spooler is that buffer is used for short term and spoolers are used for long term. Buffer is small and limited while spooler are large capacity to store the data as compare to buffer. For buffer it is necessary to be on line i.e. it is direct communication with computer, on the other hand spool may be either online or offline.

Posted by: Wasim Javed

Difference between paging and segmentation

Difference between paging and segmentation:-

Paging and segmentation are closed relative to each other but they have following difference.

1. Paging divides the virtual memory in physical memory areas while the segmentation divides it logically.

2. Paging divides the memory in fixed length memory areas while segmentation divides into variable length memory areas.

3. In segmentation a full logical portion of the process in loaded, but in paging information about page is loaded.

4. The segments are large length as compare to page.

5. In segmentation memory is divided into segments through software and in paging the memory in divided through hardware.

Posted by: Wasim Javed

Memory Management

Swapping:-

Swapping is a system by which use the memory efficiency mostly in time sharing system. In swapping system inactive process are kept on the backing storage, whenever required the process is allocated a time slice and process is laded into memory on computer of time slice or when process is waiting for user to response again, the process is transferred back to the backing storage.
There are two types of swapping system.

1. Simple swapping
2. Complex swapping

1. Simple swapping:-

In this system the main memory is large enough to just the operating system and enough user process and all the processes take to be swapped into a single space when they are allocated a time slice. The time for each process interaction is a follow:

Time of each interaction =Swap in time + CPU time + Swap out time = 2 * Swap time + CPU time Where swap in is the time takes by the computer to load a program from backing storage to main storage and swap out time is the time taken by computer to transfer back a program from main memory to backing storage.
By using simple swapping system we can use a small storage efficiently but main problem is that CPU is under utilized i.e. large amount of time is wasted in swap in and swap out of a program.

Thus another technique called complex sapping is used to over come the CPU under utilization.

2. Complex Swapping:-

In complex swapping when process is in main storage for processing, at the same time the next process I +1 is coming to the main storage for processing while the previous one is going at the same time, by doing so we can increase the efficiency of CPU. Thus in this system CPU will not have to want for the process of swap in or swap out, which increase the utilization of CPU. So by this system we increase the efficiency of CPU as complex to simple swapping system.

Fragmentation:-

Fragmentation is a memory management problem which occurs during swapping of process in a swapping system. When process is swap out, they left behind a free space in the memory these space are of variable length so when the process is going to be transferred its free space can not be utilized completely.

If the incoming process contains 5 KB and total space is 8 KB in these partitions as follow:

But still program cannot be loaded into the main memory although total space is greater then program space. So it causes is fragmentation called external fragmentation. Now if we have a process of 5 KB and space in partition is 8 KB, then 3 KB is left which is cannot be used for any process which cause internal fragmentation.

Segmentation:-

In memory fragmentation problem we have seen that the main memory of computer system become fragmented due to swapping of programs. The new program could not be loaded into memory though available free space is greater then program is purely planed, then we can divide the program into different segments which are certainly be smaller then complete program, and these small pieces would be better able to for into the small opening in the main store. Thus we can see that the division of virtual memory into logical memory area is called segmentation. Memory is divided into logical segments and item of the process having similar characteristics are placed in the same segment. Operating system keep segment take of all these segments which have base lentil values of each segment. A segment of process is loaded for execution when it is required one advantage of segment is that segments can be shared among different process. The information about segments in the segment table is stored sequentially.

Paging System:-Swapping:-

Swapping is a system by which use the memory efficiency mostly in time sharing system. In swapping system inactive process are kept on the backing storage, whenever required the process is allocated a time slice and process is laded into memory on computer of time slice or when process is waiting for user to response again, the process is transferred back to the backing storage.
There are two types of swapping system.

1. Simple swapping
2. Complex swapping

1. Simple swapping:-

In this system the main memory is large enough to just the operating system and enough user process and all the processes take to be swapped into a single space when they are allocated a time slice. The time for each process interaction is a follow:

Time of each interaction =Swap in time + CPU time + Swap out time = 2 * Swap time + CPU time

Where swap in is the time takes by the computer to load a program from backing storage to main storage and swap out time is the time taken by computer to transfer back a program from main memory to backing storage.
By using simple swapping system we can use a small storage efficiently but main problem is that CPU is under utilized i.e. large amount of time is wasted in swap in and swap out of a program.

Thus another technique called complex sapping is used to over come the CPU under utilization.

2. Complex Swapping:-

In complex swapping when process is in main storage for processing, at the same time the next process I +1 is coming to the main storage for processing while the previous one is going at the same time, by doing so we can increase the efficiency of CPU. Thus in this system CPU will not have to want for the process of swap in or swap out, which increase the utilization of CPU. So by this system we increase the efficiency of CPU as complex to simple swapping system.

Fragmentation:-

Fragmentation is a memory management problem which occurs during swapping of process in a swapping system. When process is swap out, they left behind a free space in the memory these space are of variable length so when the process is going to be transferred its free space can not be utilized completely.
If the incoming process contains 5 KB and total space is 8 KB in these partitions as follow:

But still program cannot be loaded into the main memory although total space is greater then program space. So it causes is fragmentation called external fragmentation. Now if we have a process of 5 KB and space in partition is 8 KB, then 3 KB is left which is cannot be used for any process which cause internal fragmentation.

Segmentation:-

In memory fragmentation problem we have seen that the main memory of computer system become fragmented due to swapping of programs. The new program could not be loaded into memory though available free space is greater then program is purely planed, then we can divide the program into different segments which are certainly be smaller then complete program, and these small pieces would be better able to for into the small opening in the main store. Thus we can see that the division of virtual memory into logical memory area is called segmentation. Memory is divided into logical segments and item of the process having similar characteristics are placed in the same segment. Operating system keep segment take of all these segments which have base lentil values of each segment. A segment of process is loaded for execution when it is required one advantage of segment is that segments can be shared among different process. The information about segments in the segment table is stored sequentially.

Paging System:-

The division of virtual memory into fixed length memory areas is called paging techniques. Each memory area is called a page. To avoid fragmentation paging is another technique. In paging system the virtual memory is divided into fixed length physical memory areas. These fixed length physical memory areas are called pages; user process is stored in these pages.
Information of the pages are stored sequentially, so to address a memory location in a particular pages, it is referenced through relative to the start address of that page so to access a memory location in a page, first page is accessed through page table in the real memory of the page then address of the memory location in referenced and used. A full page is loaded from virtual memory to real memory and is executed.

The division of virtual memory into fixed length memory areas is called paging techniques. Each memory area is called a page. To avoid fragmentation paging is another technique. In paging system the virtual memory is divided into fixed length physical memory areas. These fixed length physical memory areas are called pages; user process is stored in these pages.
Information of the pages are stored sequentially, so to address a memory location in a particular pages, it is referenced through relative to the start address of that page so to access a memory location in a page, first page is accessed through page table in the real memory of the page then address of the memory location in referenced and used. A full page is loaded from virtual memory to real memory and is executed.

Posted by: Wasim Javed