CS1 Final
CS1 Final
INDEX
CHAPTER CHAPTER NAME PAGE NO.
NO.
1 Operating System 3-60
3 C++ 107-188
4 HTML 189-228
CHAPTER 1:
OPERATING
SYSTEM
MODULE 1:
INTRODUCTION
TO OPERATING
SYSTEM
Functions of OS:
1. To make hardware convenient to use.
2. To help user to executes programs.
3. To control execution of program to prevent errors
and improper use of computer.
4. To make provision for security of information to
users.
5. It provide facilities to share same hardware among
the users.
6. Proper scheduling of resources among users.
SERVICES IN OS
Operating system provides services in following areas:
SYSTEM CALL
System call provides the interface between a process and
the OS. These calls are generally available as assembly
language instructions.
MODULE 2:
OVERVIEW OF
OPERATING
SYSTEM
FEATURES OF WINDOW 98
Ø Easier to use:
• Window 98 is a single user multitasking operating
system.
• Navigating around the computer screen is easier.
• A file can be opened by single click.
• Window 98 allows us to use multiple monitors with
single computer.
• New hardware can be easily installed.
• We can use digital cameras and other digital imaging
devices.
Ø Faster:
• Window and programs open faster than Window 95.
• The computer speed and efficiency can be easily
improved by simple maintenance.
Ø More entertaining:
• Window 98 supports DVD and digital audio. User can
play quality digital movies and audio on computer.
• The television broadcast can also be seen.
FEATURES OF WINDOW NT
• Windows NT is multitasking, multiuser and
multithreading operating system.
• A user will get faster response even though multiple
applications are running.
• Windows NT supports virtual memory management
system to allow multiprogramming.
• Symmetric multiprocessing in window NT allows it to
schedule various tasks on any CPU in a multiprocessor
system.
• Windows NT is a 32-bit operating system.
• Windows NT uses New Technology File System
(NTFS), which implements fault tolerance, security
and has supports for very large files.
FEATURES OF LINUX
• Linux is multiuser, operating system with a full set of
Unix compatible tools.
• Linux runs on a wide variety of platforms. It was
developed exclusively PC architecture.
• It provides as much as functionality from limited
resources. It can run on machine having 4MB of RAM.
• Linux supports a wide base of applications
• Linux is free software. Free in the sense that people
can copy it, modify it, and use it in any manner they
want.
COMPONETS OF LINUX
Kernel: Kernel maintains all-important abstractions of the
operating system, such as processes and virtual memory.
Linux kernel
MODULE 3:
INFORMATION
MANAGEMENT
FILE SYSTEM:
The file system related to IM allows the user to define
files and directories and allocate/deallocate disk space to
each file. The collection of related information i.e. data or
a program is called file. Each file has a specific name,
which is used to refer that file. For convenient use of
computer system, the OS provides a uniform logical view
of information storage. The OS manages mass storage
devices to implement the abstract concept of files.
FILE OPERATIONS:
Create a file: For creating a file, first whether sufficient
space is available for that file is checked. If it is available,
entry for new file must be made in directory.
VIDEO RAM
...
Attribute Data Attribute Data Attribute Data
byte 0 byte 0 byte 1 byte 1 byte 79 byte 79
. . . . . . .
. . . . . . .
MODULE 4:
PROCESS
MANAGEMENT
PROCESS:
A Process is defined as a program under execution, which
competes for CPU time and other resources. In simple
term, a program does not compete for computing resources
such as CPU time or memory, whereas a process does. A
program may be present on paper or reside on disk. It may
be compiled or tested but still does not compete for
computing resources. Once user wants to execute a
program, it is located on the disk and loaded in main
memory, at that time, it becomes a process, because it
then compete for CPU time and other resources.
DEGREE OF
MULTIPROGRAMMING
Multiprogramming is the concept of increasing utilization
of CPU by always having something for CPU to execute.
The number of processes running simultaneously and hence
competing for CPU is known as degree of
multiprogramming.
CONTEXT SWITCHING:
Multiprogramming is the concept of increasing utilization
of CPU by always having something for CPU to execute. In
multiprogramming system, multiple processes are run at
the same time such that when process 1 wait for an I/O,
process 2 executes and vice versa. When CPU switches
from one process to another the time required for
switching is called as context switching.
EXAMPLE
// A. CPP //B. h
Explanation of example:
Here A and B are the two processes, where process A is
depending on B. When process A is being executed, CPU
executes instructions one by one. When it comes to the
instruction cout << add(a,b); it stops execution because the
output of this instruction depends on output of process B.
STATES OF PROCESS
Running state: There is only one process, which is
executed by CPU at any moment. This process is called as
running process. In multiprocessor systems, with multiple
CPUs, there are many running processes at a given moment.
The operating system keeps track of all of them.
PRIORITY
The concept of arranging ready processes in a queue so
that they can be dispatched one after another for
execution depending on some policy is know as priority.
Due to many processes competing for the same available
resources like CPU and memory, concept of priority is
used.
TYPES OF PRIORITY:
Ø External priority: User specifies an external
priority, externally generally at the time of initiating
the process. In many cases, the OS allows user to
change its priority externally even during its
execution. If user does not specify any external
priority at all, the OS assumes a certain priority,
called the default priority.
MODULE 5:
MEMORY
MANAGEMENT
FUNCTIONS OF MEMORY
MANAGEMENT OF OS
In general, the memory management modules performs
following functions
• To keep track of all memory locations free or
allocated and if allocated, to which process and how
much.
• To decide memory allocation policy i.e. which process
should get how much memory when and where?
• To use various techniques and algorithms to allocate
or deallocate memory locations. Normally this is
achieved with the help of some special hardware.
PARTITIONING
Certain OS uses partitioned memory management to allow
multiprogramming. Partitioning means dividing main memory
into various sections. These sections are called partition.
TYPES OF PARTITIONS:
Fixed partition: Also called static partition. In these
method partitions could be of different sizes. But once
decided, their size cannot be changed. In these method
partitions are fixed at the time of system generation. On
declaring fixed partitions, the OS system creates
Partition Description Table (PDT).
ID
100K
P1 Process A
Starting Size status
address
P2 Process B
0 0 100K FREE
400K
1000K
OS 0
(MONITOR)
P
USER PROCESS
AREA
Max
PAGING
Ø Partitions suffer from external fragmentation
because of available memory is not contiguous.
Ø Paging permits a program’s memory to be non
contiguous allowing a program to be allocated physical
memory wherever it is available.
Ø Physical memory is broken into fixed-size blocks
called Page frames. Logical memory is also broken into
of the same size called Pages.
Ø When program is to be executed its pages are loaded
into any available frames and the page map table is
defined to translate from user pages to memory
frames.
Ø The page size are define by hardware. It is typically
power of 2
Page 0
Page Page 0 Page 3
Page 1 #p frame
F 1 Page 0
Page 2 0 1
2
1 4
Page 3 2 3 3 Page 2
3 0
4 Page 1
COMPUTER SCIENCE
physical
Logical address
address
CPU
CCPU P d f d
Physical
Memory
f√
PMT
SEGMENTATION:
• Segmentations are logical division of programs and
hence are normally of variable sizes.
• Segmentation is memory management scheme which
support user’s view of memory.
• Each segments has number and length.
• Each program is executable form can be considered
to be consisting of different segments. Such as code,
data and stack. Each of these further divided into
new segments.
• A program normally contains main program, some
subprograms and few predefined and precompiled
functions. Each of these belongs to different
segments.
• An application programmer does not necessarily have
to declare different segments in the program, the
complier does it by its own.
Main program O 0
Sub_program 0
Segment 0 segment 1
999 399
Stack area 0
Data_area 0
Segment 2 segment 3
299 199
0 1000 1400
1 400 3400
Segment 3 500
2 300 2900
700
3 200 500
Segment 0 1400
2400
Segment 2 2900
3200
Segment 1 3400
3800
Physical memory
VIRTUAL MEMORY
Virtual memory is attempt, which makes the execution of
the processes possible, which may completely not in the
main memory. Some part of the process may be on disk.
How it is implemented? :
Virtual memory is difficult to implement. It can be
implemented by paging, segmentation or combined
schemes. Mostly virual memory system are
implemented by paging.
• A program consists of number of logical or virtual
pages. To start execution of program some of the
pages are loaded into specific page frames.
• If a page is not loaded into memory and a location for
that page is referenced, at that time page fault is
arises. When page fault arises the OS loads the
referenced page in memory from disk.
MODULE 6:
GRAPHICAL
USER
INTERFACE
(GUI)
GUI
The interface, which replaces cryptic commands by their
graphical representation, is called Graphical User
Interface (GUI). Window operating system is GUI based
operating system.
ADVANTAGES OF GUI:
• With GUI, commands are replaced by graphics. Hence
it is not necessary to remember the command and its
meaning
• With GUI, user can several programs simultaneously.
• User can communicate and exchange data between
programs without transferring or copying files
• Easy to use, consistent GUI for virtually all programs.
FEATURES OF GUI:
1. Replacement of command with icon: This allow the
user to select a command using a cursor and simply
clicking on it
2. Provide on-line help: GUI based applications provide
“HELP” about various features of the application.
HELP can assist the user in knowing everything about
the application
ESSENTIAL COMPONENTS OF
GUI
• Menu bar
• Scroll bar
• Control: (push button, option button, radio button,
check button, list button, entry box combo box)
• Dialogue boxes
• Feedback pointer
OPERATION PERFORMED ON A
WINDOW
M.S. Office − ✕
< >
Arrow
Slider box
Horizontal Vertical
scroll bar scroll bar
Dragging a window:
• The position of window on a screen can be changed by
dragging it.
• To drag a window select a window by clicking mouse,
keep the left button of the mouse pressed with
mouse pointer on the title layer of the windows.
E.g. on the layer in which “M.S. Office” is written in
diagram.
• Move the mouse pointer to new position; it will find
that new window is shifted to new position.
File Manager:
This helps organize user files and directories. This is used
to traverse through the file system and change drives, to
search, copy, move, create or delete files and directories.
Application can be started directly from the file manager.
Control Panel:
It can be used to choose or change the color schemes in
applications, select and display the background of the
screen, select border width and other border
characteristics, cursor size and shape etc. font also
managed by control panel. It is also used to configure
printer and other ports on the PC.
MODULE 7:
ACCESS AND
SECURITY
ASPECTS OF
OS.
SCURITIES
• Security is concerned with the ability of the
operating system to enforce control over the storage
and transportation of data in and between the
objects, that the operating system supports.
• In multiuser operating system, the concept of
security and protection are very important. User
program should not interface with one another or
with the OS.
ELEMENTS OF SECURITY
Confidentiality: Confidentiality ensures that information is
not accessed in an unauthorized manner. It is generally
related to the Read operations.
ATTACKS:
The security of system can be attacked and penetrated in
number of ways as follows:
COMPUTER WORMS
A computer worm is a complete program by itself. It is
written in such a way that it spreads to other computers
over a network. But, while doing this, it consumes the
network resources to a very large extent. A computer
worm can potentially bring the entire network to a halt.
VIRUSES
• A Computer virus is part of computer program, which
is written with clear intension of infecting other
program
• A computer virus is not complete program by itself.
It cannot act independently.
• A computer virus causes direct harm to the system.
It can corrupt code as well as data.
• Classification of virus is based on what do it affects
or where the virus resides
Types of viruses
Ø Boot sector virus
Ø Memory resident virus
Ø File specific virus
Ø Command processor virus
Ø General purpose virus
Answers:
1 b 11 a
2 a 12 b
3 b 13 a
4 b 14 c
5 a 15 d
6 a 16 d
7 c 17 b
8 c 18 c
9 c 19 b
10 b 20 c
CHAPTER 2:
DATA
STRUCTURE
MODULE 1:
INTRODUCTION
INTRODUCTION TO DATA
STRUCTURE
Data: Data are simply values or set of values.
Group item: Data item, which are divided into sub items,
are called group items. For example date may be divide
into three sub-items – day, month and year. So date is
group item.
Example:
Serial Number Name Address Telephone
001 Ram Mumbai 9920872345
002 Ali Ahmedabad 9812830457
Record Field
DATA STRUCTURE
A data structure is a particular way of organizing data in a
computer so that it can be used efficiently. General data
structure types include the array, the file, the record, the
table, the tree, and so on. Data structure is the way in
which different data elements are logically related. The
data structure should be simple and it should show the
relationship between elements.
MODULE 2:
FLOW CHART
ALGORITHM
CONTROL STRUCTURES:
Sequence logic:
In sequence logic module are executed sequentially, one
after another. The sequence may be present explicitly by
means of numbered step or by the order in which modules
are written.
Module A
Module B
Module C
Selection logic:
Selection logic uses number of conditions, which cause
selection of one out of several alternative modules.
a) Single alternative: If the condition is satisfied then
module A, which consists of number of statements, is
executed. Otherwise module A is skipped and next
module is executed.
If
No
Condition
?
Yes
Module A
If
No
Condition
?
Yes
Module A Module B
Iteration logic:
Here certain module is executed repeatedly until condition
satisfies.
At first, the body of loop i.e. module will be executed with
K = R and then with K = R + T, then with K = R + 2T and so
on until K = S. The loop ends when K > S.
KßR
is
Yes
K > S?
No
Module
KßK+T
Module
LINEAR ARRAY:
A data structure is said to be linear if its elements form a
sequence. A linear array is the data structure which
consists of finite, ordered set of homogeneous data
elements such that:
• The elements of array are referenced respectively by
an index set (subscript) consisting of “n” consecutive
numbers.
• The elements of the array are stored respectively in
successive memory locations.
• The number “n” of t he elements is called length or
size of array. In general, the size or length of the
array can be obtained from the index set by the
formula:
Length = UB – LB + 1
Where UB – the largest index called Upper Bound.
LB – the smallest index called Lower Bound.
DATA
1 456
2 789
3 654
4 223
5 777
TRAVERSING AN ARRAY:
Accessing each record or element exactly once, so that it
can be processed is called traversing.
Algorithm:
Here LA is a linear array with lower bound LB and upper
bound UB. Algorithm applies operation PROCESS to each
element of LA.
INSERTING ELEMENTS
Adding a new record to the existing structure is called
inserting. The element can be easily inserted at the end of
array. But for insertion in the middle of array, it is
required to move the elements of array one byte forward.
Algorithm:
INSERT (LA, N, K, ITEM)
Here LA is a linear array with N elements and K is positive
integer, such that K ≤ N. This algorithm insert an element
ITEM at the Kth position in LA.
DELETING ELEMENTS
Removing an element from the existing elements of an
array. The element can be easily deleted from the end of
array. But deletion from the middle of array, it is required
to move the elements of array one byte backward.
Algorithm:
DELETE (LA, N, K, ITEM)
Here LA is a linear array with N elements and K is positive
integer, such that K ≤ N. This algorithm delete an element
ITEM from the Kth position in LA.
BUBBLE SORT:
Arranging elements of an array in ascending or descending
order is called sorting.
Algorithm:
BUBBLE_SORT (LA, N)
Here LA is a linear array with N elements. This algorithm
sorts elements of LA in ascending order.
Explanation:
Suppose LA IS an array of N elements. Sorting these
elements in ascending order means arranging the elements
such that: LA[1] ≤ LA[2] ≤ LA [3] ≤ … ≤ LA[N].
Pass 1: (4 comparisons)
● 5, 12, 3, 9, 16
○ the list stays the same because 5 is less than 12.
● 5, 3, 12, 9, 16
○ 3 and 12 are switched because 3 is less than 12
● 5, 3, 9, 12, 16
○ 9 and 12 are switched since 9 is less than 12
● 5, 3, 9, 12, 16
○ 12 and 16 do not switch because 12 is less than 16
Pass 2: (3 comparisons)
● 3, 5, 9, 12, 16
○ 3 is less than 5, so they switch
● 3, 5, 9, 12, 16
○ 5 is less than 9 so they remain in the same places
● 3, 5, 9, 12, 16
○ 12 is greater than 9 so they do not switch places
Pass 3: (2 comparisons)
● 3, 5, 9, 12, 16
○ 3 is less than 5, so they do not switch
● 3, 5, 9, 12, 16
○ 5 is less than 9 so they remain in the same places
Pass 4: (1 comparison)
● 3, 5, 9, 12, 16
○ 3 is less than 5, so they do not switch
SEARCHING:
Searching means to find out particular element from s
given list of elements or check whether required element
is present or not in an array. There are two type of
searching algorithm as follows:
1. Linear search
2. Binary search
LINEAR SEARCH:
In linear search algorithm desire element is compare with
all the elements in an array until the match is found.
Algorithm:
LINAER (LA, N, ITEM, LOC)
Here LA is linear array with N elements and ITEM is given
element. This algorithm finds the location LOC of ITEM in
LA or set LOC = 0, if search is unsuccessful.
Example:
Let LA has following 5 elements:
9 14 26 37 45
Suppose ITEM = 26
BINARY SEARCH:
Binary search algorithm is used to search an element from
sorted array. In binary search desire element is compare
with value of midpoint. If the value is less than midpoint
value then first half is checked, otherwise second half is
checked until search is successful or interval is empty.
Algorithm:
BINARY (LA, LB, UB, ITEM, LOC)
Here LA is sorted array with lower bound LB and upper
bound UB. ITEM is given element. BEG denotes beginning,
MID denotes middle and END denotes end location of LA.
This algorithm finds the location LOC of ITEM in LA or
sets LOC = NULL, if search is unsuccessful.
Example:
Let LA has following 13 elements:
ADVANTAGES OF BINARY
SEARCH:
1. Binary search algorithm is efficient as the search
scope gets reduced to half the size of the array, with
each iteration.
2. The number of comparison required are
approximately equal to log2n which are less than linear
search.
3. For example:
Let LA has following 13 elements:
9 14 26 37 45 67 78 89 90 97 100 105 150
Suppose ITEM = 45
Step 1: Initially BEG = 1 and END = 13
Hence MID = INT ((1+13)/2) = 7
and so LA[MID] = LA[7] = 78
Step 2: Since 47 < 78, END has its value changed by
END = MID – 1 = 7 – 1 = 6
Hence MID = INT((1+6)/2) = 3
and so LA[MID] = LA[3] = 26
Step 3: Since 45 > 26, BEG has its value changed by
BEG = MID + 1 = 3+1 = 4
Hence MID = INT((4+6)/2) = 5
and do LA[MID] = LA[5] = 45
∴ Found ITEM in location LOC = MID = 5
In above example only two comparisons are required
because in each iteration MID is calculated only one
half is checked.
In the same example, for linear search, 5 comparison
are required.
DISADVANTAGES OF BINARY
SEARCH:
1. The given list must be sorted.
2. The access of list must be random means the middle
element can be accessed.
3. At each iteration, middle entry calculation is
required.
MODULE 3:
REPRESENTATION
OF DATA
STRUCTURE
POINTER ARRAY:
An array is called pointer array, if element of that array is
pointer. An element is called pointer, if it points to another
variable i.e. it contains memory address of another
variable.
Example: Consider an organization, which divides its
employee list into four groups.
Group 1 Group 2 Group 3 Group 4
Deepak Swapnil Amol Yashwant
Nitin Amit Yogesh Chintamani
Vivek Shekhar Kishore
Ravi Rohit
If these groups are to be presented in memory, the most
efficient way is to use arrays. The first is Employee array,
which contains list of Employees in all four groups
sequentially, while the second array is group array, which is
a pointer array, which contains starting address of each
group in the Employee array, respectively.
Employee
1 Deepak
Group 1 Nitin
2
3 Swapnil
4 Amit Group: pointer array
Group 2
5 Vivek 1 1
6 Ravi 3 2
7 Amol 7 3 n
Group 3 8 Yogesh 10 4
9 Shekhar
10 Yashwant
11 Chinatamani
Group 4
12 Kishore
13 Rohit
VICKY CHAUHAN (MVC) 9920644662 83
COMPUTER SCIENCE
RECORD:
• A record is collection of relative data item, each of
which is called as field or attribute.
• Collection of records is known as files. Collection of
data is frequently organized into a hierarchy of fields,
records and files.
• A record may contain non-homogeneous data i.e. data
items of record need not be of same data type. In a
record, natural ordering of elements is not possible.
The elements in record can be described by level
number.
Example: An organization keeps records of its Employees.
It contains following data items- Name, Sex, Birthday,
Address. Name is group item consisting of First name,
Middle name and last name. Also, Birth date and address
are group items.
The structure of this record is shown in figure below.
1. Employee
2. Name
3. First name
3. Middle name
3. Last name
2. Sex
2. Salary
2. Birth date
3. Date
3. Month
3. Year
2. Address
3. City
3. Pin code
REPRESENTATION OF RECORD
IN MEMORY USING ARRAY
Consider a record, whose structure is given below:
1. Employee
2. Name
3. First name
3. Last name
2. Sex
2. Address
3. City
3. Pin code
2. phone no.
To represent this record in memory, linear array are used.
One separate linear array is used for each elementary
item of record such as First name, Last name, Sex, City,
Pincode, Phone no.
Following figure shows representation of above record
using parallel linear arrays.
First name Last name Sex City Pincode Phone no.
Record [1]
Record [2]
LINKED LIST
• A linked list is a linear collection of data elements,
called nodes, where the linear order is maintained with
the help of pointers. Linked list is also called one way
list.
• Each node in linked list is divided into two parts. First
part is called INFO part, which contain the information
about the element or actual element and second part is
called LINK part, which is next pointer field i.e. it
contains the address of next node in the list.
Example:
Info Link (Pointer to next node)
Start v v
v 12 A 15 B 24 C 33 D 38 E X
12 15 24 33 38
REPRESENTATION OF LINKED
LIST IN MEMORY
Lined list can be represented in memory by using two
arrays respectively known as INFO and LINK, such that
INFO[K] and LINK[K] contains information of element and
next node address respectively.
The list also requires a variable ‘Name’ or ‘Start’, which
contains address of first node. Pointer field of last node
denoted by NULL which indicates the end of list e.g.
consider linked list given below:
Start
v
5 A 9 B 4 C 1 D X
C 1
LIFO SYSTEM
• LIFO system is first in first out system. In this system,
the element which is inserted at last, will be deleted
first.
• Stack is an example of LIFO system. It is a linear
system in which insertion and deletion takes place only at
one end i.e. top of the list.
• The insertion operation is referred to as push and
deletion as pop.
FIFO SYSTEM
• A FIFO system is first in first out system. In this type
of system, the element which is inserted first in the list
will also deleted first.
• Queue is an example of FIFO system. A queue is a linear
list, in which insertion takes place only at one end of the
list known as ‘rear’ of the list and deletion takes place at
the other end known as ‘front’ of the list.
MODULE 4:
TREE
TREE:
Tree is a non-linear hierarchical data structure which
consists of finite set of one or more nodes (i.e. collected
data items).
B C
D E F G H
J K
I
B C Level 1
D E F G Level 2
Degree:
The number of sub-trees of a node is called degree of a
node. The degree of a tree is the maximum degree of the
node in a tree.
Example:
AZ
Node Degree
A 2
B C
B 2
C 3
D E F G H D,E,F,G,H 0
Depth / height:
Depth of a tree is defined as maximum level of any node in
a tree. If root is level 0 then depth or height of tree is
equal to 1 + largest level number.
Example: Depth of above tree is 3.
94 VICKY CHAUHAN (MVC) 9920644662
COMPUTER SCIENCE
BINARY TREE:
Binary tree is a finite set of elements called nodes such
that is:
1. It may be empty or
2. It is partitioned into three disjoint subsets:
• There is a single distinguished element called the
root of tree.
• Other two subsets are themselves binary tree
called left sub-tree and right sub-tree of the
original tree.
A left and right sub-tree can be empty. In binary tree,
there is no node with degree greater than two.
Example:
A
B C
D E F G
B C
D E F G
Internal node
External node
Binary search tree:
It is a binary tree in which each node N of tree has the
property that the value at N is greater than the value in
the left sub-tree of N and is less than or equal to every
node value in the right sub-tree of N.
28
19 30
10 20 22 35
15
REPRESENTATION OF BINARY
TREE IN MEMORY
A binary tree can be represented in memory by two types
of representation:
• Linked representation
• Sequential representation
Linked representation:
Linked representation uses three parallel arrays INFO and
LEFT and RIGHT and pointer variable ROOT such that for
an index K, INFO[K] contains actual element, LEFT[K]
contains address of left child and RIGHT[K] contains
address of right child.
Root
A
B C
X D X X E X F G
X H X X I X X J X
Sequential representation:
For sequential representation, only one linear array is used.
This array is generally known as TREE such that:
• The root R of the tree is stored in TREE[1].
• If a node N of tree stored in TREE[K], then,
Its left successor is stored in TREE[2*K] and right
successor stored in TREE[(2*K) + 1]
Example: consider binary tree as below:
B C
D E F
VICKY CHAUHAN (MVC) 9920644662 99
COMPUTER SCIENCE
TREE
1 A
2 B
3 C
4 D
5 E
6 -
7 F
8 -
9 -
10 -
E /
- +
a b * e
c d
* y - 3
2 x a *
7 b
* **
+ c a +
a b - a
b c
4) X = (p + q) / ((r + s) + t)
X /
+ +
p q + t
r s
E /
* Y - 3
2 X * *B
5 A
1 c 8 d
2 a 9 c
3 b 10 a
4 c 11 a
5 c 12 b
6 d 13 b
7 c 14 c
CHAPTER 3:
C++
MODULE 1:
INTRODUCTION
TO C++
C++
PROGARAMMING
C++ is object oriented programming
language. Initially C++ was named as
“C with classes”. C++ was developed
by Bjarne Stroustrup at AT & T Bjarne Stroustrup
Bell Laboratories, USA, in the early
eighties
ADVANTAGES OF C++
The advantages of C++ are:
DIFFERENCE BETWEEN
TRADITIONAL PROCEDURAL AND
OBJECT ORIENTED
PROGRAMMING LANGUAGE
Traditional Procedural Object Oriented
Programming Programming
In this approach, the In this approach, the
problem is viewed as a problem is decomposed into
sequence of things to be a number of entities called
done. objects and then builds data
and function around these
entities.
The following table shows all basic data types and its size
in terms of bytes:
Type Bytes
char 1
int 2
short int 2
long int 4
float 4
double 8
long double 10
Output:
Local = 20
Global = 10
MEMORY MANAGEMENT
OPERATORS
C++ provides two memory management operator:
new and delete
Example:
# include <iostream.h>
# include <string.h>
void main( )
{
char *str = “COMPUTER”;
int len = strlen(str);
char * ptr = new char [len+1];
strcpy(ptr, str);
cout << “ptr = ” << ptr;
delete ptr ;
}
114 VICKY CHAUHAN (MVC) 9920644662
COMPUTER SCIENCE
FUNCTION OVERLOADING
• The use of same function name to create functions that
perform a variety of different tasks is called as
function overloading.
• Overloading refer to the use of same thing for
different purposes.
• Using the concept of function overloading, create a
family with one function name but with different
argument lists.
• The function would perform different operation,
depending on argument list in function call.
• The correct function to be invoked is determined by
checking the number and the type of the arguments and
not on the function type.
POINTERS
A pointer is a variable, which holds the memory address of
other variable. “ * ” Operator is used to declare pointer
variable.
The general format of pointer declaration is:
DataType * VariableName;
Example:
# include <iostream.h>
int sum (int x, int y)
void main( )
{
int a, b;
cout<< “enter 2 nos”;
cin >> a >> b;
cout << sum(a,b);
}
int sum (int x, int y)
{
return (x+y);
}
In above example, we are calling function sum by passing
values of a and b as parameter, which gets copied into x
and y. hence whatever calculation is done that will be with
respect to x and y only not w.r.t a and b.
VICKY CHAUHAN (MVC) 9920644662 119
COMPUTER SCIENCE
Call by reference:
• In call by reference, when a function is called by a
program the address of the actual arguments are copied
on to the formal arguments. i.e. the formal and actual
arguments are referring to same memory location.
• Therefore change in value of formal argument affects
the value of actual arguments.
• The content of a variable that are altered within the
function are return to calling portion of a program in the
altered form.
MODULE 2:
INTRODUCTION
OOPS
PRINCIPLE OF OBJECT
ORIENTED PROGRAMMING:
Definition of OOP:
• “Object oriented programming is an approach that
provides a way of modularizing programs by creating
partitioned memory area for both data and functions
that can be used as templates for creating copies of
such modules on demand.”
• In object oriented programming, the program is designed
around the data being operated upon rather than upon
operations themselves.
• It ties data more closely to functions that operate on it.
OOP allows decomposing a problem into a number of
entities called objects and then builds data and
functions around these entities.
Features of OOP:
• Emphasis is on data rather than procedure.
• Programs are divided into number of objects.
• Data structures are designed such that they
characterized the object.
• Functions that operated on the data of an object are
tied together in the data structure.
• Data is hidden and cannot be accessed by other external
functions.
• Objects may communicate with each other through
function.
• New data and functions can be easily added wherever
required.
Classes:
• Class is a way to bind data and its associated function
together.
• The entire set of data and code of an object can be
made a user define data type with the help of a class.
• In fact an object is nothing but a variable, whose data
type is class.
• Once a class has been defined, user can define any
number of objects belonging to that class.
• A class is a collection of objects of similar type.
Inheritance:
• The mechanism of deriving a new class from existing one
is called as inheritance.
• Inheritance is the process by which object of one class
can acquire the properties of objects of another class.
• In OOP, inheritance stands for reusability. This means
that additional feature can be added to an existing class
without modifying it.
Polymorphism:
• Polymorphism is an important OOP concept.
Polymorphism means ability to take more than one form.
• Polymorphism plays an important in allowing objects
having different internal structures to share the same
external interface.
• This means that a general class of operation may be
accessed in the same manner even though specific
actions associated with each operation may differ.
• Polymorphism is extensively used in implementing
inheritance.
Data abstraction:
• Abstraction refers to the act of representing essential
features without including the background details of
explanations.
• Classes are the concept of abstraction and are defined
as a list of abstract attributes and functions to operate
on these attributes.
• They encapsulation all the essential properties of the
object that are to be created.
MODULE 3:
INTRODUCTION
CLASS
CLASS
Class is a way to bind data and its associated function
together. It allows the data and function to be hidden, if
necessary, from external use. When defining a class, a new
abstract data type that can be created that treated like
any other build-in data type.
Class declaration:
The class declaration describes the type and scope of its
members.
Syntax:
class class_name
{
private:
declaration of variable;
declaration of function;
public:
declaration of variable;
declaration of function;
};
Example
class item
{
private:
int number;
float cost;
public:
void getdata(int a, int b);
void putdata(void);
};
Example
class add void add :: sum(int x, int y)
{ {
private: z = x + y;
int z; cout <<”Total is”<< z;
public: }
void sum(int x, int y);
};
Example
class add
{
private:
int z;
public:
void sum(int x, int y)
{
z = x + y;
cout <<”Total is”<< z;
}
};
MODULE 4:
FRIEND FUNCTION
STATIC DATA
MEMBER
FRIEND FUNCTIONS
C++ allows the common function to be made friendly with
more than one class, thereby allowing the function to have
access to the private data of classes. Such a function need
not be a member of any classes.
Non-member function cannot have access to the private
data of a class. However, there could be a situation where
user would like two classes to share a particular function.
At this situation friend function is used.
CHARACTERISTICS OF FRIEND
FUNCTION:
1) It is not in the scope of the class to which it has
been declared as friend.
2) Since it is not in the scope of the class, it cannot be
called by using object of that class. It is called like
normal C++ function.
3) It can be declared either in public or private part of
a class without affecting its meaning.
4) Usually, it has the objects as arguments.
5) It cannot access the member function directly and
has to use an object name and dot operator with each
member name.
CHARACTERISTICS OF STATIC
DATA MEMBER IN CLASS:
1) It is initialized to zero when the first object of its
class is created. No other initialization is permitted.
2) Only one copy of that class member is created for
the entire class and is shared by all the objects of
that class, no matter how many objects are created.
3) It is visible only within the class, but its lifetime is
the entire program.
MODULE 5:
CONSRUCTOR AND
DESTRUCTOR
CONSTRUCTOR AND
DESTRUCTOR
Constructor:
Definition: “It is special member function of a class. Its
task is to initialize the objects of its class.”
Explanation:
• It is special because its name is same as that of the class
to which it belongs.
• The constructor is invoked whenever an object of its
associated class is created.
• It is called constructor because it construct the values of
data member of the class.
• A constructor can never return any value. Hence, it is
written with no return type (even void is not written).
Example
class abc
{
private:
int m, n;
public:
abc (void);
};
abc :: abc (void) // constructor defined
{ m = 0;
n = 0;
}
void main ( )
{
abc p;
}
136 VICKY CHAUHAN (MVC) 9920644662
COMPUTER SCIENCE
Parameterized constructor:
Generally a constructor initializes the class object to
predetermined values. But, in practice, it may be necessary
to initialize data elements of objects to different values.
To achieve this we are using parameterized constructor.
Example
class abc
{
private:
int m, n;
public:
abc (int x, int y);
};
abc :: abc (int x, int y) // constructor defined
{ m = x;
n = y;
}
void main ( )
{
abc p(0,1);
}
This creates the objects “p” of type abc, also initialized its
data members m to 0 and n to 1.
CHARACTERISTICS OF
CONSTRUCTOR:
• The constructor name is always same as the class name.
• They do not have return types, not even void and
therefore, they cannot return values.
• They cannot be static or virtual.
• They should be declared in public section.
• They cannot be inherited.
• Like other C++ functions, they can have default
arguments.
• We cannot refer to their address.
• An object with a constructor cannot be used as member
of union.
• They make implicit calls to the operators ‘new’ and
‘delete’ when memory allocation required.
• When a constructor is declared for a class, initialization
of class objects become mandatory, since constructor is
invoked automatically when the objects are created.
Destructor:
Definition:
A destructor is used to destroy the objects that have
been created by constructor.
Explanation:
The destructor is invoked implicitly by the compiler upon
exit from the program to clean up storage that is no longer
accessible. It is good practice to declare destructor in a
program.
138 VICKY CHAUHAN (MVC) 9920644662
COMPUTER SCIENCE
MODULE 6:
OPERATOR
OVERLOADING
OPERATOR OVERLOADING
Definition:
The mechanism of giving some special meaning to an
operator is called as operator overloading.
Explanation:
C++ permits to add two variables of user-defined data
types with the same syntax as the basic types. This means
that C++ has the ability to provide operator with a special
meaning for a data type. This is nothing but operator
overloading.
Example
# include <iostream.h>
class counter void main( )
{ {
private: counter c1, c2;
int count; cout <<“c1=”<<c1.get_count( );
public: cout<<“c2=”<<c2.get_count( );
counter ( ) c1++;
{ c2++;
count = 0; ++c2;
} cout <<“c1=”<<c1.get_count( );
int get_count( ) cout<<“c2=”<<c2.get_count( );
{ }
return count;
}
void operator ++ ( )
{
count++;
}
};
Example
# include <iostream.h> void main( ) ………
class time {
{ time t1;
private: int m = t1;
int hr, min; }
};
time :: operator int( )
{
int min1 = hr * 60;
min1 = min1 + min;
return min1;
}
Example:
obj A = obj B
Destination Source
MODULE 7:
INHERITANCE
INHERITANCE
Definition:
The mechanism of deriving a new class from an old one is
called as inheritance. The old class is called base class and
new is called derived class.
Explanation:
C++ supports the concept of reusability. Once class has
been written and tested, same class ca be used by other
programmer to suit their requirement.
This can be done by creating new classes, reusing the
properties of existing ones.
Because of reusability one can save time and efforts for
development of same class.
Feature A Feature C
Feature B Feature A
Derived class
Syntax:
class derived-class-name : visibility-mode base-class-name
{
//Members of derived class
};
Where visibility mode is optional and if present may be
either public or private.
Example
# include <iostream.h>
class base void main( )
{ public: { derived p;
void showbase( ) p.showderived;
{ }
cout<< “BASE”;
}
};
class derived:public base
{ public:
void showderived( )
{
showbase( );
cout<<“DERIVED”;
}
};
OUTPUT BASE
DERIVED
TYPES OF INHERITENCE
B1 B2 .... Bn
Base class
2 B1
D Derived class
EXAMPLE: B
A C
A
D
A
class A : visibility-mode B
{
//Members of A
};
class C : visibility-mode B
{
//Members of C
};
class D : visibility-mode A, visibility-mode C
{
//Members of D
};
MODULE 8:
POLYMORPHISM
POLYMORPHISM
Polymorphism refers to identically named methods that
have different behavior depending on the type of object
they refer.
Polymorphism simply means “one name, multiple forms”.
Polymorphism
Runtime polymorphism:
In some situation, it is nice to select appropriate member
function to be invoked while the program is running. This is
known as runtime polymorphism.
Example
class A class B: public A
{ {
private: private:
int x; int y;
public: public:
void show( ) void show( )
{…} {…}
}; ……. };
MODULE 9:
WORKING WITH
FILES:
Read Data
data input
Disk
files Program
Data
Write Output stream
output
data
iostream.h file
ios
iostream
fstream base
fstream.h file
base
Classes Contents
1. filebuf It perpose is to set the file buffer to read
and write. Contains ‘openprot’ constant and
used in the “open( )” of file stream class.
Also contains close( ) and open( ) as
members.
2.fstreambase Provides operations common to the file
streams serves as base class for fstream,
ofsream and ifsream class.
Contains open( ) and close( ) functions.
3. ifstream Provides input operations and contains
open( ) with default input mode. Inherits
get( ), getline( ), read( ), seekg( ), and
tellg( ) from istream.
4. ofstream Provides output operations and contains
open( ) with default output mode. Inherits
put( ), write( ), seekp( ), and tellp( ) from
ostream.
5. fstream Provides support for simultaneous input
and output operations. Contains open( )
with default input mode. Inherits all the
function from istream and ostream classes
through iostream.
FILES MODES
Parameter Meaning
ios::app Append to end of file.
ios::ate Go to end of file on opening.
ios::binary Binary file.
ios::in Open a file for reading only.
ios::nocreate Open a fails if the file does
not exist.
ios::noreplace Open a fails if the file
already exist.
ios::out Open a file for writing only.
ios::trunc Delete content of file, if
exist.
Example
Open a file to read strean object from “data”:
ifstream p;
p.open(“data”);
Closing a file:
Function close( ) is used to close s file, which is opened for
read or write operation
The general format for opening a file:
stream-object.close( );
Here stream-object is object created to open any file. In
above example we opened file data for writing purpose by
creating object q, which can be closed as q.close( ).
MODULE 10:
IMPORTANT
PROGRAMS
#include<iostream.h>
void main( )
{
int a, b;
while(a!=b)
{
if(a>b)
a = a – b;
else
b = b – a;
}
#include<iostream.h>
class gcd
{
public:
void gcd1(int x, int y);
};
void main( )
{
int a,b;
gcd p;
#include<iostream.h>
void main( )
{
int a[10], i, sum=0;
float avg;
cout<<”Enter 10 numbers”<<endl;
for(i=0; i<10; i++)
{
cin>>a[i];
}
avg = sum/10.0;
#include<iostream.h>
void main( )
{
int f0=0, f1=1, f, n, i;
#include<iostream.h>
#include<stdio.h>
#include<string.h>
void main( )
{
int l, count=0, i;
char a[100];
l = strlen(a);
#include<iostream.h>
void main( )
{
int f=1, n, i;
#include<iostream.h>
void main( )
{
int i, j, a[100],n;
#include<iostream.h>
double power(double x, double y);
void main( )
{
double a, b, c;
c=power(a,b);
cout<<a<<”^”<<b<<”=”<<c;
}
return p;
}
#include<iostream.h>
void main( )
{
int n, flag = 0, i;
if(flag==0)
cout<<”Number is prime”;
else
cout<<”Number is not a prime”;
#include<iostream.h>
void ComputeSphere(float &s, float &v, float r);
void main( )
{
float s, v, r;
#include<iostream.h>
class circle
{
private:
float pi=3.14, a;
public:
float area(float r)
{
a = pi * r * r;
return a;
}
};
void main( )
{
float rad;
circle p;
#include<iostream.h>
#include<math.h>
void ComputeTriagle(float &a, float &p, float x, float y,
float z);
void main( )
{
float a, p, x, y, z;
ComputeTriangle(a, p, x, y, z);
#include<iostream.h>
#include<string.h>
#include<stdio.h>
void main( )
{
char a[100];
int l;
l = strlen(a);
for(i=0; i<l; i++)
{
if(a[i]==” ”)
a[i] = - ;
}
#include<iostream.h>
#include<string.h>
void main( )
{
string line[100], s;
int n = 0, len, maxl = 0, i;
while(!cin.efo( ))
{
getline(cin,s);
len = s.length ( );
if(len > maxl)
maxl = len;
line[n++] = s;
}
--n;
for(i=0; i<n; i++)
{
s = line[i];
len = s.length( a)
cout<<string(maxl_len,’ ’)<<s<<endl;
}
}
1. Float *ptr
In above declaration, data type of ptr is ____ and
type of variable pointed by ptr is ____.
a) float, float b) float, int c) int, float d) pointer,
float.
2. When a function is called by reference, it can work
an ____ variables in the calling program.
a) original b) virtual c) copies of d) none
3. *ptr ++ means____.
a) Increment the content of ptr by size of data
type to which ptr is pointer
b) Increment the content of ptr by one.
c) Increment the content of memory location
pointed by ptr by one.
d) None of these
4. Last character of a string is____.
a) O b) \O c) \n d) end
5. When we use string functions such as strlen( ) etc.
then it must include file____.
a) # include <string.h> b) # include <iostream.h>
c) # include <fstream.h> d) # include <iostring.h>
6. Objects are basic ____ in object oriented
programming.
a) run time entities b) compile time entities c) both
d) none
7. Object is variable, whose data type is ____.
a) integer b) class c) structure d) float
8. ____ is not visibility label.
a) public b) private c) separate d) protected
CHAPTER 4:
HTML
MODULE 1:
INTRODUCTION
TO HTML
HTML
• HTML Stands for hyperText Mark-up Language, used to
create World Wide Web (WWW) document.
• Hypertext is ordinary text with extra features such as
formatting, images, multimedia and links to other
documents.
• Mark-up is the process of taking ordinary text and
adding extra symbols. Each of the symbols used for mark-
up in HTML is command that tells the browser how to
display the text.
• Mark-up languages are special type of computer language.
They are concerned with only parts of documents
according to their functions.
• They indicate which part of document is title, which is
subheading, which is author’s name and so on.
• HTML is essentially a set of instructions to web browser
for formatting and layout of web pages.
FEATURES OF HTML
• HTML is a set of tags that is used to create document
and then it can be published on the World Wide Web.
• HTML lets user jump from topic rather than finding and
reading information linearly.
• Documents prepared in HTML includes reference graphics
and formatting tags.
• HTML Supports to frames including target window and
borderless frame.
• It contains powerful formatting facilities for text, pages,
images etc.
ADVANTAGES OF HTML
• For creating a HTML document, only text editor is
needed. No special software is needed.
• HTML document can be created on any hardware platform
using any text editor.
• HTML is easy to learn and implement.
• Contain powerful formatting facilities.
• Any HTML document can be updated easily, without
changing whole document.
• If something is not working, then finding error is easy in
HTML.
• HTML will not cost anything for its use. There are no
expensive licenses to buy or no updates to purchase.
DISADVANTAGES OF HTML
• HTML is not a programming language in true sense.
• Any simple calculation cannot be done in HTML.
• It cannot be used to display even date.
• The interactive web pages cannot be built by HTML.
• The web pages developed in HTML cannot behave like an
application.
• The web pages developed in HTML do not have their own
interface.
• Hyperlink is providing in HTML. But for that we need a
trip to server at each step.
MODULE 2:
TAGS IN HTML
TAGS IN HTML
HTML tags are used to mark-up HTML elements
HTML tags are surrounded by the two characters < and >
The surrounding characters are called angle brackets
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is
the end tag The text between the start and end tags is
the element content
HTML tags are not case sensitive, <b> means the same as
<B>
Example:
<p> your text </p>
<p align="left"> your text </p>
<p align="right"> your text </p>
<p align="center"> your text </p>
Heading tags:
[<h1> </h1>, <h2> </h2>, <h3> </h3>, <h4> </h4>, <h5> </h5>,
<h6> </h6>]
Headings are useful when you want to organize text into
named sections. In all there are six headings of form <hn>,
where n is any number between 1 and 6; and closing tags
are of the form </hn> are needed to close the six
different heading tags. Applying heading tags to text
causes that text to have a predetermined size and format.
H1 is the largest, and H6 is the smallest.
Example:
This code Would display
<h1>This
<h2>This
is
is
heading</h1>
heading</h2>
This is a heading
<h3>This is heading</h3>
<h4>This is heading</h4> This is a heading
<h5>This is heading</h5>
<h6>This is heading</h6> This is a heading
This is a heading
This is a heading
This is a heading
<BR> tag (break tag): The <br> tag is used when you want
to start a new line, but don't want to start a new
paragraph. The <br> tag forces a line break wherever you
place it. It is similar to single spacing in a document. The
<br> tag has no closing tag.
Example:
This code Would display
<p> This <br> is a para <br> This
graph with line breaks </p> is a para
graph with line breaks
Example:
This code Would display
<hr width=“50%” size=“6”>
Example:
This code Would display
<PRE>
1 1
1 1 1 1
1 2 1 1 2 1
1 3 3 1 1 3 3 1
</PRE>
<B> tag: Bold tag: The text appearing between start tag
<B> and end tag </B> will be display in bold letters.
Example
This code Would display
<P> This is normal </P><BR> This is normal
<B> This is big </B>
This is big
Example:
This code Would display
<P> This is normal </P><BR> This is normal
<I> This is italic </I>
This is italic
Example:
This code Would display
<P> This is normal </P><BR> This is normal
<U> This is underlined </U>
This is underlined
Example:
This code Would display
E = MC<SUP>2</SUP> E = MC2
Example:
This code Would display
H <SUB> 2 </SUB> O H2O
<BIG> tag: The text appearing within start tag <BIG> and
end tag </BIG> is displayed in larger font. If size is
already larger, then tag is ignored.
<BIG> Tag has the same effect as <FONT SIZE = “+1”>
Example:
This code Would display
<p>This text is normal.</p> This text is normal.
<p><big>This text is
bigger.</big></p>
This text is bigger.
Example:
This code Would display
<p>This is normal</p><BR> This is normal
<small>This is smaller</small>
This is smaller
Example:
This code Would display
<P>This is normal</P><BR> This is normal
<EM>This is emphasis </EM>
This is emphasis
Example:
This code Would display
<P> This is normal </P><BR> This is normal
<STRONG> This is strong
</STRONG>
This is strong
Example:
This code
<P> This is normal </P><BR>
<FONT FACE="Arial" SIZE="3"> This is Arial </FONT><BR>
<FONT FACE="TimesNewRoman" SIZE="6"> This is TimesNewRoman
</FONT>
Would display
This is normal
This is Arial
This is TimesNewRoman
UNORDERED LIST
In an unordered list bullets are placed before each list
item. The basic form for an unordered list uses he <UL>
tag, a collection of <LI> </LI> tags for each of the list
items, and finally a </UL> to tell the browser that the list
is complete.
Example:
This code Would display
<UL> • Coffee
<LI>Coffee</LI>
<LI>Milk</LI> • Milk
<LI>Curd</LI> • Curd
</UL>
Example:
This code Would display
<UL TYPE = “CIRCLE”> o Coffee
<LI>Coffee</LI>
<LI>Milk</LI>
o Milk
<LI>Curd</LI> o Curd
</UL>
ORDERED LIST
The ordered list numbers each item consecutively. The
basic form for an ordered list is the <ol> tag, (which stands
for ordered list), a collection of list items identified by <li>
</li> tags, and then the </ol> tag.
Example:
This code Would display
<OL> • Coffee
<LI>Coffee</LI>
<LI>Milk</LI> • Milk
<LI>Curd</LI> • Curd
</OL>
Example:
This code Would display
<OL TYPE = “a”> a. Coffee
<LI>Coffee</LI>
<LI>Milk</LI>
b. Milk
<LI>Curd</LI> c. Curd
</OL>
<IMG> tag: Image tag: The <img> tag, where IMG stands
for image has no </img> counterpart, but does have several
useful attributes. The SRC attribute is the only necessary
option for the <img> tag, since the browser must know
where it can find the image file. The SRC option can be set
to equal a valid filename, if the image file is located in the
same directory as the source document of an image file.
Following are the attributes used along with <IMG> tag
SRC="FILENAME" - Specifies the SOURCE of the image;
if the image file is in the same directory as the source
document, all that is needed is the filename itself. Note:
Don't link to another page for an image - copy the image to
your filespace and link to it from there (with permission of
course!)
• HEIGHT = "NUMBER" - Specifies that the height of
the image should be NUMBER pixels.
• WIDTH = "NUMBER" - Specifies that the width of
the image should be NUMBER pixels.
• ALT = "DESCRIPTION" - Specifies a description of
the image. The ALT option for the IMG tag is useful
for those whose browsers cannot support in-line
images, or have their images turned off in their
VICKY CHAUHAN (MVC) 9920644662 205
COMPUTER SCIENCE
Example:
This code Would display
<IMG SRC ="graphics/chef.gif"
BORDER = “2” >
TYPES OF HYPERLINK:
a. Link to page on the World Wide Web:
Example:
<A HREF = “http://www.google.com”> search </A>
The string “search” is a hyperlink to the website
www.google.com.
206 VICKY CHAUHAN (MVC) 9920644662
COMPUTER SCIENCE
RGB codes:
R: RED
G: GREEN
B: BLUE
TABLE:
Tables are defined with the <table> tag. A table is divided
into rows (with the <TR> tag), and each row is divided into
data cells (with the <TD> tag or <TH> tag). The letters TD
stands for table data, which is the content of a data cell.
The letter TH stands for table heading. A data cell can
contain text, images, lists, paragraphs, forms, horizontal
rules, tables, etc.
Example:
This code Would display
<table>
<tr>
<td>Ram</td>
Ram Patel 50
<td>Patel</td> John Demelo 94
<td>50</td> Ali Khan 80
</tr>
<tr>
<td>John</td>
<td>Demelo</td>
<td>94</td>
</tr>
<tr>
<td>Ali</td>
<td>Khan</td>
<td>80</td>
</tr>
</table>
MODULE 3:
IMPORTANT
PROGRAM
CRICKET ANALYSIS
COUNTRY PLAYED WON LOSE
INDIA 30 23 07
AUS 24 19 05
PAK 18 02 16
ZIM 10 07 03
<HTML>
<BODY>
<CAPTION ALIGN = "TOP"> CRICKET ANALYSIS </CAPTION>
<TABLE BORDER="3">
<TR>
<TH>COUNTRY</TH>
<TH>PLAYED</TH>
<TH>WON</TH>
<TH>LOSE</TH>
</TR>
<TR>
<TD>INDIA</TD>
<TD>30</TD>
<TD>23</TD>
<TD>07</TD>
</TR>
<TR>
<TD>AUS</TD>
<TD>24</TD>
<TD>19</TD>
<TD>05</TD>
</TR>
<TR>
<TD>PAK</TD>
<TD>18</TD>
<TD>02</TD>
<TD>16</TD>
</TR>
<TR>
<TD>ZIM</TD>
<TD>10</TD>
<TD>07</TD>
<TD>03</TD>
</TR>
</TABLE>
</BODY>
</HTML>
VICKY CHAUHAN (MVC) 9920644662 213
COMPUTER SCIENCE
</TABLE>
</BODY>
</HTML>
YEAR
1998 1999 2000
Units 500 400 1000
Sales
Income 1000 800 2000
<HTML>
<BODY>
<TABLE BORDER="3" CELLSPACING="15">
<TR ALIGN="CENTER">
<TD ROWSPAN="2" COLSPAN="2"></TD>
<TD COLSPAN="3">YEAR</TD>
</TR>
<TR ALIGN="CENTER">
<TD>1998</TD>
<TD>1999</TD>
<TD>2000</TD>
</TR>
<TR ALIGN="CENTER">
<TD ROWSPAN="2">Sales</TD>
<TD>Units</TD>
<TD>500</TD>
<TD>400</TD>
<TD>1000</TD>
</TR>
<TR ALIGN="CENTER">
<TD>Income</TD>
<TD>1000</TD>
<TD>800</TD>
<TD>2000</TD>
</TR>
</TABLE>
</BODY>
</HTML>
SCIENCE
F.Y.B.Sc S.Y.B.Sc T.Y.B.Sc
300 100 25
ARTS
F.Y.B.A S.Y.B.A T.Y.B.A
200 150 40
COMMERCE
F.Y.Bcom. S.Y.Bcom. T.Y.Bcom.
300 70 50
<HTML>
<BODY>
<TABLE BORDER="1" CELLPADDING = 20 CELLSPACING = 10 >
<TR>
<TH COLSPAN = 3 ALIGN = center > SCIENCE </TH>
</TR>
<TR>
<TH> F.Y. B.Sc. </TH>
<TH> S.Y. B.Sc. </TH>
<TH> T.Y. B.Sc. </TH>
</TR>
<TR>
<TD ALIGN = center > 300 </TD>
<TD ALIGN = center > 100 </TD>
<TD ALIGN = center > 25 </TD>
</TR>
<TR>
<TH COLSPAN = 3 ALIGN = center > ARTS </TH>
</TR>
<TR>
<TH> F.Y. B.Sc. </TH>
<TH> S.Y. B.Sc. </TH>
<TH> T.Y. B.Sc. </TH>
</TR>
<TR>
<TD ALIGN = center > 200 </TD>
<TD ALIGN = center > 150 </TD>
<TD ALIGN = center > 40 </TD>
</TR>
<TR>
<TH COLSPAN = 3 ALIGN = center > COMMERCE </TH>
</TR>
<TR>
<TH> F.Y. B.Sc. </TH>
<TH> S.Y. B.Sc. </TH>
<TH> T.Y. B.Sc. </TH>
</TR>
<TR>
<TD ALIGN = center > 300 </TD>
<TD ALIGN = center > 70 </TD>
<TD ALIGN = center > 50 </TD>
</TR>
</TABLE>
</BODY>
</HTML>
1 Paper I
Computer Science 2 Paper II
• 200 Marks
<HTML>
<BODY>
<TABLE BORDER= 5 WIDTH = 50% >
<TR>
<TD WIDTH = 100% COLSPAN = 2 >
<H1 ALIGN = center> HSC Boards Exams </H1>
</TD>
</TR>
<TR>
<TD WIDTH = 50% ROWSPAN = 3 >
<P ALIGN = center><B> computer science </B>
</TD>
<TR>
<TD WIDTH = 50% ALIGN = center>
<OL>
<LI> paper I </LI>
<LI> paper II </LI>
</OL>
</TD>
</TR>
<TR>
<TD WIDTH = 50% ALIGN = center>
<UL>
<LI> <P ALIGN = center> 200 Marks </LI>
</UL>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
<HTML>
<BODY>
<TABLE BORDER= ”2” CELLSPACING = “15” >
<TR>
<TD ROWSPAN = 2 ALIGN = center > COMPUTER SCIENCE </TD>
<TD ALIGN = center > PAPER-I </TD>
<TD ALIGN = center > PAPER-II</TD>
<TD ALIGN = center > TOTAL </TD>
</TR>
<TR>
<TD ALIGN = center > 100 </TD>
<TD ALIGN = center > 100 </TD>
<TD ALIGN = center > 200 </TD>
</TR>
</TABLE>
</BODY>
</HTML>
Education
PWD ADMIN
For details
Feel free to approach us
<HTML>
<BODY>
<H2> Government of Maharashtra </H2>
<BODY>
<TABLE BORDER= 2 WIDTH = 50%>
<TR>
<TD WIDTH = 100% COLSPAN = 2 >
<H1 ALIGN = “center”> HSC Board Exams </H1>
</TD>
</TR>
<TR>
<TD WIDTH = 50% ALIGN = center> <U> Paper I </U> </TD>
<TD WIDTH = 50% ALIGN = center> <U> Paper II </U> </TD>
</TR>
<TR>
<TD WIDTH = 50% > <P ALIGN = center ><I> 50 Marks </I > </TD>
<TD WIDTH = 50% > <P ALIGN = center ><I> 50 Marks </I > </TD>
</TR>
</TABLE>
</BODY>
</HTML>
OUTPUT:
<html>
<title> Introduction </title>
<body>
<h1> <b> COMPUTER SCIENCE <b> </h1>
<hr>
<u> SCHAUM'S OUTLINE SERIES </u>
<hr>
<h5>SEYMOUR LIPSCHUTZ </h5>
</body>
</html>
OUTPUT:
OUTPUT:
LIST OF BOOKS
(Text size h1 in bold, default Font is used)
o How to solve it by computer (Text size is default,
o HTML in easy steps Regular font is used)
o C++ Programming
<html>
<body>
<h1> <center> HSC SYLLABUS </center> </h1>
<h3> PAPER I </h3>
To know more about
<p> Just click here
<address>
<b> Data structure </b>
<b> GUI </b>
<b> HTML </b>
<b> C++ </b>
<b> VB </b>
</address>
<body>
</h
OUTPUT:
HSC SYLLABUS
(Text size h1, regular font)
PAPER I (Text size h3, regular font)
To know more about (Text size regular)
Just click here
Data structure (Text size regular, bold font)
GUI
HTML
C++
VB
<html>
<body>
<h1> <b> Languages </h1>
<ol>
<li> English </li>
<li> Second language </li>
</ol>
<ul>
<li> Marathi </li>
<ul>
<li> Hindi </li>
<ul>
<li> French </li>
</ul>
<li> Sanskrit </li>
</ul>
</body>
</html>
OUTPUT:
Languages
1 English
2 Second language
• Marathi
o Hindi
§ French
o Sanskrit
1 b 7 b
2 c 8 c
3 d 9 c
4 b 10 d
5 d 11 b
6 c 12 b