Professional Documents
Culture Documents
Screenshot 2024-03-09 at 8.28.06 PM
Screenshot 2024-03-09 at 8.28.06 PM
Screenshot 2024-03-09 at 8.28.06 PM
S 1
Ans.->
Services:
2) Process Management : O.S. has to keep track of all running programs called as process. O.s
has to schedule all processes and will have to dispatch them.
Ans->
2) 32 bit O.S
4) Portable O.S.
6)Free software
File Manager :
4) Application can be started directly from the file manager by clicking on an application
icon.
Control Panel :
Ans- >The interfaces which replaces cryptic commands by their graphical representation are called
as ‘ Graphical User Interface’.
Advantages/ features :
1) Easy to use
2) User can communicate and exchange data between programs without transferring or copying
files.
Ans->
1. Menu bar
2. Scroll bar
3. Dialogue boxes
Q7) What is file system? Explain difference between Taped based n File based System?
Ans-> The collection of inter related information called as file. There are two types of file system.
1) Simple inefficient
2) Files are stored on reels of physical tapes files are stored on track and sectors
time consuming
Ans->
Create a file – First whether to check sufficient memory is available or not .If available then
create a file.
Write to a file- Search for a particular file. If available then only open n write.
Reading a file- Search for a particular file if available then only open for reading
Delete a file-Search for a particular file if found then delete n release memory space
Rewind a file- Search for a particular file if found then file is reset to beginning of file.
Q9) What is VDU? Explain the following terms: Dumb Terminal and Intelligent Terminal
Ans-> O.s has to keep track of all processes and will have to dispatch them one after the
another.This is known as process scheduling.
1) Fairness
2) Good throughput
3) CPU utilization
5) Waiting time
6) Response time.
Ans->The concept of arranging ready processes in a queue so that they can dispatched one after the
another on some policy or criteria a known as priority.
External Priority : 1) It is specified by the user externally generally at the time of initiating the
process.
3) If the user does not specify any external priority at all, the o.s work with default priority.
4) but when an urgent job needs to be done, the system admin permits the process to be created
with a higher priority.
Internal priority : 1) The o.s can set their own internal priority which is highest for shortest job.
4)because of this, the number of processes competing for cpu will be decreased. and number of
satisfied users will increase.
Purchase priority: 1) It used in some data centre. Where each user pays for the time used.
2) Higher priority processes are changed at a higher rate to prevent each user from firing his job at
the highest priority.
Q12)What is Process? Explain states of Process ?
Ans ->Process is a program under execution , which competes for the CPU time .
Process States :
2) Ready : A process which is not waiting for any external event such as an I/O operation and
which is not running is said to be in ready state.
3) Blocked : When process is waiting for an external event such as an I/O operation the process
is said to be in blocked state.
Q14) State functions of MM also write any four memory management system?
Ans-> functions:
MM systems :
Single
Fixed partition
Variable partition
Paging
Segmentation
Combined
Non-Contiguous ,virtual MM system
Virtual Memory
Ans ->1) Partitions suffer from External fragmentation caz of available memory is not contiguous.
3)Physical memory divided into fixed size blocks called Page Frames.
5) Now, When a program is to be executed its pages are loaded into any available frames and
according to that Page map table defined.
7) every address generated by CPU is divided into 2 parts : Page number and Page offset.
Ans-> 1) Segments are logical division of programs and hence are normally of variable size.
3) Each program is executed form can be considered to be consisting of different segments such as
code, data and stack.
6) if various segments in his programs does not define explicitly, then the does it by its own.
7)the segment table has a separate entry for each segment, giving beginning address of segment in
physical memory and length of that segment.
Trap door : Software developer leave some entry point to modify the programs.
Browsing : One can browse through system file to get t info, after which ,unprotected files
could b easily accessed.
Invalid parameters: passing invalid parameters may cause a serious security problem
Line trapping :A special terminal is used to tap into a communication line.
Electrical Data Capture : Use of active wire taps to pick up the screen radiation.
Waste recovery : By using some technique, deleted files can be recovered. Password may be
recollected.
Defination
Q 20) What are the different methods by which virus can infect other program?
Ans->
2) Replace- The viral code replaces the original executable program completely.
5) Redirect – Normal control low of program is changed to execute some other code.
Ans->
Virus Detection-
But if virus has already damaged data, then recovery of data is not possible.
Virus prevention-
User can not recover data after viral affection so the best way to prevent viruses.
Selection Logic: Here we uses number of conditions which, cause selection of one out of
several alternatives.
There are three types of selection control structure.
a) Single alternative : here we will check the condition , if condition is true execute module
A ,otherwise skip that part and go ahead
b)Double Alternative: here we will check the condition , if condition is true execute module
A otherwise execute module B.
c)Multiple Alternative :it allows only one module to be executed. The module following the
condition ,which is satisfied the condition will be executed . if no condition is satisfied then
the module which follows last else statement will be executed.
Iteration Logic: Here certain module is executed repeatedly until condition satisfies.
i.e. whenever we want to perform same action/ logic repeatedly.it uses either repeat for,while
or do while.
6)Memory Representation: To represent the Linked List in Memory we uses two arrays
INFO and LINK. INFO[K] contains information of every element. LINK[K] contain
address Of next node.
And Pointer field of last node denoted by NULL.
Student
1.Name
2. First name
2. Middle name
2. Last name
1.Age
1.Address
2. village
2. city
2. state
It may contain homogeneous or non homogeneous data.
4)Elements of records are referenced by level numbers.
5) Memory representation : The records are stored in memory using parallel linear arrays of an
elementary items.
for eg. If we want to access Kth record , First name[K],Middle name[K],……. Belong to the same
record in a file
Q8) Show the representation of records in memory considering suitableexample of three records
and three fields.
G1 G2 G3
Ram Priyanka Sonu
Pratik Ravi Prajakta
Shweta Vaibhav Bhavika
Vaishali
In these groups are to be represented in memory, the most efficient way is to use 2 arrays . The first
one is student array which contain list of all students stored in sequentially and Second array is
Group array , which is a pointer array which contains starting address of each group in the student
array resp.
1 Ram
2 Pratik
3 Shweta 1
4 Vaishali 5
5 Priyanka
6 Ravi
7 Vaibhav
8
8 Sonu
9 Prajakta
10 Bhavika
Each element of Group is a pointer , which holds the starting addresses of different groups.
Q12) Difference between STACK and QUEUE Ans:
Ans : 1) Definition : It is a non linear hierarchical data structure with finite set of elements called as
nodes.
2) It may be empty or partitioned into thee disjoint subsets:
There is a single node without parent called as root. And other two are themselves binary tree
called as left subtree or right subtree. A left and right subtree may be empty.BUT there is no
node with degree greater than two.
3) Terminology :
Q16) What is binary tree? With suitable example show the relationship between total numbers of
nodes and depth of a tree
Ans :
Defination for binary tree
Depth of a binary tree means maximum level of any node in a tree .
Maximum number of nodes in a binary tree : Formula : 2n-1
example :
Extented binary tree or 2-tree :A binary tree T is said to be a 2-tree if every node N has either 0
or 2 children. The node with 2 children are called internal node and the nodes with 0 children are
called External nodes.
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 every node value in the left subtree of N and is less than or equal to every node
value in the right subtree of N
Sequential Representation :
For this only one linear array is used. This array is generally known as TREE.
The ROOT ‘R’ of the tree is stored in TREE[0]
if a node N of a tree stored in TREE[k]then,
0 A
1 B
2 C
3 D
4 E
5 F
6 G
7 H
8 I
9 -
Q) Draw Binary Tree for following expressions.
1)
2)
3)
ALGORITHMS
1) TRAVERSING
Traversing means accessing each records at only once.
Traverse( LA,N,LB,UB)
Where,
LA-> Linear array
N-> total no.of elements
LB-> Lower bound
UB-> upper bound
Step 1: start
Step 2: Repeat for i=LB to UB Apply process on LA[i]
(end of loop)
Step 3: stop
2) INSERTING
Inserting means insert new record/element in existing array
Insert(LA,N,K,ITEM)
Where,
LA-> Linear array
N-> total no. of elements K-> Position of new item
ITEM-> new item to be added
Step 1: start
Step 2: j:=N
Step 3: Repeat step 4 and 5 while j>=k
Step 4: LA[j+1]:=LA[j]
Step 5: j:=j-1
(end of loop)
Step 6: LA[k]:=ITEM
Step 7: Reset N:=N+1
Step 8: stop
3) DELETING
Delete/remove any element from existing array
Delete(LA,N,K,ITEM)
Where,
LA-> Linear array
N-> total no. of elements
K-> Position of item
ITEM-> item to be deleted
Step 1: start
Step 2: ITEM:=LA[k]
Step 3: Repeat step 4 for i=k to N-1
Step 4:LA[j] :=LA[j+1]
(end of loop)
Step 5: Reset N:=N-1
Step 6: stop
4) SORTING
Sorting means arranging elements in ascending/descending order
Bubble Sort(LA,N)
Where,
LA-> Linear array
N-> total no.of elements
Step 1: Start
Step 2: Repeat step 3 and 4 for k=1 to N-1
Step 3: Set ptr :=1
Step 4: Repeat while ptr<=N-k
If LA[ptr]>=LA[ptr + 1]
Then interchange LA[ptr] and LA[ptr + 1]
Set ptr:= ptr + 1
(end of inner loop )
( end of outer loop)
Step 5 : Stop
Example 1 :
Example 2:
5)Linear Search
Searching means to find out a particular element from a given list of elements.
Linear Search means the given (finding ) element is compared with each element of list one by one.
Linear Search(LA,N,ITEM,K)
Where,
LA-> Linear array
N-> total no. of elements
ITEM -> element to be search
K->position of the item
Step 1: start
Step 2: set LA[N+1 ] :=ITEM
Step 3: K:=1
Step 4 : Repeat while LA[K] ≠ ITEM
Set K :=K +1
(end of loop )
Step 5 : if K = N+1
K: = NULL ( Search unsuccessful)
Step 6 : Stop
Example 1 :
6)Binary Search
Searching means to find out a particular element from a given list of elements.
Binary search means the given element is search from sorted array.
Binary(LA,LB,UB,ITEM,LOC)
Where,
LA-> Linear Array
LB-> Lower Bound
UB-> Upper Bound
ITEM-> element to be search
LOC-> Location of data
Step 1: start
Step 2: set BEG:=LB, END:=UB, MID:=INT(BEG+END)/2
Step 3: repeat step 4 and 5 while BEG<=END and LA[MID]≠ITEM
Step 4: if ITEM<LA[MID]
END:=MID-1
Else
BEG:=MID+1
( end of if )
Step 5: set MID :=INT (BEG+END)/2
Step 6: if LA[MID]=ITEM then
Set LOC:=MID
Else
LOC:=NULL
Step 7: stop
Example 1:
Example 2 :
Q ) difference between Linear Search and binary search
Ans :
Subject : c.s- 1
Introduction to c++
Q1) differentiate between procedure oriented and object oriented programming
Ans :
POP OOP
1 Top down approach Bottom up approach
2 Data hiding not possible Data hiding possible
3 Emphasis on things Emphasis on data
4 Data move openly from Data can not be accessed by external
function to function function
5 The problem is viewed as a The problem is decomposed into a
sequence of things to be done number of entities
6 Large program are divided into Large programs are divided into
smaller program known as smaller entities called as objects.
function
1)user defined data types: a) user will create new abstract data type , which can
behave like any built in datatype
b) eg. Structure, class etc.
2) built in datatype: a) also called as “basic” or “ primary” datatype
b) already specified by c++ s/w
5)visibility labels :
private : only accessed by the functions of same class
public: accessed by all
protected: accessed by same class and its next derived class
6 ) default visibility label/ access specifier is private
7) every class terminated with close curly brace with semicolon.
8) eg.
class A
{
int p;
public:
void add();
};
Q)How to declare member functions of class ?
Ans :
1) there are two ways to declare a member function of a class inside and outside
2) Inside member function declaration :
When a function is defined inside a class , it is treated as inline function.
Only used for small functions
Eg . class A
{
int x;
public:
void put()
{
cout<<”hello”;
}
};
3) Outside member function declaration:
the member function can be defined outside the class using :: operator
this tells the compiler the class which the function belongs and restricts the
scope of that function.
Eg. class A
{
int x;
public:
void put();
};
void A :: put()
{
cout <<”hello”;
}
Q) what is object ?
Ans :
1) Definition: it is variable whose data type is class
OR
It is a basic runtime entity in OOPS
2) Objects created in void main ()
3) Syntax :
void main()
{
A x; //object creation
x. add(); //functions access using object
}
4) User have more than one object for a class. But reverse is not true.
5) The private data of a class can b accessed only through the member functions of
that class.
6) To use a member function , the dot operator connects the object name and the
member function.
7) The dot operator called as class member access operator.
1) Same name as class name preceded with the sign tilde (~)
2) No return type even void also
3) It takes no arguments
4) Always declared in public section of class.
class ratio
{
public:
ratio()
{
cout<<”constructor”;
}
void ratiox()
{
cout<<” member function”;
}
~ratio()
{
cout<<” object dies”;
}
};
void main()
{
ratio r; // object created…..constructor called
r.ratiox();
} // end of program…….destructor invoked.
3) It is visible only within the class , but its lifetime is the entire program.
4) Static data members are only accessible by static functions only.
2) Multilevel Inheritance
5) Hybrid inheritance
1) When hybrid inheritance is used , there are atleast 3 levels as shown in figure.
2) From above figure, class b and C is derived from class A and class D is derived
from class B and class C
3) i.e property of class A can be inherited to
A-> B -> D
A-> C-> D
4) this means class D may contain duplicate sets of members of class A. this
produces ambiguity( confusion)
5) to avoid this ambiguity , concept of virtual base class is used.
6) class A
{
……
};
class B:public virtual A
{
……
};
Class C: virtual public A
{
……
};
Class D : public B, public C
{
…..
};
7) When a class is made a virtual base class, C++ takes necessary care to see that
only one copy of that class is inherited
8) The keyword virtual and public may be used in either order.
Runtime Polymorphism :
1) In some situation , it is nice to select appropriate member function to be invoked
while the program is running.
2) When base class and derived class both classes having same function with same
signature then to avoid the confusion will use the concept of virtual function.
3) At runtime, it is known what class objects under consideration , the appropriate
version of function is called.
4) It is also called as dynamic binding or late binding because selection of function
is done at dynamically or much after the compilation.
#
#
class A
{
public:
virtual void show()
{
cout<<”tom”;
}
};
class B:public A
{
public:
void show()
{
cout<<”\n bob”;
}
};
void main()
{
A x,*p;
B y;
p=&x;
p->show();
p=&y;
p->show();
}
Output
Tom
bob
Q)what are the classes in c++ for file stream operation ? how do you open and close
file in c++? Explain file handling modes ?
Ans:
1) c++ contains set of classes which r used in file handling ifstream,
ofstream , fstream
2) ifstream : used for input purpose
ofstream : used for output purpose
fstream : used for both input and output
3 ) these 3 classes are derived from fstreambase class
4 ) to perform any file handling operation we need to include <fstream.h> header
file
Opening a file
1) Syntax : file handling class object;
Object.open(file name);
OR
file handling class object;
Object.open(file name, mode);
2) filestream class can be anything ifstream, ofstream, fstream. Need to create the
object for class.
3) Eg. 1) ifstream fin;
fin.open(“ country.txt”);
2 ) ofstream fout;
fout.open( “ capital.txt”, ios::in);
closing a file :
1) To close a file we don’t need to pass the file name , file which is opened for read ,
write that is used to be close
2) Syntax : object. close();
3) Eg. fin.close(); // closes country.txt file
fout.close(); // closes capital.txt file
file handling modes :
2)seekp()
It is used to move the output file pointer forwards with given number of bytes.
Syntax: seekp(int);
Eg. ifstream fin(“abc.txt”);
fin.seekp(10);
seekp() moves file output pointer 10 bytes forward.
3) tellg()
It is used to return current file pointer position . this function is associated with input
file stream .
Syntax : tellg()
Eg. ifstream fin;
fin.open(“abc.txt”);
int n=fin.tellg();
4)tellp()
It is used to return current file pointer position . this function is associated with output
file stream .
Syntax : tellg()
Eg. ofstream fin;
fin.open(“abc.txt”);
int n=fin.tellp();
4) get()
this function is used to read a character into file.it is related to ifstream object.
Syntax : ifstream f (“abc.txt”);
char c;
while(fin)
{
fin.getc(c);
cout<<c;
}
5 )put()
this function is used to store a character from file.it is related to ofstream object.
Syntax : ofstream f (“abc.txt”);
char c;
while(fin)
{
fin.getc(c);
cout<<c;
}
7)read()
This function is used to read data in binary mode from file.this function is
associated with ifstream object.
8)write()
This function is used to rwrite data in binary mode to file.this function is
associated with ofstream object.
Subject : c.s -1
HTML
Q1 ) what is html?
Ans : HTML stands for Hypertext Markup Language.it is used to create web pages.it is
most simple, text oriented programming languages.
Hypertext : original text+ extra features
Markup: process of taking ordinary text and adding extra symbols.
</body>
</html>
a) <HTML>
1)always start with <HTML> and ends with </HTML>
2)all other tags must enclosed within <html > and </HTML>
3)when document start with <HTML> , must told that to browser that
the file is HTML file.
4) it is a start of any web document.
b)<HEAD>
1)stats with<HEAD> and ends with </HEAD>
2)header area of web page
3)it is not displayed within the web page
4)<TITLE > tag always enclosed with <HEAD > tag
c)<TITLE>
1)starts with <TITLE> and ends with </TITLE>
2)it is used to give appropriate title for web page.
3)there should not be extra space between <TITLE > tag and actual title of
web page
4) <TITLE > tag always enclosed with <HEAD > tag
d) <BODY>
1)starts with <Body> and ends with </body>
2)other than basic tags all other tags must enclosed within
<BODY> tag
3)the actual contents of web page that will be displayed on browser
Will always put it into body section
4) it has number of attributes like bgcolor,font etc.
1) <BR>
a) Break line
b) It tells the browser to put the text that follows onto next line
c) For multiple blank lines, that much <BR> tags we have to include
d) Eg. A<Br>B<br>c
Output:
A
B
C
2) <HR>
a)horizontal ruler
b)to divide the web page into different sections
c)mostly used for decorative purpose
d)attribute : size -> thickness of line and width-> how much percentage of line
display
e)eg. <HR size=”2” width= “50%”>
output:
______
3) <IMG>
a) Image tag
b) Used to display image on web page
c) Image of two types inline and floating image
d) Inline image, we can put either top,middle or bottom of a line
e) Floating image can wrap text either on left and or right and side of image.
f) Attributes: SRC->image file path searching
ALT->used to displayed text instead of image
g) Eg. <IMG src=”sunset.jpg” alt=”HELLO”>
*NOTE : above 3 tags are standalone tags. Those are not having any
closing tags *
4) <P>
a) paragraph tag
b)used to create a paragraph
c)browser ignores the paragraph created by user by making pressing enter key
d)attributes: align with values left,right,center,justify
e) eg.
Hie,I m a tom. How r u?
Output :
Hie, I m a tom.
How r u?
5) <PRE>
a)preformat the text
b)the text appearing between start tag <PRE> and end tag </pre> is displayed in
mono space form.
c)this tag is used to position the characters.
d)this tag displays the text in exactly same format as the character and line
spacing format defined in HTML code.
e)eg. <PRE>
1
2 2
3 3 3
</pre>
OUTPUT:
1
2 2
3 3 3
6 )Physical/formatting tags :
<B>
Bold tag.
Text appearing between start tag <B> and </B>will be displayed in
bold .
Eg. <b>pqr</b>
Output:
Pqr
<I>
italic tag.
Text appearing between start tag <I> and </I>will be displayed in
italic.
Eg. <i>pqr</i>
Output:
Pqr
<u>
underline tag.
Text appearing between start tag <u> and </u>will be displayed in
underlined.
Eg. <u>pqr</u>
Output:
Pqr
8) <marquee>
a) Used to scroll the text or image from right to left.
b) The text written between start tag <marquee> and </marquee> will
scroll horizontally by default.
c) Attributes: bgcolor,height
d) Eg :
<marquee> pqr </marquee>
Output:
<- <- <- pqr
9) <strike>
a)strike tag
b)the text enclosed within <strike > and </strike> would have line drawn
through the center/middle of the text.
c)eg. <strike> pqr </strike>
output :
pqr
12) <font>
a) Font tag
b) Used to change the size, colour, type(face) of the text.
c) Attributes: SIZE -.> 1 to 7 and by putting plus and minus sign before
the number will change the font size relative to the default size.
Color -> direct colour name or RGB colour format
RED : #ff0000
GREEN: #00FF00
BLUE : #0000FF
BLACK : #000000
WHITE : #FFFFFF
Face : style of the text eg.arial, times new roman
d)eg. <FONT face= “arial “ color=”red” size=7> computer
science</font>
output :
computer science
13) <BIG>
a) Big tag
b) The text enclosed within <BIG> and </BIG> is displayed in
larger font
c) It has same effect asc<font size=”+1” >
d) If already the size is largest , then tag is ignored.
e) Eg. Pqr<big>Pqr</big>
Output :
PqrPqr
14) <SMALL>
f) Small tag
g) The text enclosed within <small> and </small> is displayed in
smaller font
h) It has same effect asc<font size=”-1” >
i) If already the size is smallest , then tag is ignored.
j) Eg. Pqr<small>Pqr</small>
Output :
PqrPqr
15) <OL>
a)order list . numbered in fashion
b)it includes : numbers(1 to 9 and combinations)
small letter alphabets (a to z)
uppercase letter alphabet( A to Z)
roman lower number ( i to x)
roman higher number (I to X)
c ) default appearance for list is numbers.
d)attributes : type, face
e)<LI> tag is used to indicate actual list element
16) <UL>
a) Unordered list. Bulleted list.
b) It includes: closed circle/disc ( ● )
Open circle (○ )
Square(■ )
c)default appearance is disc
d)attributes: type
e) the end tag </UL> is always required at the end of
unordered list.
f)<LI> tag is used to indicate actual list element.
17) <LI>
a) List item
b) Used with OL and UL tag.
18) < A>
a) anchor tag
b)it is used to create links and hyperlink.
c)this link is clickable graphical link.
d)the text or image enclosed between <a> tag is a link.
e)attribute : HREF (hypertext reference )
f) eg. <A href=” www.google.com”>home</A>
output:
home
20) <TR>
a)table row
b)it creates horizontal row .
c)each use of <TR> begins a new row.
d)a row must contain atleast one table data.
e) attributes : ALIGN,BGCOLOR
21) <TH>
a) Table heading
b) Used to represent individual column .
c) By default text in this bold and center
d) Attribute: colspan, rowspan, align
22) <TD>
a)table data.
b)it creates individual column
c)number of TD tag in a single <TR> tag determines the number of
columns.
d)by default text in this normal and left
e) attributes: colspan, rowspan, align
PROGRAMS:
1)
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ol start="50">
<li>eggs</li>
<li>fish</li>
<li>meat</li>
</ol>
OUTPUT :
1.Coffie
2.Tea
3.Milk
50.eggs
51.fish
52.meat
2)
<ul>
<li>Chocolate Cake</li>
<li>Black Forest Cake</li>
<li>Pineapple Cake</li>
</ul>
OUTPUT:
Chocolate Cake
Black Forest Cake
Pineapple Cake
3)
<html>
<body>
</body>
</html>
OUTPUT :
4) <html>
<body>
<h1><b>subjects</b></h1>
<ol>
<li>english (compulsory)
<li>second language....
<ul type=”circle”>
<li > physics</li>
<ul type="disc">
<li>chemistry</li>
<ul type="square">
<li>maths</li>
<li>biology</li>
</ul>
</ul>
</ul>
</ol>
</body>
</html>
Output:
5)
<html>
<body>
<ol>
<li>Fruit
<ul type=circle>
<li>Apples</li>
<li>Oranges</li>
<li>Pears</li>
</ul>
</li>
<li>Vegetables
<ul type =circle>
<li>Broccoli</li>
<li>Peas</li>
<li>Corn</li>
</ul>
</li>
</ol>
PROGRAMS on TABLE tags:
1)
<html>
<head>
<title> simple program</title>
</head>
<body>
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
</body>
</html>
OUTPUT
2)
<html>
<head>
<title>HTML Table Cellpadding</title>
</head>
<body>
<table border = "1" cellpadding = "5" cellspacing = "5">
<tr>
<th>Name</th>
<th>Salary</th>
</tr>
<tr>
<td>Ramesh Raman</td>
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
</body>
</html>
This will produce the following result –
3)
<HTML>
<HEAD>
<TITLE>EXAMPLE OF COLSPAN AND ROWSPAN</TITLE>
</HEAD>
<BODY>
<CAPTION>RESULT</CAPTION>
<TABLE BORDER="1" CELLSPACING="10">
<TR>
<TH ROWSPAN="2">COMPUTER SCIENCE</TH>
<TH>PAPER-I</TH>
<TH>PAPER-II</TH>
</TR>
<TR>
<TD>50</TD>
<TD>45</TD>
</TR>
</TABLE>
</BODY>
</HTML>
OUTPUT:
4)
year
2000 2001 2002
Units 500 1000 1500
Sales
Income Rs.1500 Rs.10000 Rs.15000
5)
STREAM
CRICKET ANALYSIS
INDIA 30 24 07
AUS 24 19 05
PAK 18 02 16
ZIM 10 07 03
7)
Thank you
<html>
<body>
<table border=”1”>
<tr>
<td rowspan=2 align=”center”>sales</td>
<td>Pen</td>
<td>Pencil</td>
<td>Easer</td>
<td>scale</td>
</tr>
<tr>
<td>25</td>
<td>34</td>
<td>33</td>
<td>10</td>
</tr>
<tr>
<th colspan=”5”> Thank you </th>
</tr>
</table>
</body>
</html>
C++ Programs:
Programs of string
Q)Enter a string and count number of words in a string :
#include <iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char a[100];
int n,l,i;
n=0;
cout<<“Enter a string”;
cin.getline(a,100 );
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]==“ “)
n++;
}
cout<<“total no. of words” << n+1;
getch();
clrscr();
}
Q)
Enter a string and count occurance of ‘j’ in a string :
#include <iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char a[100];
int n,l,i;
n=0;
cout<<“Enter a string”;
cin.getline(a,100 );
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]==“ j “)
n++;
}
cout<<“total no. of j in string” << n;
getch();
clrscr();
}
Q)
Enter a string and replace every space with hyphen (-)
#include <iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char a[100];
int l,i;
cout<<“Enter a string”;
cin.getline(a,100 );
l=strlen(a);
for(i=0;i<l;i++)
{
if(a[i]==“ “)
a[i]=‘-’;
}
cout<<“string with hyphen\n”<<a;
getch();
clrscr();
}
Q) Enter a string and print reverse of a string
#include <iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char a[100];
int l,i;
cout<<“Enter a string”;
cin.getline(a,100 );
l=strlen(a);
for(i=l-1;i>=0;i--)
{
cout<< a[i];
}
getch();
clrscr();
}
Programs on Array
Q) write a program to enter 10 numbers in an array and calculate sum and average
#include <iostream.h>
#include<conio.h>
void main( )
{
int a[10];
int i , sum=0;
float avg=0.0;
cout<<“Enter 10 numbers”;
for(i=0 ; i<=9 ;i++ )
{
cin>>a[i];
}
for(i=0 ; i<=9 ;i++ )
{
sum=sum+a[i];
}
cout <<”Sum is”<< sum;
cout<<”Average is “<<avg;
getch();
clrscr();
}
Q ) write a program in oops to implement class circle and calculate area of a circle
Q ) write a program in oops to implement class rectangle and calculate area and
perimeter of a rectangle
}
void main()
{
rectangle x;
x. calculate();
getch();
clrscr();
}
Q) write a program in oops to calculate the distance from origin to point p(x,y)
#include< iostream .h>
#include <conio. h>
#include <math.h>
class point
{
int x,y;
float d;
public:
void calculate();
};
void point :: calculate()
{
cout<< “ enter x and y coordinate “;
cin >>x>>y;
d=sqrt((x*x)+(y*y));
cout <<” Distance from origin is”<<d;
}
void main()
{
point x;
x. calculate();
getch();
clrscr();
}
float c,f;
public:
void calculate();
};
void temperature :: calculate()
{
cout<< “ enter temp in c “;
cin >>c;
f=1.8*c+32;
cout <<” temp in fah is ”<<f;
}
void main()
{
temperature t;
t. calculate();
getch();
clrscr();
}
#include <iostream.h>
#include <conio.h>
class factoial
{
int i , f, n;
public:
void fact();
};
void factorial :: fact()
{
cout<< “ enter a number :”;
cin >> n;
for (i=1 ;i <= n; i++)
{
f =f * i ;
}
cout<< “ factorial of a number is “<< f;
}
void main()
{
factorial x;
x.fact();
getch();
clrscr();
}
void main()
{
GCD g;
g.calculate();
getch();
clrscr();
}