You are on page 1of 67

For free study notes log on: www.gurukpo.

Biyani's Think Tank
Concept based notes
Principal of Programming
(B.Tech )

Amrish Sharma
Deepti Gupta
Asst. Professor
Deptt. of Engineering
Biyani International Institute of Engineering and Technology


For free study notes log on:
Published by :
Think Tanks
Biyani Group of Colleges

Concept & Copyright :
Biyani Shikshan Samiti
Sector-3, Vidhyadhar Nagar,
Jaipur-302 023 (Rajasthan)
Ph : 0141-2338371, 2338591-95 Fax : 0141-2338007
E-mail :

Edition : 2013

Leaser Type Setted by:
Biyani College Printing Department
While every effort is taken to avoid errors or omissions in this Publication, any mistake or
omission that may have crept in is not intentional. It may be taken note of that neither the
publisher nor the author will be responsible for any damage or loss of any kind arising to
anyone in any manner on account of such errors and omissions.

For free study notes log on:


I am glad to present this book, especially designed to serve the needs of the students. The
book has been written keeping in mind the general weakness in understanding the fundamental
concepts of the topics. The book is self-explanatory and adopts the Teach Yourself style. It is
based on question-answer pattern. The language of book is quite easy and understandable
based on scientific approach.
Any further improvement in the contents of the book by making corrections, omission and
inclusion is keen to be achieved based on suggestions from the readers for which the author
shall be obliged.
I acknowledge special thanks to Mr. Rajeev Biyani, Chairman & Dr. Sanjay Biyani, Director
(Acad.) Biyani Group of Colleges, who are the backbones and main concept provider and also
have been constant source of motivation throughout this Endeavour. They played an active role
in coordinating the various stages of this Endeavour and spearheaded the publishing work.
I look forward to receiving valuable suggestions from professors of various educational
institutions, other faculty members and students for improvement of the quality of the book. The
reader may feel free to send in their comments and suggestions to the under mentioned


For free study notes log on:


For free study notes log on:

Unit I
Programming Language Overview

Q.1 What do you understand by programming language ?
Ans An artificial language used to write instructions that can be translated into machine
language and then executed by a computer.

Q.2 Explain the features of programming language ?
1 . Low Level Features :
1. C Programming provides low level features that are generally provided by the Lower level
languages. C is Closely Related to Lower level Language such as Assembly Language.
2. It is easier to write assembly language codes in C programming.
2 . Portability :
1. Programs are portable i.e they can be run on any Compiler with Little or no Modification
2. Compiler and Preprocessor make it Possible for Program to run it on Different PC
3 . Powerful
1. Provides Wide verity of Data Types
2. Provides Wide verity of Functions
3. Provides useful Control & Loop Control Statements
4 . Bit Manipulation
1. C Programs can be manipulated using bits. We can perform different operations at bit
level. We can manage memry representation at bit level.
2. It provides wide verity of bit manipulation Operators. We have bitwise operators to
manage Data at bit level.
5 . High Level Features :

For free study notes log on:
1. It is more User friendly as compare to Previous languages. Previous languages such as
BCPL,Pascal and other programming languages never provide such great features to
manage data.
2. Previous languages have there pros and cons but C Programming collected all useful
features of previous languages thus C become more effective language.
6 . Modular Programming
1. Modular programming is a software design technique that increases the extent to which
software is composed of separate parts, called modules
2. C Program Consist of Different Modules that are integrated together to form complete
7 . Efficient Use of Pointers
1. Pointers has direct access to memory.
2. C Supports efficient use of pointer .
Q.3 What are the programming paradigms ?
Ans A way of conceptualizing what it means to perform computation and how tasks to be
carried out on the computer should be structured and organized.
Imperative : Machine-model based
Functional : Equations; Expression Evaluation
Logical : First-order Logic Deduction
Object-Oriented : Programming with Data Types
Imperative programs tells the details of HOW the results are to be obtained, in terms of
the underlying machine model. It contains both the specification and the implementation
details, inseparably inter-twined.
Imperative Style
i := 0; sum := 0;
while (i < n) do
i := i + 1;
sum := sum + i

For free study notes log on:
Storage efficient
1) Program: a collection of function definitions (m/c independent).
2) Computation by term rewriting.
3) Recursion.
4) Assign-only-once variables.
Functional Style
func sum(i:int) : int;
if i = 0
then 0
else i + sum(i-1)
No Side-effect
Logic Programming
Integrates Data and Control Structures
path(X,Y) :- edge(X,Y).
path(X,Y) :- edge(X,Z), path(Z,Y).

Declarative Programming
A logic program defines a set of relations. This knowledge can be used in various ways by
the interpreter to solve different queries.
Q.4 What is the difference between procedural and object-oriented programming ?

For free study notes log on:
Procedural Object-Oriented
1) Emphasis on procedural

1) Emphasis on data abstraction.

2) Top-down design. 2) Bottom-up design
3) Step-wise refinement. 3)Reusable libraries.
4) Suited for programming in the

4) Suited for programming in the large.

Q.5 Explain the structure of computer ?
Ans A computer consists of three main parts:
1) Processor (CPU)
2) Main-memory system
3) I/O system

The CPU consists of a control unit, registers, the arithmetic and logic unit, the instruction
execution unit, and the interconnections among these components. The information
handled by a computer.

Govern the transfer information within a computer as well as between the computer and
its I/O devices Specify the arithmetic and logic operations to be performed

Numbers and encoded characters that are used as operands by the instructions.
Most computer operations are performed in the arithmetic and logic unit (ALU) of the
processor For example, consider two numbers stored in the memory are to be added They
are brought into the processor, and the actual addition is carried out by the ALU. Then
sum may be stored in the memory or retained in the processor for immediate use. Typical
arithmetic and logic operation are
1) Addition,
2) subtraction
3) multiplication
4) division

For free study notes log on:
5) comparison,
6) complement, etc.

When operands are brought into the processor, they are stored in high-speed storage
elements called registers. Each register can store one word of data.

Control Unit

The control unit is the nerve center that sends control signals to other units and senses
their states.Thus the control unit serves as a coordinator of the memory,
arithmetic and logic, and input/output units. The operation of a computer can be
summarized as follows:

The computer accepts information in the form of programs and data through an input unit
and stores it in the memory. Information stored in the memory is fetched, under program
control, into an ALU, where it is processed
Processed information leaves the computer through an output unit. All activities inside the
machine are directed by the control unit.

Q.6 What are the operations of computer ?

For free study notes log on:
Ans Computer system can do various works but some important among them are:-
1) I/O devices and the CPU can execute concurrently.
2) Each device controller is in charge of a particular device type.
3) Each device controller has a local buffer.
4) CPU moves data from/to main memory to/from local buffers
5) I/O is from the device to local buffer of controller.
6) Device controller informs CPU that it has finished its operation by causing an

Q.7 Give the history of programming language ?

For free study notes log on:

Q.8 What do you mean by syntax in programming language?
Ans Syntax refers to the ways symbols may be combined to create well-formed sentences (or
programs) in the language. Syntax defines the formal relations between the constituents of
a language, thereby providing a structural description of the various expressions that make
up legal strings in the language. Syntax deals solely with the form and structure of
symbols in a language without any consideration given to their meaning.

Q.9 What do you mean by semantics in programming language ?

For free study notes log on:
Ans Semantics reveals the meaning of syntactically valid strings in a language. For natural
languages, this means correlating sentences and phrases with the objects, thoughts, and
feelings of our experiences. For programming languages, semantics describes the behavior
that a computer follows when executing a program in the language. We might disclose
this behavior by describing the relationship between the input and output of a program or
by a step-by-step explanation of how a program will execute on a real or an abstract

For free study notes log on:
Unit II
Implementation of Elementary & Structured
Data Types

Q.1 Explain the concept of Array ?
Ans A Arrays is a collection of homogenous data elements (data types) describing by single
Arrays is three types:-
1) One-dimensional Arrays
2) 2 dimensional Arrays
3) Multi-dimensional Array
The basic purpose of using Arrays is short the programming and similarly
using data in a single program.

One-D Array:- A list of items can be given a common name and the
individual items can be referred using only one sub script.
Syntax:- Type array name [Array size];
Ex:- int a [5];
Int a [5] = {2, 4, 5, 6, 7}

Int a [ ];
Double range
2.22507 e
to 1.797669 e

Long double;
2.22507 e

Accessing Element of array. The C language using single index to access
individual element in a one dimensional array
Ex:- int marks [10]
for (i=0; I <10; i
scanf ( % d, & marks [1]);
2-D Arrays:- row, column
For (i = 0; i < 10; i

For free study notes log on:
For (j=0; j<10; j
Scanf ( % d, & a [1] [2]

Program in 2-D Array

Q.2 WAP to Add two matrix
Ans # include <conio.h>
Void main ( )
Int a [10] [10], b [10] [10], C[10] [10];
Printf (Enter the no. of row and col);
Scanf ( % d % d, pn, & m;
Printf (Enter the element of A);
For (I = 0; kn; i
For (j = 0; j < m; j

Scanf ( % d %d, & a [i] [j]
printf (Enter the element of B);
for (i=0; i<n; i
for (j=0;j<m;j
scanf ( % d, & b [i] [j]);
for (I = 0; i<n;i
) & for (j = 0; j<m; j
C [i] [j] = a [i] [j] + b [i] [f]
printf (Three result of C);
for (I = 0; i<n; i
for (j = 0; j<n;j
) C [i] [j] = a [i] [j] + b [i] [f]
printf ( % d, & C [i] [j]);
printf (/n);
getch ( );

Q.3 Write a program in C find the maximum element in array.

For free study notes log on:
Void main ( )
Int n, x [10], small, I;
Cont <<how many no.s you want to enter;
Cin<< n;
Cont <<Ener The No;
For (i=0;i<n;i
Cin >> x [i];
Small = x [0];
For (i=0; I,n;i
If (x [i] = = small)
Small = x [i];
Cont << smallest no. is<<small;
Getch ( );

Q.4 What do you understand by linked lists ?
Ans A linked list is a complex data structure, useful in systems or applications programming.
A linked list is comprised of a series of nodes, each node containing a data element, and
pointer to the next node, EXAMPLE,
-------- --------
| data | | data |
|--------| |--------|
| pointer| | pointer| ---> NULL

-------- --------


For free study notes log on:

A structure which contains a data element and a pointer to the next node is created by,

struct list {
int value;
struct list *next;
This defines a new data structure called list (actually the definition of a node), which
contains two members. The first is an integer called value. The second is called next,
which is a pointer to another list structure (or node). Suppose that we declare two
structures to be of the same type as list, eg,

struct list n1, n2;
The next pointer of structure n1 may be set to point to the n2 structure by

/* assign address of first element in n2 to the pointer next of the n1 structure */ = &n2;
which creates a link between the two structures.
Program to illustrate linked lists

#include <stdio.h>
struct list

int value;
struct list *next;


For free study notes log on:
struct list n1, n2, n3;
int i;

n1.value = 100;
n2.value = 200;
n3.value = 300; = &n2; = &n3;
i =>value;

Types of Linked List
1. Singly Linked List :- there is a head pointer, and one next pointer per element. The
last element's pointer is null. This type of list can be traversed in only one direction.

2. Doubly Linked List :- there is a head pointer, and each element contains two
pointers, one to the previous element and one to the next element. This type of list can
be traversed in two directions, making insertion and deletion a bit easier, at the cost of
extra memory.

For free study notes log on:

3. Circular List :- the same as Singly or Doubly linked, except that the last element's
pointer points back to the first element's pointer. These types of lists are often used as

Q.5 Explain the concept of Structures ?
Ans It is the collection of different data types in a program. A structure is a heterogences
collection of related fields, here fields are called structure member or structure element
every field has different data types. A structure is a collection of variables under a single
Title of Block
C Program

Dannie Retina
Vikas Thapa
Black Brok

Field name Type Width
Title Char 20
Author Char 20

For free study notes log on:
Page int 10
Price float 7.2

- Structure has a unique keywords that is struct
Program Syntax:-
struct Library
char title [20];
char author [20];
int pages [10];
float price [7.2];
Struct student
char name [20];
int roll no [2];
float marks [2.5];
char address [20];

- Syntax:-
Struct structure-tag
Data type-1 Structure elemend-1;
Data type-2 Structure elemend-2;
Data type-3 Structure elemend-3;
Data type-4 Structure elemend-4;

Main ( )
Struct structure-tag V
, V
Local declaration;
Executable statement;
Struct structure-tag
Data types
} variables list;

Main ( )

For free study notes log on:


Main ( )
Struct structure tag;
data type stat element;
Struct structure tag list of variables;

Q.6 Difference between structure & array.

S.No. Array Structure
1. An array is a collection of same
data types.
Collection of different data types.
2. It has declaration only It has declaration & definition.
3. In array there is no keyword. Struct keyword in structure
Ex.:- int a [10] Ex.:- struct structure
4. An array cant have bit field. An a structure have many bit fields.
5. An array have fix memory An a structure memory can be change
6. Adding, deleting an element in the
array is very difficult task and it
takes much of time.
Adding & deleting is done very smoothing
or easy in a structure and less of time

Structure and Array:-
Structures have two type of view within the array the two type relations between array and
structure is finding.
1> Array of a structure
2> Array within structure
1. Array of structure:- An array of a structure of I-D & multi Dimension are declared
by only changing the structure variables from fundamental type to an array with no
change in the structure declaration.
Syntax:- for I-D
Struct structure-tag variable name [row size]
For 2-D Array:-
Struct structure-tag variable name [row size] [col size];
2. Array with in structure;- 1-D

For free study notes log on:
Struct Structure-tag
Data type-1 member-element1;
Data type-2 member-element [size];
} variable-list;
Struct structure: tag
Data type-1 member element;
Data type-2 member element [row size] [col size];

Nesting Structure:-
A structure can be embedded with in another structure or when a structure is declared &
processed with in another structure. If is called nesting of structure or structure within
It is used when structure is too lengthy so we sub divided the structure two or more parts
in the sub structure and elements of a structure.
Eg- Struct tag1
Member element-1;
- - - - - - - - -
Struct tag-2
Member element-2;
Member element-n;
} VI;
Member element-m;
} V2;
Structure and pointer or Structure to pointer:- A structure can by it address by using
the pointer with structure. We use pointer with structure through a structure variable.
Syntax:- Struct. tag
type 1 member1;
- - - - - - - - - - - - -;
type member n;
} V
Where V is the structure variable and P is the pointer variable.
Ex.:- Struct student
Int rin;

For free study notes log on:
Char name [20];
Char address [30];
Float fees;
} S, *P;
(*P). address;
(*P). fees;
2> Structure to function or Structure and function:-
Structure can be implemented with the function easily for the process, passing of
arguments take place similar to the array and variables.
The relationship of structure with the function can be explain by three types.
1. Passing structure to a function
2. Function returning structure
3. Passing array of struct to function
1. Passing structure to a function:- Similar to passing of array or variable;
structure can be passed to the function as argument.
Type specifier function-name (stu.variable);/*as actual argument*.
Type specifier (stu.variable);/*as formal argument*.
Structure tag name structure variable
- - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - -
2. Function returning structure:- All the values can be compute in the function
program and return a combination value of a structure back. The can be
declaration in the structure format. It has no return type.
3. Passing array of a structure to function:-
A complete complicated passing of an array of a structure to the function is a
difficult job. But the passing of array become very easy by using the passing of
array as an individual element.

Q.7 Explain the concept of files ?
Ans A file is a collection of bytes stored on a secondary storage device, which is generally a
disk of some kind. The collection of bytes may be interpreted, for example, as characters,
words, lines, paragraphs and pages from a textual document; fields and records belonging
to a database; or pixels from a graphical image.
There are two kinds of files that programmers deal with text files and binary files. These
two classes of files will be discussed in the following sections.

For free study notes log on:
ASCII Text files
A text file can be a stream of characters that a computer can process sequentially. It is not
only processed sequentially but only in forward direction. For this reason a text file is
usually opened for only one kind of operation (reading, writing, or appending) at any
given time.
Binary files
A binary file is no different to a text file. It is a collection of bytes. In C Programming
Language a byte and a character are equivalent. Hence a binary file is also referred to as a
character stream, but there are two essential differences.
1. No special processing of the data occurs and each byte of data is transferred to or from the
disk unprocessed.
2. C Programming Language places no constructs on the file, and it may be read from, or
written to, in any manner chosen by the programmer.
Creating a file and output some data
/* Program to create a file and write some data the file */

#include <stdio.h>

Void main( )
FILE *fp;
char stuff[25];
int index;
fp = fopen("TENLINES.TXT","w"); /* open for writing */
strcpy(stuff,"This is an example line.");
for (index = 1; index <= 10; index++)
fprintf(fp,"%s Line number %d\n", stuff, index);
fclose(fp); /* close the file before ending program */
Q.8 Explain the datatypes ?

A data types is very important part of programming language data types are of 3 types.

1) Built in type 2) User define data type 3) Described type
a) Integer type a) class a) array
i) int b) struct b) function

For free study notes log on:
ii) Char c) Union c) Pointer
b) Floating type d) enum d) Reference
i) Float
ii) Double
c) Void
d) Boolean
Difference between C language and C

C Language C

1) In C stdio is header file 1) In C
rostrum is header file
2) C = Extension of C Language 2) CPP = Extension of C
3) Top down approach 3) bottom up approach
4) Scanf = input 4) Cin for input
5) Printf = output 5) Cout for output
6) n for new line 6) Enol for new lilne
7) 35 keywords 7) 63 keywords
8) data is not secure 8) data is secure using access modifiers
9) Comment single 9) Multiple comment
/* /* /* -------*/ /* ---------*/ /* ---------*/
10) No other facilities are 10) Many facilititi fiespilce
available for reasoning code => Inneritance
=> Polymorphsim
=> Class & object
=> Security
=> Encapsulation
=> Abstraction
=> Message Passinge

For free study notes log on:
Unit III
Sequence of Controls

Q.1 Explain the conditional statements ?
Decision making statement are the conditional statements that are needed to alter the
sequence of statement in the program depends on some condition.
On the absence of decision making statement program execute in serial fashion statement
by statement.

Decision making are of 4 types.

If Statement
If else statement
The if else if statement (nesting if else & adder if else)
The switch case
1. The if statement-

If (condition)
{ }
Eg:- if (a >b)
{ }
Statement a is greater
- The if statement is used to execute/skip a dope of statement on the basis of true or false of
a condition.
2. If else statement-
Syntax:- if (condition) eg if (a >b)
{ {
Stat ; a is greatest
} }
Else else
{ {
Stat; b is greatest
Stat; }
- If the condition within if is true, all the statements within the block are execute, else they
are skipped & else part get execute.
If ( a % 2 = 0)

For free study notes log on:
A is add;
3. Nesting if else:-
If (condition) or if (cond)
{ {
If (condition) if (cond)
{ {
Statement; Stat;
Statement; stat;
} }
else else
{ {
Statement; Stat:
Statement; stat:
} }
} }
{ stat;
Greater of 3 no.-
# include <iostream.h>
void main ( )
int x, y, z;
cont < < Enter three no.;
cin >> X >> Y >> Z;
If ( (x = = y) & & ( Y = = Z) )
cout << All are equal;
If (x>y)
If (x> z)
Cont << x is max;
Cont << z is max;
If ( Y > Z )
Cont < < Y is max i
Cont << Z is max;

For free study notes log on:

Q.3 Write a program in CPP to check enter year no. Is leap year or not leap year
# include <iostream.h>
Void main ( )
Int year
Cont <<Enter the year
Cin >> year;
If (year % 400 = = 0)
Cont << leap year.
Cont << not leap year.
If (year % 4 = = 0)
Cont <<leap year
getch ( );

Q. 4 W.A.P. in C
arrange 3 no in ascending order.
Max term logic mid term =
If (a> b & & a> c) (a + b + c) (min + max)
A is max; min term.
If ( b> a & & b> c)
B is max;
If (c >a & & c> a)
C is max;
Cont << max << mid << min
- - - - - - - - - - - -
- - - - - - -- - - - -

Q.5. Check enter number is enter character is vowel or not vowel.
# include < iostream.h>
< c type.h>
Void main ( )
Char char ch;
Cont << Enter the char.

For free study notes log on:
Cin > > ch;
Ch = to lower (ch);
Switch (ch)
Cont << not a vowel;
Case a;
Case e;
Case I;
Case o;
Cout << it is a vowel;
getch ( );

Q.6 What do you understand by loops ?
Ans Looping is a process in which set of statement are excuted repetely for a finite and infinite
no. of times.
A loop is a block of statement which are executed again and again till a specify condition
is not stratify

Loop are three types:-
(1) While
(2) For
(3) Do-while
Syntax:- while (cond.)
To print 1 to 10 using while loop.
int t = 1,
While ( t < < = 10)
Cont <<t <<endl;
int t = 10
While ( t + > =1)
Cont << t << endl;
- -

For free study notes log on:

The statement inside { } is called body of the while loop if no { } are there then only the
first statement after the while is consider as the body of while loop.
For loop:-

Syntax:- for (initialization; condition; increment./decrement)
To print 1 to 10 using for loop

int i
For (I = 1; I < = 10; i
Cont << I < < endl;
Nesting for:-

For (initialization; condition; increment/decrement)
For (initialization; cond; incre/decre)

* do while:-

} while (condition);

The do while loop is similar to the while loop with the difference that the
condition is checked at the end.
It is also called bottom testing loop or exit control loop.
Regardless of the condition at the end of block the loop run at least once
1 to 10


For free study notes log on:
# include <iostream.h>
# include <conio.h>
void main ( )
Int a;
Cont << a << endl;
While (a<=10);

Q.7 Write a program in CPP in following statement
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6

# include < iostream.h>
# include < conio.h>
Void main ( )
Int line, Row, Col;
Cont << Enter the no. of lines.
Cin >> line;
For (row=`; row < = line; row
For (col=1; col <=row; col
Cont << < < row;
Cont <<Vn;

Getch ( );

Q.8 Write a program in CPP in following statement

0 1
1 0 1
0 1 0 1
1 0 1 0 1

For free study notes log on:

# include < >
Void main ( )
Decre ( );
Cont << enter the no. of line.;
Cin << line;
For (row = 1; row < = line; row ++)
Cont << /n;
For (col = 1; col < = row; col
If (row % 2 = 0)
Cont << ( col % 2);
Cont << (col % 2);
Getch ( );

Q.9 Explain the concept of Exception handling ?
An exception is a problem that arises during the execution of a program. An exception can
occur for many different reasons, including the following:
A user has entered invalid data.
A file that needs to be opened cannot be found.
A network connection has been lost in the middle of communications, or the JVM has
run out of memory.
The Exception class has two main subclasses : IOException class and RuntimeException


For free study notes log on:

There are various types of exception, they are :-

a. ArithmeticException Arithmetic error, such as divide-by-zero.
b. ArrayIndexOutOfBoundsException Array index is out-of-bounds.
c. ArrayStoreException Assignment to an array element of an incompatible type.
d. ClassCastException Invalid cast.
e. IllegalArgumentException Illegal argument used to invoke a method.
f. IllegalMonitorStateException Illegal monitor operation, such as waiting on an
unlocked thread.
g. IllegalStateException Environment or application is in incorrect state.
h. IllegalThreadStateException Requested operation not compatible with current
thread state.
i. IndexOutOfBoundsException Some type of index is out-of-bounds.
j. NegativeArraySizeException Array created with a negative size.
k. NullPointerException Invalid use of a null reference.
l. NumberFormatException Invalid conversion of a string to a numeric format.
m. SecurityException Attempt to violate security.
n. StringIndexOutOfBounds Attempt to index outside the bounds of a string.
o. UnsupportedOperationException An unsupported operation was encountered

Q.10 What do you understand by recursive program ?

Ans When a called function is call another function this process turn in recursion.
Recursion is special case when A call itself this process is called recursion.
A recursion function is called well define function.
A recursion function should have a specify condition.
A recursion function should have smaller argument each time then the
process argument value

For free study notes log on:
SI ( ) Called function
Int p, r, t;
Void main ( )
Si ( )
Getch ( ); Calling function

No argument, no return
# include <stdio.h>
# include <conio.h>
Void SI ( )
float p, r, t simple interest;
printf ( Enter the value of p,r,t);
scanf (% f % f, & p, &r, &t);
Simple interest = (p x r x t)/100;
printf ( % f, Si);

Void main ()
getch ( );

No argument with return

# include <stdio.h>
# include <conio.h>

Float SI ( );

For free study notes log on:
Float p,r,t;
Printf (enter the value of p,r,t);
Scanf (% f % f % f, & p, & r, &t);
Simple interest = (P * R * t)/100;
Return simple interest
Void main ( )
Float x;
x = SI ( );
printf (% f, x);
getch ( );

Argument with no return

# include <stdio.h>
# include <conio.h>

Void SI (float p, float r, float t)
Float simple interest;
Simple interest = (P x R x t)/100;
Printf (5 f. SI);
Void main ( )
{ float p,r,t;
Printf (enter the value of P,r,t);
Scanf (% f % f, &P,r & t);
SI (p;r,t)
Getch ( );

Argument with return

# include <stdio.h>
# include <conio.h>

Float SI (float P, float r, float t);
Float simple;
Simple = (P x R x t)/100
Return simple;

For free study notes log on:
Void main ( )
Float p,r,t,x;
Printf (enter the value of p,r,t);
Scanf ( % f % f, & p, & r, t);
x = SI ( P, R, t);
Printf ( % f, x);
Getch ( );

Q.11 What do you understand by the concept of subprogram ?
Subprograms include the following characteristics:
Each subprogram has a single entry point
There is only one subprogram execution at any given time
Control always returns to the caller when the subprogram execution terminates.

A subprogram definition describes the interface to and the actions of the subprogram
A subprogram call is the explicit request that the subprogram be executed.
A subprogram is active if after having been called, it has begun execution but has not
yet completed that execution.
Two fundamental kinds of subprograms are procedures and functions.
A subprogram header, which is the first line of the definition, serves several
purposes. It specifies that the following syntactic unit is a subprogram definition.
And it provides the name for the subprogram. And, it may optionally specify list of
The parameter profile of a subprogram is the number, order and types of its formal
The protocol of a subprogram is its parameter profile plus, if it is a function, its return
Subprograms declarations are common in C programs where they are called
Subprograms are complex structures in programming languages

For free study notes log on:
An overloaded subprogram is one that has the same name as another subprogram in the
same referencing environment.
A generic subprogram is one whose computation can be don on data of different types
with different calls
When a parameter is passed by value, the value of the actual parameter is used to
initialize the corresponding formal parameter, which then acts as a local variable in the
subprogram this implements in-mode semantics.

Caller Callee

(sub(a, b, c)) (procedure sub(x, y, z))

a ----------call----------------- x

b -------return----------------- y

c -----------call-------------- z

For free study notes log on:

Pass-by-value is implemented by actual data transfer
The main disadvantage of pass by value is that if physical moves are done, the additional
storage is required for the formal parameter, either in the called subprogram or in some
area outside both the caller and the called subprogram


For free study notes log on:
Unit IV
Scope of Data

Q.1 What is Local Data and global Data ?
Ans Local Data :- It is the type of data that work only within the function. Its values outside
the function cant be accessible. To use the values we have to pass the value of the

Global Data :- It is the type of data that work throughout the program. The value of the
variable can be access from anywhere in the program. Example,

# include<stdio.h>

// Global variables
int A;
int B;

int Add()
return A + B;

int main()
int answer; // Local variable
A = 5;
B = 7;
answer = Add();
return 0;

Q.2 What do you understand by block structure ?
Ans In computer programming, a block is a section of code which is grouped together. Blocks
consist of one or more declarations and statements. A programming language that permits
the creation of blocks, including blocks nested within other blocks, is called a block-
structured programming language
C is not a block-structured language in the sense of Pascal or similar languages, because
functions may not be defined within other functions. On the other hand, variables can be
defined in a block-structured fashion within a function. Declarations of variables

For free study notes log on:
(including initializations) may follow the left brace that introduces any compound
statement, not just the one that begins a function. Variables declared in this way hide any
identically named variables in outer blocks, and remain in existence until the matching
right brace. For example, in
if (n > 0) {
int i; /* declare a new i */

for (i = 0; i < n; i++)
the scope of the variable i is the true branch of the if; this i is unrelated to any i outside
the block. An automatic variable declared and initialized in a block is initialized each time
the block is entered. A static variable is initialized only the first time the block is entered.

Q.3 Explain the concept of parameter passing through function ?
Ans Group of statement in a block which have specific name is called function.
1. Space memory saving
2. Time saving
3. Easy to dectact the error
4. Find the modification of program
5. Increase visibility

A function is a block of code that has a name and it has a property i.e. revisable. It can be
execute from as many different points in a programming as required.
It is set of independent statement which can be utilized. Whenever it required these
independent are complete in old form.


Library User define function or
or or
Standary in built function self contained function
or or
compiler function Call by value
ex:- clear ( ) ex:- add ( )
sum ( )

Categories of function:-

For free study notes log on:
Functions are categories in four parts.
1. Function with no argument and no return value.
2. Function with argument and no return value.
3. Function with no argument and with return value.
4. Function with argument and with return value.

1. Function with no argument and no return value.
Function 1 ( )
Function 2 ( );
No return
Return ( );
w.a.p. in C compute simple interest with no argument and no return value.
=> function with argument and no return value.
With argument
Function 1 ( ) Function (x, y)
{ int x, y;
Int a, b; {
Function 2 (a, b); return;
----------- ------------
No return
----------- ------------

In this categories of function the main program will sent argument value but
called program will not return any value.

3) Function with no argument but with return value.

For free study notes log on:
no argument
Function 1 ( ) Function ( )
Function 2 ( ); return (V);
----------- ------------
Return value
----------- ------------
In this categories of function the main program will not sent any argument
value but calling will return any value.
4) Function with argument but with return value
With argument
Function 1 ( ) Function 2 (a, b, c)
{ int a,b,c;
Si = function 2 )p,t, r);
With return value Return (2);
(Recursive functions)


For free study notes log on:
Unit V
Basics of OOPs

Q.1 What do you understand by abstract data type ?
Ans A data type can be considered abstract when it is defined in terms of operations on it, and
its implementation is hidden (so that we can always replace one implementation with
another for, e.g., efficiency reasons, and this will not interfere with anything in the
program). Thus, speaking about such a type, we leave its implementation aside
considering it irrelevant to the topic, unless we directly discuss the implementation.
I mplementation of abstract data types in C
the convention in C is to prepare two files to implement an abstract data type. One (whose
name ends in ".c") provides the implementation view; it contains the complete declaration
for the data type, along with the code that implements its associated operations. The other
(whose name ends in ".h") provides the abstract view; it contains short declarations for
functions, pointer types, and globally accessible data.
The abstract data type "stack" might then be represented as follows:

typedef struct StackStructType *StackType;

/* Return a pointer to an empty stack. */
extern StackType InitStack ( );
/* Push value onto the stack, returning success flag. */
extern boolean Push (int k);

/* Pop value from the stack, returning success flag. */
extern boolean Pop ( );

/* Print the elements of the stack. */
extern PrintStack (StackType stack);

Q.2 What is Encapsulation ?
Ans Encapsulation is the technique of making the fields in a class private and providing access
to the fields via public methods. If a field is declared private, it cannot be accessed by

For free study notes log on:
anyone outside the class, thereby hiding the fields within the class. For this reason,
encapsulation is also referred to as data hiding.

Q.3 Explain storage Management using stack ?
Ans Stack-based storage allocation is appropriate when the storage requirements are not
known at compile time, but the requests obey a last-in, first-out discipline. Examples:
local variables in a procedure in C/C++, Ada, Algol, or Pascal
procedure call information (return address etc).
Stack-based allocation is normally used in C/C++, Ada, Algol, and Pascal for local
variables in a procedure and for procedure call information. It allows for recursive
procedures, and also allocates data only when the procedure or function has been called --
but is reasonably efficient at the same time.
Java uses a stack for allocating frames for each method invocation. Parameters and local
variables are stored in the stack frame. Primitive types are contained within the stack
frame itself. Object references are stored in the stack frame, and point to the actual object
storage in the heap

Q.4 What is Fixed and Variable size heap storage management ?
Ans An implementation of a priority queue. It is an array A, visualized as a nearly complete
binary tree.
Max-Heap Property: The key of a node is than the keys of its

Visualizing an Array as a Tree
root of tree: first element in the array, corresponding to index = 1
If a nodes index is i then:
returns index of node's parent, e.g. parent(5)=2
returns index of node's left child, e.g. left(4)=8
returns index of node's right child, e.g. right(4)=9.


For free study notes log on:
Heap-Size Variable

For flexibility we may only need to consider the first few elements
of an array as part of the heap.
A[1],, A[ heap-size];

Max-Heaps vs Min-Heaps
Max Heaps satisfy the Max-Heap Property :
for all i, A[i] max{ A[left(i)] , A[right(i)]}

Min Heaps satisfy the Min-Heap Property :
for all i, A[i] min{ A[left(i)] , A[right(i)]}

Q.5 What is Garbage Collector ?
Ans In computer science, garbage collection (GC) is a form of automatic memory
management. The garbage collector, or just collector, attempts to reclaim garbage, or
memory occupied by objects that are no longer in use by the program.
Garbage collection is often portrayed as the opposite of manual memory management,
which requires the programmer to specify which objects to deallocate and return to the
memory system. However, many systems use a combination of approaches, including
other techniques such as stack allocation and region inference.
The basic principles of garbage collection are:
1. Find data objects in a program that cannot be accessed in the future
2. Reclaim the resources used by those objects
Many computer languages require garbage collection, either as part of the language
specification (e.g., Java, C#, and most scripting languages) or effectively for practical
implementation (e.g., formal languages like lambda calculus); these are said to be
garbage collected languages. Other languages were designed for use with manual
memory management, but have garbage collected implementations available (e.g., C,

For free study notes log on:
Multiple Choice Questions

1. Inline functions are invoked at the time of

a) Run time
b) Compile time
c) Depends on how it is invoked
d) Both b and c above

2.Which of the following operators below allow to define the member functions of a class outside
the class?

a) ::
b) ?
c) :?
d) %

3.Every class has at least one constructor function, even when none is declared.

a) True
b) False

4. How do we define a destructor?

a) X~() {}
b) X() {}~
c) X() ~{}
d) ~X() {}

5. Can constructors be overloaded?

a) No
b) Yes

6. Which of the following below can perform conversions between pointers to related classes?

a) cast_static
b) dynamic_cast
c) static_cast
d) cast_dynamic

7. An abstract class can be instantiated.

a) True

For free study notes log on:
b) False
8. The default access level assigned to members of a class is ___________

a) Private
b) Public
c) Protected
d) Needs to be assigned

9. Which classes allow primitive types to be accessed as objects?

a) Storage
b) Virtual
c) Friend
d) Wrapper

10. Which of the following below is /are a valid iterator type?

a) Input Iterator
b) Backward Iterator
c) Forward Iterator
d) Both a and c above

11. What is the difference between overloaded functions and overridden functions?

a) Overloading is a dynamic or run-time binding and Overriding is static or compile-time
b) Redefining a function in a friend class is called function overriding while Redefining a
function in a derived class is called a overloaded fucntion.
c) Overloading is a static or compile-time binding and Overriding is dynamic or run-time
d) Redefining a function in a friend class is called function overloading while Redefining a
function in a derived class is called as overridden fucnion.

12. What is shallow copy?

a) A shallow copy creates a copy of the dynamically allocated objects too.
b) A shallow copy just copies the values of the data as they are.
c) A shallow copy creates a copy of the statically allocated objects too
d) Both b and c above

13. Which of the following library function below by default aborts the program?

a) Terminate()
b) end()
c) Abort()

For free study notes log on:
d) exit()

14. What defines a general set of operations that will be applied to various types of data?

a) Template class
b) Function template
c) Class template
d) Both a and c above

15. What happens when a pointer is deleted twice?

a) It can abort the program
b) It can cause a failure
c) It can cause an error
d) It can cause a trap

16. What is deep copy?

a) A deep copy creates a copy of the dynamically allocated objects too.
b) A deep copy just copies the values of the data as they are.
c) A deep copy creates a copy of the statically allocated objects too
d) Both b and c above

17. There is nothing like a virtual constructor of a class.

a) False
b) True

18. What is the Difference between struct and class in terms of Access Modifier?

a) By default all the struct members are private while by default class members are public.
b) By default all the struct members are protected while by default class members are
c) By default all the struct members are public while by default class members are private.
d) By default all the struct members are public while by default class members are protected.

19. Vtables

a) creates a static table per class
b) creates a static table per object
c) creates a dynamic table per class
d) creates a dynamic table per object

20. C++ provides facility to specify that the compiler should match function calls with the correct
definition at the run time. This process is called as


For free study notes log on:
a) Static binding
b) Dynamic Binding

21.What are the major elements in an object model?

a) Abstraction, Encapsulation and persistence
b) Hierarchy, concurrency and typing
c) Abstraction, encapsulation and hierarchy
d) Typing

22.The characteristics of an object that distinguish it from all other kinds of objects

a) Aggregation
b) Abstraction
c) Modularity
d) None of the above

23.Shallow copy is defined as

a) Member wise copying of the object
b) Same as deep copy
c) Bitwise copying of objects
d) None of the above

24.OOP allows for extension of the objects functions or of class functions. This is called as

a) Extendibility
b) Expansion capacity
c) Virtual extension
d) Scalability

25.In OOPS unit of data is called as

a) Bits
b) Blocks
c) Structures
d) Targets

26.Which of the following is not a type of object oriented abstraction?

a) Abstraction of data
b) Abstraction of function
c) Abstraction of structure
d) Abstraction of name

27.What is a const member function?

For free study notes log on:

a) It means the function is only a read-only function
b) One which always returns the same values, given the same arguments
c) Used for constructor and destructor
d) None of the above

28.What makes a class abstract?

a) The class must not have method definitions.
b) The class must have a constructor that takes no arguments.
c) The class must have a function definition equal to zero.
d) The class which cannot be instantiated as they are mainly for inheritance.

29.What is dynamic dispatch?

a) When the function to be executed in response to a function call is determined at run-time.
b) When the function to be executed in response to a function call is determined at compile-
c) When the function to be executed in response to a function call is determined at the end of
the function call.
d) None of the above

30._____________ is actually a parameterized constructor which takes some parameters in order
to create instance of a class.

a) Implicit constructor
b) Explicit constructor
c) Virtual constructor
d) Parameterized constructor

31.There is no difference between an object and an instance.

a) False
b) True

32.A package is a namespace for organizing _____________ and interfaces in a logical manner

a) instance
b) objects
c) classes
d) both b and c above

33. Common behavior can be defined in a superclass and inherited into a subclass using the
___________ keyword

a) inherit

For free study notes log on:
b) extends
c) extend
d) inherits

34.Which of the following below are different Creational patterns in OO design?

a) Factory pattern
b) Single ton pattern
c) Prototype pattern
d) all of above

35.If the child object can exist beyond the lifetime of its parent, then the relationship is

a) Generalization
b) Composition
c) Aggregation
d) Any of b and c above

36.Virtual inheritance is a kind of inheritance that can be used under __________

a) single inheritance
b) multi level inheritance
c) multiple inheritance
d) both a and d

37.Constructors have to be called before the main function

a) True
b) False

38.__________ allows for the separation of object interactions from classes and inheritance into
distinct layers of abstraction

a) Dispatching
b) Loosening
c) Detaching
d) Decoupling

39.The ____________ functions of the base class are also not inherited

a) Both a and d
b) Pure virtual function
c) Friend
d) Virtual

For free study notes log on:
40.A recursive function would result in infinite recursion, if the following were left out:

a) Base call
b) Recursive call
c) Subtraction
d) Local variable declarations

41.____________ is a style of dynamic typing in which an object's current set of methods and
properties determines the valid semantics.

a) duck overcast
b) duck retype
c) duck semantic
d) duck typing

42.What is the user of parametric polymorphism?

a) A function or a data type can be written generically so that it can handle values identically
without depending on their type
b) A function or a data type can be written generically so that it can handle values identically
being dependant on their type
c) A function or a data type that can accept parameters
d) Both a and c

43.In dynamic type case a type safety check is incurred at ____________

a) Compile time
b) Run time

44.Operator overloaded is?

a) Making C++ operators works with objects
b) Giving new meaning to existing C++ operators
c) Making new C++ operator
d) Both a and b

45.Overloaded function in C++?

a) A group function with the same name
b) All have the same number and type of arguments
c) Function with same name and same number and type of arguments.
d) All of the above

46.A class having no name?

a) Is not allowed

For free study notes log on:
b) Can?t have a destructor
c) Can?t have a constructor
d) Can?t be passed as an argument

47.A destructor takes?

a) One argument
b) Two arguments
c) Three arguments
d) Zero arguments

48.Constructors are use to?

a) Initialize the objects
b) Construct the data members
c) Both a and b
d) A method

49.The fields in a class of a C++ program are by default?

a) Protected
b) Public
c) Private
d) None of these

50.In C++ a function contained with in a class is called?

a) A member function
b) An operator
c) A class function
d) A method

51.__is an OOP Language?

a) Basic
b) Fortan
c) C++
d) Cobol

52. __allows you to create a derived class that inherits properties from more than one base class?

a) Multilevel inheritance
b) Multiple inheritance
c) Hybrid Inheritan
d) Hierarchical Inheritance

For free study notes log on:
53. __feature in OOP allows reusing code?

a) Polymorphism
b) Inheritance
c) Encapsulation
d) Data hiding

54. __A class that declares or inherits a virtual function is called?

a) Encapsulation class
b) Inherited class
c) Polymorphic class
d) static class

55. __C++ header file that handles input output functions is?

a) iostream.h
b) iomanip.h
c) string.h
d) fstream.h

56. __are bound dynamically at run time?

a) static class
b) virtual function
c) friend function
d) inline function

57. __pointers are not modifiable?

a) that
b) this
c) Indirection
d) Address

58. __classes are used in cases where one class is tightly coupled to another class?

a) Abstract
b) friend
c) static
d) virtual

59. __The extension of C++ source file is?

a) txt
b) doc

For free study notes log on:
c) .c
d) .cpp

60. The __ keyword/s do not apply to friend functions, as the class has no controlover the scope
of friends?

a) public
b) protected
c) private
d) both A and B

61. The extension of C++ object code is __?

a) .obj
b) .cpp
c) .ppt
d) .xls

62. __do not break encapsulation, but rather enhance a class interface?

a) Static functions
b) Friend functions
c) Dynamic functions
d) none of these

63. The function-----will return the last read character and will move the inside pointer one with-1

a) putback()
b) flush()
c) peek()
d) getline().

64. __is an identifier that can be inserted into an output stream or extracted from an input stream
in order to produce a desired effect?

a) Stream
b) Manipulator
c) this
d) Flag

65. The error occurring due to missing semicolon is ___?

a) Syntax
b) Logical

For free study notes log on:
c) Linker
d) Runtime

66. __Identify the modulators from the following list. i. endl ii. hex iii. Auto iv. Default?

a) i only
b) ii only
c) both i and ii
d) all of these

67. __Which of these manipulator is used to insert null character in a string?

a) endl
b) ends
c) unitbuf
d) setfill

68. __Which of these file open mode you use to delete all previous content in the file?

a) ios :: ate
b) ios ::in
c) ios:: app
d) ios::trunc

69. A class generated from a class template is called ------?

a) Inherited class
b) generated class
c) derived class
d) base class

70. The size of an int variable in C++ is ___bytes?

a) 4
b) 2
c) 1
d) 8

71. __is very useful when templates of template come into usage?

a) friend function
b) static function
c) typedef
d) Inheritance

For free study notes log on:

72. Which of these c++ feature allow you to create classes that are dynamic in terms of the types
of data they can handle?

a) Inheritance
b) Templates
c) Polymorphism
d) information hiding

73. Create the required classes by plugging in the actual type for the type parameters, this process
is commonly known as __?

a) Instantiating a class
b) encapsulation of class
c) booting of class
d) none of these

74. The exception specification is like a------ It tells the user to write exception handling code
and what exceptions to handle?

a) library file
b) function prototype
c) header file
d) built-in function

75. The size of an double variable in C++ is ____bytes?

a) 10
b) 2
c) 4
d) 8

76. Which of these exception reports a failure to allocate storage?

a) bad_cast
b) bad_typeid
c) length_error
d) none of these

77. Stack is an example for ------structure?


For free study notes log on:
78. The standard sequence containers include ------
i) vector
ii) deque
iv) stack

a) i) and ii) only
b) i),ii) and iii)
c) iii) and iv) only
d) i),ii),iii) and iv)

79.What punctuation ends most lines of C++ code?
a) . (dot)
b) ; (semi-colon)
c) : (colon)
d) ' (single quote)

80.Can I inherit the constructor and destructor of a base class?

a) No
b) Yes
81.What punctuation is used to signal the beginning and end of code blocks?
a) { }
b) -> and <-
c) BEGIN and END
d) ( and )
1) (b) 2) (a) 3) (a) 4) (d) 5) (b) 6) (c) 7) (b) 8) (a) 9) (d) 10) (d)
11) (c) 12) (b) 13) (d) 14) (b) 15) (c) 16) (a) 17) (a) 18) (c) 19) (a) 20) (b)
21) (c) 22) (b) 23) (c) 24) (d) 25) (c) 26) (d) 27) (a) 28) (d) 29) (a) 30) (a)
31) (a) 32) (c) 33) (b) 34) (d) 35) (c) 36) (c) 37) (a) 38) (d) 39) (c) 40) (a)
41) (d) 42) (a) 43) (a) 44) (d) 45) (a) 46) (b) 47) (d) 48) (a) 49) (c) 50) (a)
51) (c) 52) (b) 53) (b) 54) (c) 55) (a) 56) (b) 57) (b) 58) (b) 59) (d) 60) (d)
61) (a) 62) (b) 63) (a) 64) (b) 65) (a) 66) (d) 67) (b) 68) (d) 69) (b) 70) (b)
71) (c) 72) (b) 73) (a) 74) (b) 75) (d) 76) (d) 77) (a) 78) (b) 79) (b) 80) (b)
81) (a)


For free study notes log on:
Question 1.
void main()
int a=10,b=20;
char x=1,y=0;
What is the output?

1) XAM is printed
2) exam is printed
3) Compiler Error
4) Nothing is printed

Question 2.
What is the output of the following code?
void swap(int&, int&);
void main()
int a = 10,b=20;
swap (a++,b++);
printf("\n%d\t%d\t",a, b);
void swap(int& x, int& y)

What is the output ?
1) 14, 24
2) 11, 21
3) 10, 20
4) Error

Question 3.

For free study notes log on:
What will be the value of `a` after the following code is executed

#define square(x) x*x
a = square(2+3)

1) 25
2) 13
3) 11
4) 10

Question 4.
The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The
stack is popped four times and each element is inserted in a queue. Then two elements are deleted
from the queue and pushed back on the stack. Now one item is popped from the stack.
The popped item is.

1) A
2) B
3) C
4) D

Question 5.
What is the output of the following code?

void main()
int a=0,b=0;
a = (b = 75) + 9;
printf("\n%d, %d",a, b);
1) 75, 9
2) 75, 84
3) 84, 75
4) None of these options

Question 6.
To delete a dynamically allocated array named `a`, the correct statement is

1) delete a;
2) delete a[0];
3) delete []a;
4) delete [0]a;


For free study notes log on:
Question 7.

Evaluate !(1 && !(0 || 1)).

A. True
B. False
C. Unevaluatable

Question 8.
Find the output of the following program
class Sample
int *ptr;
Sample(int i)
ptr = new int(i);
delete ptr;
void PrintVal()
cout << "The value is " << *ptr;
void SomeFunc(Sample x)
cout << "Say i am in someFunc " << endl;
int main()
Sample s1= 10;
Say i am in someFunc
Null pointer assignment(Run-time error)

For free study notes log on:
Question 9.
Which is the parameter that is added to every non-static member function when it is called?
this pointer
Question 10.
Find the output of the following program
class base
int bval;
base(){ bval=0;}

class deri:public base
int dval;
deri(){ dval=1;}
void SomeFunc(base *arr,int size)
for(int i=0; i

int main()
base BaseArr[5];
deri DeriArr[5];



For free study notes log on:
Question 11.
Find the output of the following program
class base
void baseFun(){ cout<<"from base"
class deri:public base
void baseFun(){ cout<< "from derived"< };
void SomeFunc(base *baseObj)
int main()
base baseObject;
deri deriObject;

from base
from base

For free study notes log on:
Abstract Class

A class that serves only as a base class from which classes are derived. No object of an
abstract base class are created base class that contains pure virtual functions is an abstract base

Abstract Data Type

An abstraction that describes a set of objects in terms of encapsulated or hidden data and
operations on that data.


The fact of representing the essential features of something without including much detail.

Access OperationsOperation which access the state of variable or object but do not modify it.


Two or more variables that refer to same data are said to aliases of one another.
Anonymous Union

An unnamed union in C++ . the member can be used like ordinary variables.


Property of an object. It can not exist independently of the object. Attribute may take other
objects as values.

Base Class

A class from which other classes are derived. A derived class inherit member from a base class.

Class Hierarchy

Class Hierarchy consist of a base class and derived classes. When a derived class has a single
base class, it is known a single inheritance. When a derived class has more than one base class
(multiple inheritance) , it is known as class network.

Class Object
A variable whose type is a class.(An Instance of a class).

Class Oriented


For free study notes log on:
Object Based System in which every instance belongs to a class but classes may not have super

Classification structure

A tree or network structure based on semantic primitives of inclusion and membership which
indicates that inheritance may implement specialization or generalization. Object may participate
in more than one such structure, giving rise to multiple inheritance.


An Object that uses the service of another object called server. That is client can send
message to servers.

Composition Structure

A tree structure based on the semantic primitive part-of which indicates that certain objects
may assembled from the collection of the other objects. Objects may participate in more than one
such structure.


A special member function for automatically creating an instance of class. This function has the
same name as the class .

Container Class

A class that contains objects of other class.

Copy Constructor

The Constructor that creates as new tool class object from an existing object of a same class.

Data Flow Diagram ( DFD )

A diagram that depicts the flow of date through a system and the process that manipulate the

Data Hiding

A property where by the internal data structure of an object is hidden from the rest of the
program. The data can be accessed only by the functions declared within the class.

Data Member

For free study notes log on:
A variable that is declared in a class declaration.

Default Argument

An argument value that is specified in a function declaration and is used if the corresponding
actual argument is omitted when the function is called.

Derived Class

A class inherits some or all of its members from another class.


A function that is called to deallocate memory of the object of the class.

Dynamic Memory Allocation

The means by which data objects can be created as they are needed during the program
execution. Such date objects remain in existence until they are explicit destroyed. In C++,
dynamic memory allocation is accomplished with the operators new ( for creating data objects )
and delete (for destroying them).

The Mechanism by which the data and functions are bound together within an object

Error State

For stream, flags that determine whether an error occurred and, and if so, give some
indication of its severity.


Feature that allows the extension of the existing code. This allows the creation of new
objects from existing ones.

Extraction Operator

The Operator > > , which is used to read input data from keyboard.

Format State

For stream , flags and parameters that determine how output values will be printed and how
input values will be read.


For free study notes log on:
Free Store

A pool of memory from which storage for objects is allocated which is also know as heap.


A function that provides the information needed to call a function the declaration used the
name of the function, its return type and type of each argument.

Function Prototype

A function declaration is called Function Prototyping.

For free study notes log on: