100% found this document useful (1 vote)
52 views54 pages

2nd Puc Lab Manual Dudda

The document contains a collection of programming exercises in C++, SQL, and HTML, organized into three sections. Section A focuses on C++ programs that cover array manipulation, class creation, and basic algorithms such as sorting and searching. Section B includes SQL exercises for managing customer and student databases, while Section C presents HTML tasks for creating a study timetable and forms.

Uploaded by

yogeshpista0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
52 views54 pages

2nd Puc Lab Manual Dudda

The document contains a collection of programming exercises in C++, SQL, and HTML, organized into three sections. Section A focuses on C++ programs that cover array manipulation, class creation, and basic algorithms such as sorting and searching. Section B includes SQL exercises for managing customer and student databases, while Section C presents HTML tasks for creating a study timetable and forms.

Uploaded by

yogeshpista0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

CONTENTS

Program Page
Program Name
No No
SECTION- A (C++ AND DATA STRUCTURES)

01 Write a C++ program to find the frequency presence of an element in an array. 01

02 Write a C++ program to insert an element into an array at a given position. 03

03 Write a C++ program to delete an element from an array from a given position. 05

Write a C++ program to sort the element of an array in ascending order using
04 07
insertion sort.
Write a C++ program to search for a given element in an array using binary search
05 method. 09

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
06 11
result.

Write a C++ program to create a class with data members a, b, c and member functions
to input data, compute the discriminates based on the following conditions and print the
roots.
07 13
 If discriminates = 0, print the roots are equal and their value.
 If discriminates > 0, print the real roots and their values.
 If discriminates < 0, print the roots are imaginary and exit the program.
Write a C++ program to find the area of square/ rectangle/ triangle using function
08 overloading. 15

09 Write a C++ program to find cube of a number using inline function. 17

Write a C++ program to find sum of the series 1 + x + x2 + x3 + ….xn using


10 18
constructors.
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
11 inheritance. Create a derived class that contains marks of two subjects and total marks 20
as the data members.
Create a class containing the following data members Register No, Name and Fees. Also
create a member function to read and display the data using the concept of pointers to
12 22
objects.

13 Write a C++ program to perform push items into the stack. 24

14 Write a C++ program to perform pop items into the stack. 26

15 Write a C++ program to perform Enqueue and Dequeue. 29

Program Page
Program Name
No No
SECTION – B (SQL)

Generate the electricity bill for one customer


Create a table for house hold Electricity bill with the following fields.
Field Name Type
RR_NO VARCHAR2(10)
CUS_NAME VARCHAR2(15)
BILLING_DATE DATE
UNITS NUMBER(4)
Insert 10 records into the table.
1. Check the structure of table and note your observation.
01 2. Add two fields to the table. 32
a. BILL_AMT NUMBER(6,2)
b. DUE_DATE DATE
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
4. Compute due date as BILLING_DATE + 15 Days
5. List all the bills generated.
Create a student database and compute the results.
Create a table for class of students with the following fields.
Field Name Type
ID_NO NUMBER(4)
S_NAME VARCHAR2(15)
SUB1 NUMBER(3)
SUB2 NUMBER(3)
SUB3 NUMBER(3)
SUB4 NUMBER(3)
SUB5 NUMBER(3)
SUB6 NUMBER(3)
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” “FAIL” by checking if the student has
or
scored more than 35 marks in each subject.
5.
List the contents of the table.
6.
Retrieve all the records of the table. Retrieve only
7. ID_NO and S_NAME of all the students. List the
8. students who have result as “PASS”. List the students
9. 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)
Create another table DEPARTMENT
Field Name Type
DEPT_ID NUMBER(2)
DEPT_NAME VARCHAR2(20)
SUPERVISOR VARCHAR2(20)
Assume the DEPARTMENT names as Purchase (Id-01), Accounts (Id-02), Sales (Id03),
and Apprentice (Id-04)
03 Enter 10 rows of data for table EMPLOYEE and 4 rows of data for DEPARTMENT 39
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

01 Write a HTML program to create a study time-table 43

02 Create an HTML program with table and Form. 46


C++ II PUC-Cs

PROGRAM 1:

Write a C++ program to find the frequency presence of an element in an


array.

#include<iostream.h>
#include<conio.h>
class freq
{
private:
int a[10], n, ele, counter;
public: void INPUT( );

void FINDFREQ( );
void OUTPUT( );
};

void freq::INPUT( )
{
cout<<"Enter the size of the array:"<<endl;
cin>>n;
cout<<"Enter the array elements:"<<endl;
for(int i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the element to find the frequency"<<endl;
cin>>ele;
}

void freq::FINDFREQ( )
{
counter=0;
for(int i=0; i<n; i++)
if(ele == a[i])
counter++;
}

Bapu Composite PU College 1|Page


C++ II PUC-Cs

void freq::OUTPUT( )
{

if(counter > 0)
cout<<frequency of "<<ele<<”is “<<counter;
else
cout<<ele<<"not found";
}

int main( )
{
freq f;
f.INPUT( );
f.FINDFREQ( );
f.OUTPUT( );
getch( );
return 0;
}

OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 2|Page


C++ II PUC-Cs

PROGRAM 2

Write a C++ program to insert an element into an array at a given position.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
class ins
{
private: int a[10], n, pos, ele, i;
public: void INPUT( );
void INSERT( );
void OUTPUT( );
};

void ins::INPUT( )
{
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 ins::INSERT( )
{
if(pos>n)
{
cout<<"Out of array limits!!!";
getch( );
exit(0);
}

Bapu Composite PU College 3|Page


C++ II PUC-Cs

else
{
for(i=n; i>=pos; i--)
a[i+1] = a[i];
a[pos] = ele;
n = n+1;
}
}

void ins::OUTPUT( )
{
cout<<"Array elements after insertion are:"<<endl;
for(i=0; i<n; i++)
cout<<a[i]<<" ";
}

int main( )
{
ins i;
i.INPUT( );
i.INSERT( );
i.OUTPUT( );
getch( );
return 0;
}
OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 4|Page


C++ II PUC-Cs

PROGRAM 3

Write a C++ program to delete an element from an array from a given


position.

#include<iostream.h>
#include<conio.h>
class del
{
private: int a[10], n, pos, i;
public:
void INPUT( );
void DELETE( );
void OUTPUT( );
};

void del::INPUT( )
{
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 delete an element: ";
cin>>pos;
}

void del::DELETE( )
{
if(pos>n)
{
cout<<"Out of array limits ";
getch( );
exit(0);
}

Bapu Composite PU College 5|Page


C++ II PUC-Cs

else
{
for(i=pos-1; i<n; i++)
a[i] = a[i+1];
n = n-1;
}
}

void del::OUTPUT( )
{
cout<<"After deletion the array elements are"<<endl;
for(i=0; i<n; i++)
cout<<a[i]<<" ";
}

int main( )
{
del d;
d.INPUT( );
d.DELETE( );
d.OUTPUT( );
getch( );
return 0;
}

OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 6|Page


C++ II PUC-Cs

PROGRAM 4

Write a C++ program to sort the element of an array in ascending order


using insertion sort.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>

class sort
{
private: int a[10], n, i;
public:
void INPUT( );
void INSORT( );
void OUTPUT( );
};

void sort::INPUT( )
{
cout<<"Enter the size of the array:"<<endl;
cin>>n;
cout<<"Enter the elements for the array: ";
for(i=0; i<n; i++)
cin>>a[i];
}

void sort::INSORT( )
{
int j, temp;
for(i=1; i<n; i++)
{
j = i;
while(j >= 1)
{
if(a[j] < a[j-1])
{

Bapu Composite PU College 7|Page


C++ II PUC-Cs

temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
}
j = j--;
}
}
}

void sort::OUTPUT( )
{
cout<<"Sorted List is:"<<endl;

for(i=0; i<n; i++)


cout<<a[i]<<" ";
}

int main( )
{
sort s;
s.INPUT( );
s.INSORT( );
s.OUTPUT( );
getch( );
return 0;
}

OUTPUT 1:

Bapu Composite PU College 8|Page


C++ II PUC-Cs

PROGRAM 5

Write a C++ program to search for a given element in an array using binary
search method.

#include<iostream.h>
#include<conio.h>

class bs
{
private: int a[10], n, ele, loc, beg, end, mid, i;
public:
void INPUT( );
void SEARCH( );
void OUTPUT( );
};

void bs::INPUT( )
{
cout<<"Enter the size of the array:"<<endl;
cin>>n;
cout<<"Enter the array elements in sorted order: ";
for(i=0; i<n; i++)
cin>>a[i];
cout<<"Enter the element to search: ”;
cin>>ele;
}

void bs::SEARCH( )
{
loc = -1;
beg = 0;
end = n-1;
while(beg <= end)
{
mid = (beg+end)/2;
if(ele == a[mid])
{
loc = mid+1; break;
}
Bapu Composite PU College 9|Page
C++ II PUC-Cs

else if(ele < a[mid])


end = mid-1;
else
beg = mid+1;
}
}

void bs::OUTPUT( )
{
if(loc == -1)
cout<<ele<<" Element does not exist." ;
else
cout<<ele<<" Found at Location:"<<loc;
}

int main( )
{
bs s;
s.INPUT( );
s.SEARCH( );
s.OUTPUT( );
getch( );
return 0;
}
OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 10 | P a g e


C++ II PUC-Cs

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 simple
{
private:
float p,t,r,si;
public: void INPUT( );
void COMPUTE( );
void OUTPUT( );
};

void simple::INPUT( )
{
cout<<"Enter the Principal, Rate and Time"<<endl;
cin>>p>>r>>t;
}

void simple::COMPUTE( )
{
si=(p * t * r)/100;
}

void simple::OUTPUT( )
{
cout<<"Principal = "<<p<<endl;
cout<<"Time = "<<t<<endl;
cout<<"Rate = "<<r<<endl;
cout<<"Simple Interest = "<<si<<endl;
}

Bapu Composite PU College 11 | P a g e


C++ II PUC-Cs

int main( )
{
simple s;
s.INPUT( );
s.COMPUTE( );
s.OUTPUT( );
getch( );
return 0;
}

OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 12 | P a g e


C++ II PUC-Cs

PROGRAM 7

Write a C++ program to create a class with data members a, b, c and


member functions to input data, compute the discriminant based on the following
conditions and print the roots.

 If discriminant = 0, print the roots are equal and their value.


 If discriminant > 0, print the real roots and their values.
 If discriminant < 0, print the roots are imaginary and exit the program.

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<process.h>
class quad
{
private: int a, b, c;
float d, r1, r1;
public:
void INPUT( );
void COMPUTE( );
void OUTPUT( );
};

void quad::INPUT( )
{
cout<<"Enter the values for a, b, c"<<endl;
cin>>a>>b>>c;
}

void quad::COMPUTE( )
{
d = b*b-4*a*c;
if(d= =0)
{
cout<<”Roots are equal”<<endl;
r1= b/(2*a);
r2= b/(2*a);
}
else if(d>0)
{

Bapu Composite PU College 13 | P a g e


C++ II PUC-Cs

cout<<”Roots are real and different”<<endl;


r1=(-b+sqrt(d))/(2*a);
r2= (-b-sqrt(disc))/(2*a);
}

else
{
cout<<"Imaginary Roots..."<<endl;
exit(0);
}
}
void quad::display( )
{
cout<<"Root1="<<r1<<endl;
cout<<"Root1="<<r2<<endl;
}
int main( )
{
quad q;
q.INPUT( );
q.COMPUTE( );
q.OUTPUT( );
getch( );
return 0;
}
OUTPUT 1:

OUTPUT 2:

OUTPUT 3:

Bapu Composite PU College 14 | P a g e


C++ II PUC-Cs

PROGRAM 8

Find the area of square/ rectangle/ triangle using function overloading.


#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
class fo
{
public:
float area(float a)
{
return a*a;
}

float area(float l, float b)


{
return l*b;
}

float area(float s1,float s2,float s3)


{
float s=(s1+s2+s3)/2;
return sqrt(s*(s-s1)*(s-s2)*(s-s3));
}
};

int main()
{
float s1,s2,s3;
int choice;
fo f;
while(1)
{
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;
switch(choice)
{
case 1: cout<<"Enter the input for square"<<endl;
cin>>s1;
cout<<"Area of Square= "<<f.area(s1)<<endl;
break;

Bapu Composite PU College 15 | P a g e


C++ II PUC-Cs

case 2: cout<<"Enter the input for rectangle"<<endl;


cin>>s1>>s2;
cout<<"Area of Rectangle= "<<f.area(s1,s2)<<endl;
break;

case 3: cout<<"Enter the input for triangle"<<endl; cin>>s1>>s2>>s3;


cout<<"Area of Triangle= "<<f.area(s1,s2,s3)<<endl;
break;

case 4: cout<<"End of Program....."<<endl;


getch();
exit(1);

default: cout<<"Invallid Choice....!!!"<<endl;


}

}
getch();
return 0;
}

OUTPUT:

Bapu Composite PU College 16 | P a g e


C++ II PUC-Cs

PROGRAM 9

Find cube of a number using inline function.

#include<iostream.h>
#include<conio.h>
inline int CUBE(int a)
{
return a*a*a;
}

int main()
{
int n;
cout<<"Enter the input number"<<endl;
cin>>n;
cout<<"Cube of "<<n<<" = "<<CUBE(n);
getch( );
return 0;
}
OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 17 | P a g e


C++ II PUC-Cs

PROGRAM 10

Write a C++ program to find sum of the series 1 + x + x2 + x3 + ….xn using


constructors.

#include<iostream.h>
#include<conio.h>
#include<math.h>
class series
{
private:
int sum, x, n;
public:
series(int y, int m)
{
sum = 1;
x = y;
n = m;
}
int SS( );
};

int series::SS( )
{
for(int i=1; i<=n; i++)
sum=sum+pow(x ,i);
return sum;
}

int main()
{
int x , n;
cout<<"Enter the value for Base(X)="<<endl;
cin>>x;
cout<<"Enter the value for Power(n)"<<endl;
cin>>n;

series s1(x , n);


series s2 = s1;
cout<<"Sum of Series using Parameterised Constructor:"; cout<<s1.SS()<<endl;

cout<<"Sum of Series using Copy Constructor:";

Bapu Composite PU College 18 | P a g e


C++ II PUC-Cs

cout<<s2.SS( );
getch( );
return 0;
}

OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 19 | P a g e


C++ II PUC-Cs

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>

class student
{
private:
int roll;
char name[20];
public:
void INPUT1( )
{
cout<<"Enter the Roll Number: ";
cin>>roll;
cout<<"Enter the Student Name:";
cin>>name;
}
void OUTPUT1( )
{
cout<<"Roll Number: "<<roll<<endl;
cout<<"Student Name: "<<name<<endl;
}
};

class marks : public student


{
private: int marks1, marks2, total;
public:
void INPUT2( )
{

Bapu Composite PU College 20 | P a g e


C++ II PUC-Cs

cout<<"Enter Subject 1 Marks: ";


cin>>marks1;
cout<<"Enter Subject 2 Marks: ";
cin>>marks2;
}
void OUTPUT2( )
{
total = marks1 + marks2; cout<<endl<<"Total
Marks : "<<total<<endl;
}
};

int main( )
{
marks m;
m.INPUT1( );
m.INPUT2( );
m.OUTPUT1( );
m.OUTPUT2( );
getch( );
return 0;
}
OUTPUT 1:

Bapu Composite PU College 21 | P a g e


C++ II PUC-Cs

PROGRAM 12

Create a class containing the following data members Register_No, Name and
Fees. Also create a member function to read and display the data using the
concept of pointers to objects.

#include<iostream.h>
#include<conio.h>

class student
{
private: int regno;
char name[20];
float fees;
public: void INPUT( );
void OUTPUT( );
};

void student::INPUT( )
{
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::OUTPUT( )
{
cout<<"Register Number : "<<regno<<endl;
cout<<"Student Name : "<<name<<endl;
cout<<"Fees : "<<fees<<endl;
}

int main( )
{
student s, *sptr;
sptr=&s;
s->INPUT( );
s->OUTPUT( );
getch( );
return 0;
}

Bapu Composite PU College 22 | P a g e


C++ II PUC-Cs

OUTPUT 1:

OUTPUT 2:

Bapu Composite PU College 23 | P a g e


C++ II PUC-Cs

PROGRAM 13:

Write a C++ program to perform push items into the stack.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define MAX 3
class stack
{
private:
int s[MAX], top;
public:
stack( )
{
top = -1;
}
void PUSH(int );
void OUTPUT( );
};
void stack::PUSH(int item)
{
if(top == MAX-1)
cout<<"Stack is Full<<endl;
else
{
top++;
s[top]=item;
}
}
void stack::OUTPUT( )
{
if(top == -1)
cout<<"Empty Stack!"<<endl;
else
{
for(int i=0; i<=top; i++)
cout<<endl<<s[i];

Bapu Composite PU College 24 | P a g e


C++ II PUC-Cs

cout<<" -->top element"<<endl;


}
getch( );
}
int main( )
{
stack s;
s.PUSH(20);
s.PUSH(30);
s.PUSH(40);
s.OUTPUT( );
getch();
return 0;

Bapu Composite PU College 25 | P a g e


C++ II PUC-Cs

PROGRAM 14:

Write a C++ program to perform pop items into the stack.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define MAX 3
class stack
{
private: int s[MAX], top;
public: stack()
{
top = -1;
}
void PUSH(int );
int POP( );
void OUTPUT( );
};

void stack::PUSH(int item)


{
if(top == MAX-1)
cout<<"Stack is Full !"<<endl;
else
{
top++;
s[top]=item;
}
}

int stack::POP()
{
int item; if(top == -1)
cout<<"Stack Empty!!!...Can't POP"<<endl;
else
{
item = s[top]; top--; }
return item;

Bapu Composite PU College 26 | P a g e


C++ II PUC-Cs

}
void stack::OUTPUT( )
{
if(top == -1)
cout<<"Stack Empty!!!"<<endl;
else
{
for(int i=0; i<=top; i++)
cout<<endl<<s[i];
cout<<"-->top element"<<endl;
}
}
int main( )
{
stack s;
s.POP( );
s.PUSH(20);
s.PUSH(30);
s.PUSH(40);
s.OUTPUT( );
POP( );
s.OUTPUT( );
getch();
return 0;

OUTPUT:

Bapu Composite PU College 27 | P a g e


C++ II PUC-Cs

PROGRAM 15:
Write a C++ program to perform Enqueue and Dequeue.

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define MAX 3
class que
{
private: int q[MAX],front,rear;
public: que()
{
front = -1;
rear = -1;
}
void ENQ(int );
void DEQ( );
void OUTPUT( );
};
void que::ENQ(int item)
{
if(rear == MAX-1)
{
cout<<"Queue is full.<<endl;
getch( );
exit(0);
}
if(front == -1)
{
front = 0;
rear = 0;
}
else
{
rear++;
q[rear] = item;
cout<<"Item Inserted: "<<item<<endl;
}
}

Bapu Composite PU College 28 | P a g e


C++ II PUC-Cs

void que::DEQ( )
{
int item;
if(front == -1)
{
cout<<"Queue is Empty"<<endl;
}
item = q[front];
if(front == rear)
{
front = -1;
rear = -1;
}
else
front++;
cout<<item<<” is deleted from queue<<endl;
}

void que::OUTPUT( )
{
if(front == -1)
cout<<"Queue is Empty!!!"<<endl;
else
for(int i=front; i<=rear; i++)
cout<<q[i]<<endl;
}

int main()
{
que q;
q.ENQ(20);
q.ENQ(30);
q.ENQ(40);
q.OUTPUT( );
q.DEQ( );
q.DEQ( );
q.OUTPUT( );
getch( );
return 0;
}

Bapu Composite PU College 29 | P a g e


C++ II PUC-Cs

OUTPUT:

Bapu Composite PU College 30 | P a g e


SECTION–B

STRUCTURED QUERY
LANGUAGE (SQL)
PROGRAM 1:

Generate the electricity bill for one customer.


Create a table for house hold Electricity bill with the following fields.
Field Name Type
RR_NO VARCHAR2(10)
CUS_NAME VARCHAR2(15)
BILLING_DATE DATE
UNITS NUMBER(4)
Insert 10 records into the table.
1. Check the structure of table and note your observation.
2. Add two fields to the table.
a. BILL_AMT NUMBER(6,2)
b. DUE_DATE DATE
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
4. Compute due date as BILLING_DATE + 15 Days
5. List all the bills generated.

Solution:

First we have to create the table EBILL using CREATE TABLE command.

Insert 10 records into the table using INSERT commands


Structured query Language II PUC-Cs

SQL> INSERT INTO EBILL VALUES ('EH 1003', 'ARUN KUMAR' ,'12-MAR-16',98);
SQL> INSERT INTO EBILL VALUES ('EH 2005', 'NAVEEN' ,'14-MAR-16',108);
SQL> INSERT INTO EBILL VALUES ('EH 2007','VARUN' ,'18-FEB-16',157);
SQL> INSERT INTO EBILL VALUES ('EH 3009', 'DAVID' ,'11-APR-16',77);
SQL> INSERT INTO EBILL VALUES ('EH 3010', 'JHON' ,'01-MAR-16',89);
SQL> INSERT INTO EBILL VALUES ('EH 3013', 'AKSHAY' ,'02-FEB-16',68);
SQL> INSERT INTO EBILL VALUES ('EH 1010', 'CHANDRU' ,'12-MAR-16',108);
SQL> INSERT INTO EBILL VALUES ('EH 1008', 'GHANAVI' ,'12-MAR-16',132);
SQL> INSERT INTO EBILL VALUES ('EH 2105', 'DRUVA' ,'12-MAR-16',87);
SQL> INSERT INTO EBILL VALUES ('EH 3041', 'SHREYA' ,'12-MAR-16',127);

1. Check the structure of table and note your observation.

2. Add two fields to the table.

a. BILL_AMT NUMBER(6,2)
b. DUE_DATE DATE

3. Compute the bill amount for each customer as per the following rules.

a. MIN_AMT Rs. 50

Bapu Composite PU College 32 | P a g e


Structured query Language II PUC (PCMC’s)

b. First 100 units Rs 4.50/Unit


c. >100 units Rs. 5.50/Unit
COMMAND 1:

COMMAND 2:

4. Compute due date as BILLING_DATE + 15 Days

5. List all the bills generated.

Bapu Composite PU College 33 | P a g e


Structured query Language II PUC-Cs

PROGRAM 2:

Create a student database and compute the results.

Create a table for class of students with the following fields.

Field Name Type


ID_NO NUMBER(4)
S_NAME VARCHAR2(15)
SUB1 NUMBER(3)
SUB2 NUMBER(3)
SUB3 NUMBER(3)
SUB4 NUMBER(3)
SUB5 NUMBER(3)
SUB6 NUMBER(3)
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.

Bapu Composite PU College 34 | P a g e


Structured query Language II PUC (PCMC’s)

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);
SQL>INSERT INTO CLASS VALUES (1412, 'KARAN', 60,30,45,45,36,49);
SQL>INSERT INTO CLASS VALUES (1403, 'SACHIN', 56,60,72,57,78,67);
SQL>INSERT INTO CLASS VALUES (1410, 'PRAKASH', 96,99,97,90,78,100);
SQL>INSERT INTO CLASS VALUES (1402, 'POOJA', 30,45,39,20,33,56);
SQL>INSERT INTO CLASS VALUES (1405, 'ASHWINI', 79,65,79,70,89,88);
SQL>INSERT INTO CLASS VALUES (1406, 'PRAJWAL', 100,90,100,89,90,100);
SQL>INSERT INTO CLASS VALUES (1404, 'BALU', 35,30,78,23,44,70);
SQL>INSERT INTO CLASS VALUES (1407, 'ESHWAR', 100,100,100,98,99,100);

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 “PASS” or “FAIL” by checking if the student has scored more
than 35 marks in each subject.

Bapu Composite PU College 35 | P a g e


Structured query Language II PUC-Cs

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”.

Bapu Composite PU College 36 | P a g e


Structured query Language II PUC (PCMC’s)

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.

Bapu Composite PU College 37 | P a g e


Structured query Language II PUC-Cs

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)
Create another table DEPARTMENT.
Field Name Type
DEPT_ID NUMBER(2)
DEPT_NAME VARCHAR2(10)
SUPERVISOR VARCHAR2(10)
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.

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.

Solution:

First we have to create two tables, EMPLOYEE and DEAPRTMENT.

Bapu Composite PU College 38 | P a g e


Structured query Language II PUC (PCMC’s)

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);
SQL> INSERT INTO EMPLOYEE VALUES (106, 02, 'SUSHMA', 18000);
SQL> INSERT INTO EMPLOYEE VALUES (109, 01, 'KUSHI', 22300);
SQL> INSERT INTO EMPLOYEE VALUES (110, 02, 'VIDHYA', 15000);
SQL> INSERT INTO EMPLOYEE VALUES (102, 02, 'KAVYA', 21300);
SQL> INSERT INTO EMPLOYEE VALUES (107, 03, 'AKASH', 18200);
SQL> INSERT INTO EMPLOYEE VALUES (108, 04, 'NAWAZ', 12000);
SQL> INSERT INTO EMPLOYEE VALUES (103, 02, 'DEEPAK', 24000);

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.

2. How many employees work for Accounts department?

3. What are the Minimum, Maximum and Average salary of employees working for
Accounts department?

Bapu Composite PU College 39 | P a g e


Structured query Language II PUC-Cs

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.

Bapu Composite PU College 40 | P a g e


Structured query Language II PUC (PCMC’s)

8. Delete all the rows for the employee in the Apprentice department.

Bapu Composite PU College 41 | P a g e


SECTION–C

ADVANCED HTML
PROGRAM 1:

Write a HTML program to create a Study Time Table.


<HTML>

<HEAD>

<TITLE>STUDY TIMETABLE</TITLE>

<STYLE>

TABLE , TR, TH, TD

BORDER : 1PX SOLID BLUE;

</STYLE>

</HEAD>

<BODY BGCOLOR= RED TEXT= WHITE>

<H1> <CENTER> STUDY TIMETABLE FOR THE WEEK</CENTER> </H1>

<TABLE>

<TR>

<TH>DAYS</TH>

<TH>SUBJECTS</TH>

<TH>MORNING STUDY TIME TABLE ONLT FOR READING</TH>

<TH>COLLEGE STUDY TIME TABLE</TH>

<TH>EVENING WRITING TIME</TH>

<TH>NIGHT QUESTION PAPER SOLUTION TIME</TH>

</TR>
Advanced HTML II PUC-Cs

<TR>

<TD>MONDAY</TD>

<TD>ENGLISH</TD>

<TD>5:00-6:00AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

<TR>

<TD>TUESDAY</TD>

<TD>SANSKRIT</TD>

<TD>5:00-6:30AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

<TR>

<TD>WEDNEDAY</TD>

<TD>COMPUTER SCIENCE </TD>

<TD>5:00-6:30AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

Bapu Composite PU College 43 | P a g e


Advanced HTML II PUC-Cs

<TR>

<TD> THURSDAY </TD>

<TD> ECONOMICS</TD>

<TD>5:00-6:30AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

<TR>

<TD> FRIDAY</TD>

<TD> BUSINESS</TD>

<TD>5:00-6:30AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

<TR>

<TD> SATURDAY </TD>

<TD> ACCOUNTANCY</TD>

<TD>5:00-6:30AM</TD>

<TD>9:00-4:00PM</TD>

<TD>6:30-8:30PM</TD>

<TD>9:30-11:30PM</TD>

</TR>

</TABLE>

<MARQUEE DIRECTION="RIGHT"> SUNDAY HOLIDAY </MARQUEE>

</BODY>

</HTML>

Bapu Composite PU College 44 | P a g e


Advanced HTML II PUC-Cs

OUTPUT:

Bapu Composite PU College 45 | P a g e


Advanced HTML II PUC-Cs

PROGRAM 2:

Write a HTML program to create table and form.


<HTML>

<HEAD>

<TITLE>STUDDENT FEEDBACK FORM</TITLE>

<STYLE>

TABLE,TR,TH,TD

BORDER:1PX SOLID BLACK;

</STYLE>

</HEAD>

<BODY BGCOLOR= BLUE TEXT=WHITE>

<CENTER>

<FORM NAME="APP FOR PUC"METHOD="POST">

<H1> WELCOME TO BAPU COLLEGE <BR>

STUDENT FEED BACK FORM </H1>

<TABLE>

<TR>

<TH>STREAM</TH>

<TH>COMMERCE<INPUTTYPE="RADIO">SCIENCE<INPUT TYPE="RADIO">

ARTS<INPUT TYPE="RADIO"> </TH>

</TR>

Bapu Composite PU College 46 | P a g e


Advanced HTML II PUC-Cs

<TR>

<TH>STUDENT ID*</TH>

<TH><INPUT TYPE="TEXT"MAX LENGTH="50"SIZE="30"></TH>

</TR>

<TR>

<TH>PASSWORD*</TH>

<TH><INPUT TYPE="PASSWORD"MAX LENGTH="50" SIZE="30"></TH>

</TR>

<TR>

<TH>EMAIL ADDRESS*</TH>

<TH><INPUT TYPE="TEXT"MAX LENGTH="50" SIZE="30"></TH>

</TR>

<TR>

<TH>MOBILE</TH>

<TH><INPUT TYPE="TEXT"MAX LENGTH="50" SIZE="30"></TH>

</TR>

<TR>

<TH>FEED BACK*</TH>

<TH><TEXTAREA MAX
LENGTH="500"ROWS="10"COLUMN="50"></TEXTAREA></TH>

</TR>

<TR>

<TH><INPUT TYPE="SUBMIT"VALUE="SUBMIT"></TH>

<TH><INPUT TYPE="RESET"VALUE="RESET"></TH>

</TR>

</TABLE>

</FORM></CENTER>

Bapu Composite PU College 47 | P a g e


Advanced HTML II PUC-Cs

</BODY>

</HTML>

OUTPUT:

Bapu Composite PU College 48 | P a g e

You might also like