2nd Puc Lab Manual Dudda PDF
2nd Puc Lab Manual Dudda PDF
2nd Puc Lab Manual Dudda PDF
PRACTICAL RECORD
BOOK
OF
SECOND PUC
Laboratory
Certificate
Date: …………………..
12 Also create a member function to read and display the data using the concept of 22
pointers to objects.
1. Add records into the table for 10 students for Student ID, Student Name and
marks in 6 subjects using INSERT command.
02 2. Display the description of the fields in the table using DESC command. 35
3. Alter the table and calculate TOTAL and PERC_MARKS.
4. Compute the RESULT as “PASS” or “FAIL” by checking if the student has
scored more than 35 marks in each subject.
5. List the contents of the table.
6. Retrieve all the records of the table.
7. Retrieve only ID_NO and S_NAME of all the students.
8. List the students who have result as “PASS”.
9. List the students who have result as “FAIL”.
10. Count the number of students who have passed.
11. Count the number of students who have failed.
12. List the students who have percentage greater than 60.
13. Sort the table according to the order of ID_NO.
Generate the Employee details and compute the salary based on the department.
Create the following table EMPLOYEE
Field Name Type
EMP_ID NUMBER(4)
DEPT_ID NUMBER(2)
EMP_NAME VARCHAR2(15)
EMP_SALARY NUMBER(5)
Assume the DEPARTMENT names as Purchase (Id-01), Accounts (Id-02), Sales (Id-
03 03), and Apprentice (Id-04) 39
Enter 10 rows of data for table EMPLOYEE and 4 rows of data for DEPARTMENT
table.
Write the SQL statements for the following:
1. Find the names of all employees who work for the Accounts department.
2. How many employees work for Accounts department?
3. What are the Minimum, Maximum and Average salary of employees working for
Accounts department?
4. List the employees working for particular supervisor.
5. Retrieve the department names for each department where only one employee
works.
6. Increase the salary of all employees in the sales department by 15%.
7. Add a new Colum to the table EMPLOYEE called BONUS NUMBER (5) and
compute 5% of the salary to the said field.
8. Delete all the rows for the employee in the Apprentice department.
SECTION- C HTML
PROGRAM 1:
OUTPUT 1:
OUTPUT 2:
PROGRAM 2:
void Insertion::readdata( )
{
cout<<"Enter the size of the array"<<endl;
cin>>n;
cout<<"Enter the elements for the array"<<endl;
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the position of the element in the array"<<endl;
cin>>pos;
cout<<"Enter the element to be inserted"<<endl;
cin>>ele;
}
void Insertion::insert( )
{
if(pos>n)
{
cout<<"Out of array limits!!!";
getch( );
exit(0);
}
else
{
for(i=n; i>=pos; i--)
a[i+1] = a[i]; // Shift array elements
a[pos] = ele; // Insert the given element
n = n+1; // Size of the array is incremented by 1
void Insertion::display( )
{
cout<<"Array elements after insertion are:"<<endl;
for(i=0; i<n; i++)
cout<<a[i]<<"\t";
}
void main( )
{
Insertion i;
clrscr( );
i.readdata( );
i.insert( );
i.display( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 3:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class Deletion
{
private:
int a[10], n, pos, i;
public:
void readdata( );
void delet( );
void display( );
};
void Deletion::readdata( )
{
cout<<"Enter the size of the array"<<endl;
cin>>n;
cout<<"Enter the elements for the array:"<<endl;
for (i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the position to an delete an element:\n";
cin>>pos;
}
void Deletion::delet( )
{
if(pos>n)
{
cout<<"Out of array limits...!!!";
getch( );
exit(0);
}
else
{
for(i=pos; i<n; i++)
a[i] = a[i+1]; // Move higher position element
n = n-1; // Reduce size of the array by 1
}
}
void Deletion::display( )
{
cout<<"After deletion the array elements are"<<endl;
for(i=0; i<n; i++)
cout<<a[i]<<"\t";
}
void main( )
{
Deletion d;
clrscr();
d.readdata( );
d.delet( );
d.display( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 4:
class Sort
{
private:
int a[10], n, i;
public:
void readdata( );
void insertionsort( );
void display( );
};
void Sort::readdata( )
{
cout<<"Enter the size of the array:"<<endl;
cin>>n;
cout<<"Enter the elements for the array:"<<endl;
for(i=0; i<n; i++)
cin>>a[i];
}
void Sort::insertionsort( )
{
int j, temp;
for(i=1; i<n; i++)
{
j = i;
while(j >= 1)
{
if(a[j] < a[j-1])
{
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
j = j-1;
}
}
void Sort::display( )
{
for(i=0; i<n; i++)
cout<<a[i]<<"\t";
cout<<endl;
}
void main( )
{
Sort s;
clrscr();
s.readdata( );
cout<<"Unsorted List......"<<endl;
cout<<"*******************"<<endl;
s.display( );
s.insertionsort( );
cout<<"Sorted List........"<<endl;
cout<<"*******************"<<endl;
s.display( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 5:
class Search
{
private:
int a[10], n, ele, loc, beg, end, mid, i;
public:
void readdata( );
void bsearch( );
void display( );
};
void Search::readdata( )
{
cout<<"Enter the size of the array:"<<endl;
cin>>n;
cout<<"Enter the array elements in sorted order:"<<endl;
for(i=0;i<n;i++)
cin>>a[i];
cout<<"Enter the element to search:"<<endl;
cin>>ele;
}
void Search::bsearch( )
{
loc = -1; // Assume that element does not exist
beg = 0; // First element of the array
end = n-1; // Second element of the array
while(beg <= end)
{
mid = (beg+end)/2;
if(ele == a[mid]) // Element found at mid
{
loc = mid;
break;
}
else
if(ele < a[mid])
end = mid-1;
void Search::display( )
{
if(loc == -1)
cout<<ele<<" Element does not exist...!!!";
else
cout<<ele<<" Found at Location:"<<loc+1;
}
void main( )
{
Search s;
clrscr( );
s.readdata( );
s.bsearch( );
s.display( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 6:
Write a C++ program to create a class with data members principal, time
and rate. Create a member function to accept data values, to compute simple
interest and to display the result.
#include<iostream.h>
#include<conio.h>
class SimpleInterest
{
private:
float principal,rate,time,si; //Data Members
public:
void readdata( );
void compute( ); //Member Functions Declaration
void display( );
};
void main( )
{
SimpleInterest si;
clrscr( );
si.readdata( );
si.compute( );
si.display( );
OUTPUT 1:
OUTPUT 2:
PROGRAM 7:
#include<iostream.h>
#include<conio.h>
#include<math.h>
class Quadratic
{
private:
int a, b, c;
float disc, x, x1, x2;
public:
void readdata( );
void compute( );
void display( );
};
void Quadratic::readdata( )
{
cout<<"Enter the values for a, b, c (Co-efficeient)"<<endl;
cin>>a>>b>>c;
}
void Quadratic::compute( )
{
disc = b*b-4*a*c;
}
void Quadratic::display( )
{
compute( );
if(disc == 0)
{
cout<<"Equal Roots..."<<endl;
x=-b/(2*a);
cout<<"Root is...."<<x;
}
else if(disc>0)
{
Morarji Desai Residential Pre-University Science College, Dudda 13 | P a g e
C++ and Data Structure II PUC (PCMC’s)
cout<<"Real and Distinct Roots..."<<endl;
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
cout<<"Root 1 is "<<x1<<endl;
cout<<"Root 2 is "<<x2<<endl;
}
else
cout<<"Imaginary Roots..."<<endl;
}
void main( )
{
Quadratic q;
clrscr( );
q.readdata( );
q.display( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
OUTPUT 3:
PROGRAM 8:
Write a C++ program to find the area of square/ rectangle/ triangle using
function overloading.
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
class Funcoverload
{
public:
float area(float a) //To compute area of square
{
return a*a;
}
void main()
{
float s1,s2,s3;
int choice;
Funcoverload f;
clrscr( );
while(1)
{
cout<<"Program demonstrates Function Overloaded...!!!"<<endl;
cout<<"1.To find area of square"<<endl;
cout<<"2.To find area of rectangle"<<endl;
cout<<"3.To find the area of triangle"<<endl;
cout<<"4.Exit"<<endl;
cout<<"Enter your Choice"<<endl;
cin>>choice;
PROGRAM 9:
OUTPUT 2:
PROGRAM 10:
int Series::sumseries( )
{
for(int i=1;i<=n;i++)
sum=sum+pow(x,i);
return sum;
}
void main()
{
int x,n;
clrscr( );
cout<<"Enter the value for Base(X)="<<endl;
cin>>x;
cout<<"Enter the value for Power(n)"<<endl;
OUTPUT 2:
PROGRAM 11:
Create a base class containing the data member roll number and name.
Also create a member function to read and display the data using the concept of
single level inheritance. Create a derived class that contains marks of two
subjects and total marks as the data members.
#include<iostream.h>
#include<conio.h>
void main( )
{
Report R; // Create an object R to process Student data
clrscr( );
R.readdata( );
R.display( );
R.readmarks( );
R.compute( );
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 12:
class Student
{
private:
long regno;
char name[20];
float fees;
public:
void readdata( );
void display( );
};
void Student::readdata( )
{
cout<<"Enter the Register Number:"<<endl;
cin>>regno;
cout<<"Enter the Student Name:"<<endl;
cin>>name;
cout<<"Enter the Fees:"<<endl;
cin>>fees;
}
void Student::display( )
{
cout<<"Register Number : "<<regno<<endl;
cout<<"Student Name : "<<name<<endl;
cout<<"Fees : "<<fees<<endl;
}
void main( )
{
Student *S; // Create a pointer to point Student object
clrscr( );
S->readdata( ); // Access Student data member using a pointer
S->display( ); // Display data using a pointer
getch( );
}
OUTPUT 1:
OUTPUT 2:
PROGRAM 13:
OUTPUT:
PROGRAM 14:
int Stack::pop()
{
int item;
if(top == -1)
cout<<"Stack Empty!!!...Can't POP"<<endl;
else
{
item = s[top];
top--;
}
return item;
}
OUTPUT:
PROGRAM 15:
int Queue::dequeue()
{
int item;
if(front == -1)
{
Morarji Desai Residential Pre-University Science College, Dudda 29 | P a g e
C++ and Data Structure II PUC (PCMC’s)
cout<<"Queue is Empty....Underflow!!!"<<endl;
//getch();
//exit(1);
}
item = q[front];
if(front == rear)
{
front = -1;
rear = -1;
}
else
front++;
return item;
}
void Queue::display()
{
if(front == -1)
cout<<"Queue is Empty!!!"<<endl;
else
for(int i=front; i<=rear; i++)
cout<<q[i]<<endl;
}
void main()
{
int ele, choice;
Queue q;
clrscr( );
while(1)
{
cout<<"\nQueue Operation Menu"<<endl;
cout<<"1.Adding Element"<<endl;
cout<<"2.Deleting Element"<<endl;
cout<<"3.Display"<<endl;
cout<<"4.Exit"<<endl;
cout<<"Enter your Choice"<<endl;
cin>>choice;
switch(choice)
{
case 1: cout<<"Enter the element to be inserted"<<endl;
cin>>ele;
q.enqueue(ele);
break;
case 2: cout<<"Deleted Item = "<<q.dequeue( );
break;
Morarji Desai Residential Pre-University Science College, Dudda 30 | P a g e
C++ and Data Structure II PUC (PCMC’s)
case 3: cout<<"The Queue Contents:"<<endl;
q.display( );
break;
case 4: cout<<"End of Queue Operation"<<endl;
getch();
exit(1);
default:cout<<"Invalid Choice...!!!"<<endl;
}
getch();
}
}
OUTPUT:
STRUCTURED QUERY
LANGUAGE (SQL)
Structured query Language II PUC (PCMC’s)
PROGRAM 1:
Solution:
First we have to create the table EBILL using CREATE TABLE command.
3. Compute the bill amount for each customer as per the following rules.
a. MIN_AMT Rs. 50
b. First 100 units Rs 4.50/Unit
c. >100 units Rs. 5.50/Unit
COMMAND 1:
COMMAND 2:
PROGRAM 2:
1. Add records into the table for 10 students for Student ID, Student Name and marks in 6 subjects
using INSERT command.
2. Display the description of the fields in the table using DESC command.
3. Alter the table and calculate TOTAL and PERC_MARKS.
4. Compute the RESULT as “PASSP or “FAIL” by checking if the student has scored more than
35 marks in each subject.
5. List the contents of the table.
6. Retrieve all the records of the table.
7. Retrieve only ID_NO and S_NAME of all the students.
8. List the students who have result as “PASS”.
9. List the students who have result as “FAIL”.
10. Count the number of students who have passed.
11. Count the number of students who have failed.
12. List the students who have percentage greater than 60.
13. Sort the table according to the order of ID_NO.
Solution:
First we have to create the table CLASS using CREATE TABLE command.
1. Add records into the table for 10 students for Student ID, Student Name and marks in 6
subjects using INSERT command.
SQL> INSERT INTO CLASS VALUES (1401, 'PAWAN', 56, 36, 56, 78, 44, 67);
SQL>INSERT INTO CLASS VALUES (1411, 'RAJESH', 100,100,96,100,100,100);
2. Display the description of the fields in the table using DESC command.
4. Compute the RESULT as “PASS” or “FAIL” by checking if the student has scored more
than 35 marks in each subject.
12. List the students who have percentage greater than 60.
PROGRAM 3:
Generate the Employee details and compute the salary based on the department.
Create the following table EMPLOYEE.
Field Name Type
EMP_ID NUMBER(4)
DEPT_ID NUMBER(2)
EMP_NAME VARCHAR2(10)
EMP_SALARY NUMBER(5)
Assume the DEPARTMENT names as Purchase (Id-01), Accounts (Id-02), Sales (Id-03), and
Apprentice (Id-04)
Enter 10 rows of data for table EMPLOYEE and 4 rows of data for DEPARTMENT table.
1. Find the names of all employees who work for the Accounts department.
2. How many employees work for Accounts department?
3. What are the Minimum, Maximum and Average salary of employees working for Accounts
department?
4. List the employees working for particular supervisor.
5. Retrieve the department names for each department where only one employee works.
6. Increase the salary of all employees in the sales department by 15%.
7. Add a new Colum to the table EMPLOYEE called BONUS NUMBER (5) and compute 5% of
the salary to the said field.
8. Delete all the rows for the employee in the Apprentice department.
Solution:
To Insert 10 records into the table EMPLOYEE using INSERT INTO command.
SQL> INSERT INTO EMPLOYEE VALUES (101, 01, 'ARUN', 15000);
SQL> INSERT INTO EMPLOYEE VALUES (104, 02, 'MOHAN', 20000);
SQL> INSERT INTO EMPLOYEE VALUES (105, 03, 'SUMAN', 22000);
To insert 4 records into the table DEAPRTMENT using the INSERT INTO command.
SQL>INSERT INTO DEPARTMENT VALUES (01, 'PURCHASE', 'KRISHNA');
SQL>INSERT INTO DEPARTMENT VALUES (02, 'ACCOUNTS', 'TANVEER');
SQL>INSERT INTO DEPARTMENT VALUES (03, 'SALES', 'SURYA');
SQL>INSERT INTO DEPARTMENT VALUES (04, 'APPRENTICE', 'HARSHA');
1. Find the names of all employees who work for the Accounts department.
3. What are the Minimum, Maximum and Average salary of employees working for
Accounts department?
5. Retrieve the department names for each department where only one employee works.
7. Add a new Colum to the table EMPLOYEE called BONUS NUMBER (5) and compute
5% of the salary to the said field.
8. Delete all the rows for the employee in the Apprentice department.
ADVANCED HTML
Advanced HTML II PUC (PCMC’s)
PROGRAM 1:
<TR BGCOLOR=PEACHPUFF>
<TD ROWSPAN=2 ALIGN=CENTER> <B> DAY </B> </TD>
<TD COLSPAN=8 ALIGN=CENTER> <B> TIMINGS </B></TD>
</TR>
<TR BGCOLOR=RED>
<TH> 9.20 - 10.20 </TH>
<TH> 10.20 - 11.20 </TH>
<TH> 11.20 - 11.30 </TH>
<TH> 11.30 - 12.30 </TH>
<TH> 12.30 - 1.30 </TH>
<TH> 1.30 - 2.30 </TH>
<TH> 2.30 - 3.15 </TH>
<TH> 3.15 - 4.00 </TH>
</TR>
<TR>
<TD> MONDAY </TD>
<TD> MATHS </TD>
<TD> PHYSICS </TD>
OUTPUT:
PROGRAM 2:
<BODY>
<FORM NAME=”APPFORMPUC” METHOD=”POST” ACTION=”IPUC_SEND.PHP>
<H3 ALIGN=CENTER> FIRST PUC APPLICATION FORM </H3>
<TABLE CELLSPACING=5 CELLPADDING=5% ALIGN=CENTER>
<TR>
<TD ALIGN=LEFT>STUDENT NAME: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”STUNAME”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>FATHER NAME: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”FATNAME”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>FATHER OCCUPATION: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”FATOCC”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>DATE OF BIRTH: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”DOB”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>CONTACT NUMBER: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”CONTACT”></TD>
</TR>
<TR>
<TD ALIGN=LEFT> EMAIL ID: </TD>
<TD><INPUT TYPE=”TEXT” NAME=”EMAIL”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>UPLOAD PHOTO: </TD>
<TD><INPUT TYPE=FILE NAME=”PHOTO”></TD>
</TR>
<TR>
<TD ALIGN=LEFT>GENDER: </TD>
<TD><INPUT TYPE=RADIO NAME=GEN VALUE=”M”>MALE
<INPUT TYPE=RADIO NAME=GEN VALUE=”F”>FEMALE</TD>
</TR>
OUTPUT: