2nd PUC Computer Lab Manual-2023
2nd PUC Computer Lab Manual-2023
PRACTICAL BLUEPRINT 2
SECTION A - C++
1.Write a program to find the frequency of an element in an array 3
2.Write a program to insert an element into an array at a given position. 5
3.Write a program to delete an element from an array from a given position. 8
4.Write a program to implement insertion sort. 11
5.Write a program to implement binary search. 14
6. Write a program to compute simple interest and to display the result. 16
7.Write a program to compute the discriminant and print the roots. 18
8. Write a program to implement function overloading. 21
9. Write a program to find the cube of a number using inline functions. 24
10.Write a program to find the sum of series 1+x+x2+--------+xn using constructors. 25
11.Write a program to implement the concept of single level inheritance. 26
12.Write a program to implement the concept of pointers to objects. 28
13.Write a program to perform push items into the stack. 30
14.Write a program to pop elements from the stack. 35
15.Write a program to perform enqueue and dequeue. 41
16.Write a program to create a linked list and append nodes. 47
SECTION B - SQL
17.Generate the electricity bill for one consumer. 50
18.Create a student database and compute the result 55
19.Generate the Employee details and compute the salary based on the department. 63
20.Create database for the bank transaction. 71
SECTION C - HTML
21.Write a HTML program to create a study timetable 81
22.Write a HTML program with table and form. 83
1
PRACTICAL BLUEPRINT
2
SECTION A - C++
1. Write a program to find the frequency of an element in an array
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
class frequency
{
private:
int a[100],se,count,n,i;
public:
void getdata();
void findfreq();
void display();
};
void frequency::getdata()
{
cout<<"How many elements"<<endl;
cin>>n;
cout<<"Enter the elements"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the element to be searched"<<endl;
cin>>se;
}
void frequency::findfreq()
{
count=0;
for(i=0; i<n; i++ )
{
if(a[i]==se)
count++;
}
}
void frequency::display()
{
if(count>0)
cout<<"frequency of "<<se<<" is "<<count<<endl;
else
cout<<se<<"does not exist"<<endl;
}
3
void main()
{
clrscr ();
frequency x;
x.getdata();
x.findfreq();
x.display();
getch();
}
Sample Run
DIY
OUTPUT 1:
OUTPUT 2:
4
2. Write a program to insert an element into an array at a given position.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
class insertion
{
private:
int a[100],ie,pos,n,i;
public:
void getdata();
void insert();
void display();
};
void insertion::getdata()
{
cout<<"How many elements"<<endl;
cin>>n;
cout<<"Enter the elements"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"Enter the element to be inserted"<<endl;
cin>>ie;
cout<<"Enter the position to be inserted 0 to"<<n<<endl;
cin>>pos;
if(pos>n)
{
cout<<pos<<"is an invalid position"<<endl;
exit(0);
}
}
5
void insertion::insert()
{
for(i=n-1;i>=pos;i--)
{
a[i+1]=a[i];
}
a[pos]=ie;
n++;
cout<<ie<<"is inserted "<<endl;
}
void insertion::display()
{
cout<<"The array after insertion is"<<endl;
for(i=0;i<n;i++)
cout<<setw(4)<<a[i];
}
void main()
{
clrscr();
insertion x;
x.getdata();
x.insert();
x.display();
getch();
}
Sample run
6
DIY
OUTPUT 1:
OUTPUT 2:
7
3. Write a program to delete an element from an array from a given position.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
class deletion
private:
int n,i,a[100],de,p;
public:
void getdata();
void remove();
void display();
};
void deletion::getdata()
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cin>>p;
8
void deletion::remove()
if(p>n-1)
exit(0);
de=a[p];
for(i=p+1;i<n;i++)
a[i-1]=a[i];
n--;
cout<<de<<"is deleted"<<endl;
void deletion::display()
for(i=0;i<n;i++)
cout<<setw(3)<<a[i];
void main()
clrscr();
deletion d;
d.getdata();
d.remove();
d.display();
getch();
}
9
Sample run
DIY
OUTPUT 1:
OUTPUT 2:
10
4. Write a program to sort the elements of an array in ascending order using
insertion sort.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
class sorting
{
private:
int a[100],n,i,j,t;
public:
void getdata();
void sort();
void display();
};
void sorting::getdata()
{
cout<<"How many elements"<<endl;
cin>>n;
cout<<"Enter the elements"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
}
void sorting::sort( )
{
for(i=1;i<n;i++)
{
j=i;
while(j>=1)
{
if(a[j]<a[j-1])
{
11
t=a[j];
a[j]=a[j-1];
a[j-1]=t;
}
j--;
}
}
}
void sorting::display()
{
cout<<"The array after sorting is"<<endl;
for(i=0;i<n;i++)
cout<<setw(4)<<a[i];
}
void main()
{
clrscr();
sorting x;
x.getdata();
x.sort();
x.display();
getch();
}
12
Sample run
DIY
OUTPUT 1:
OUTPUT 2:
13
5. Write a program to search for a given element in an array using binary search
method.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class bisearch
{
int a[100],n,se,i,beg,end,mid,pos;
public:
void getdata();
void search();
void display();
};
void bisearch::getdata()
{
cout<<"enter no of elements"<<endl;
cin>>n;
cout<<"enter the elements"<<endl;
for(i=0; i<n; i++ )
{
cin>>a[i];
}
cout<<"enter the search element"<<endl;
cin>>se;
}
void bisearch::search()
{
beg=0,end=n-1;
pos=-1;
while(beg<=end)
{
mid=(beg+end)/2;
if(a[mid]==se)
{
pos=mid;
break;
}
else if(se>a[mid])
beg=mid+1;
else
end=mid-1;
}
}
void bisearch::display()
{
if(pos>=0)
14
cout<<se<<"found at position"<<pos<<endl;
else
cout<<se<<"not found"<<endl;
}
void main()
{
bisearch x;
clrscr();
x.getdata();
x.search();
x.display();
getch();
}
Sample run
DIY
OUTPUT 1:
OUTPUT 2:
15
6. Write a program to create a class with data members principle, time and rate.
Create member functions to accept data values to compute simple interest and
display the result.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
class sinterest
{
private:
float p,t,r,si;
public:
void getdata();
void compute();
void display();
};
void sinterest::getdata()
{
cout<<"Enter principal, time and rate"<<endl;
cin>>p>>t>>r;
}
void sinterest::compute()
{
si=(p*t*r)/100;
}
void sinterest::display()
{
cout<<"principle="<<p<<endl;
cout<<"time="<<t<<endl;
cout<<"interest="<<r<<endl;
cout<<"simple interest="<<si;
}
void main()
{
clrscr();
sinterest x;
x.getdata();
x.compute();
x.display();
getch();
}
16
Sample run
DIY
OUTPUT 1:
17
7. Write a program to create a class with data members a,b,c and member
functions to input the data, compute the discriminant based on the following
conditions and print the roots.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#include<math.h>
class quadratic
{
private:
double a,b,c,d,r1,r2;
public:
void getdata();
void compute();
void display();
};
void quadratic::getdata()
{
cout<<"Enter the co-efficients"<<endl;
cin>>a>>b>>c;
}
void quadratic::compute()
{
d=(b*b)-(4*a*c);
if(d==0)
{
cout<<"Roots are equal"<<endl;
r1=-b/(2*a);
r2=r1;
18
}
else if(d>0)
{
cout<<"Roots are positive and different"<<endl;
r1=(-b+sqrt(d))/2*a;
r2=(-b-sqrt(d))/2*a;
}
else
{
cout<<"Roots are imaginary"<<endl;
exit(0);
}
}
void quadratic::display()
{
cout<<"root1="<<r1<<endl;
cout<<"root2="<<r2<<endl;
}
void main()
{
clrscr();
quadratic x;
x.getdata();
x.compute();
x.display();
getch();
}
Sample run
19
DIY
OUTPUT 1:
OUTPUT 2:
OUTPUT 3:
20
8. Write a program to find the area of a square/rectangle/triangle using function
overloading.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<math.h>
class foverload
{
private:
float s;
public:
double area(double s)
{
return(s*s);
}
double area(double l, double b)
{
return(l*b);
}
double area(double a,double b,double c)
{
s=(a+b+c)/2.0;
return(sqrt(s*(s-a)*(s-b)*(s-c)));
}
};
void main()
{
clrscr();
foverload f;
double x,y,z;
int ans;
cout<<"Enter number of sides(1,2 or 3)"<<endl;
cin>>ans;
if(ans==1)
{
cout<<"Enter the side of a square"<<endl;
cin>>x;
cout<<"The area of a square="<<f.area(x)<<endl;
}
else if(ans==2)
{
cout<<"Enter the length and breadth"<<endl;
cin>>x>>y;
cout<<"Area of a rectangle="<<f.area(x,y);
}
21
else if(ans==3)
{
cout<<"Enter three sides of a tringle"<<endl;
cin>>x>>y>>z;
cout<<"Area of a triangle="<<f.area(x,y,z)<<endl;
}
else
cout<<"Invalid choice"<<endl;
getch();
}
Sample run
22
DIY
OUTPUT 1
OUTPUT 2
OUTPUT 3
OUTPUT 4
23
9. Write a program to find the cube of a number using inline functions.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class cube
{
private:
int n,c;
public:
void getdata();
void findcube();
void display();
};
void cube::getdata()
{
cout<<"Enter a number to find the cube"<<endl;
cin>>n;
}
inline void cube::findcube() //inline function
{
c=n*n*n;
}
void cube::display()
{
cout<<"cube of"<<n<<"="<<c<<endl;
}
void main()
{
clrscr();
cube x;
x.getdata();
x.findcube();
x.display();
getch();
}
24
10. Write a program to find the sum of series 1+x+x2+--------+xn using constructors.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<math.h>
class series
{
private:
int b,p,sum,i;
public:
series(int b1,int p1)//parameterized constructor
{
b=b1;
p=p1;
sum=1;
}
void compute();
void display();
};
void series::compute ()
{
for(i=1;i<=p;i++)
{
sum=sum+pow(b,i);
}
}
void series::display()
{
cout<<"Sum of series="<<sum<<endl;
}
void main()
{
int x,n;
clrscr();
cout<<"Enter base and power"<<endl;
cin>>x>>n;
series s(x,n);
s.compute();
s.display();
getch();
}
25
Sample run
11.
DIY
OUTPUT 1:
11. Create a base class containing the data members reg_no and name. Also
create a member function to read and display the data. Create a derived class
that contains marks of two subjects and total marks as the data members and
member functions to read and display the data of the derived class using the
concept of single level inheritance.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class student
{
private:
int rno;
char name[30];
public:
void getdata()
{
cout<<"Enter the roll no"<<endl;
cin>>rno;
cout<<"Enter name"<<endl;
cin>>name;
}
void display()
{
cout<<"Rollno:"<<rno<<endl;
26
cout<<"Name:"<<name<<endl;
}
};
:
class marks public student
{
private:
int m1,m2,total;
public:
void getdata1()
{
cout<<"Enter two subject marks"<<endl;
cin>>m1>>m2;
total=m1+m2;
}
void display1()
{
cout<<"Subject1="<<m1<<endl;
cout<<"Subject2="<<m2<<endl;
cout<<"Total marks="<<total;
}
};
void main()
{
clrscr();
marks x;
x.getdata();
x.getdata1();
x.display();
x.display1();
getch();
}
Sample run
27
DIY
OUTPUT 1:
12. Create a class containing the following data members regno, 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>
#include<iomanip.h>
class student
{
private:
int regno;
char name[30];
float fees;
public:
void getdata();
void display();
};
void student::getdata()
{
cout<<"Enter the register no"<<endl;
cin>>regno;
cout<<"Enter name"<<endl;
cin>>name;
cout<<"Enter fees"<<endl;
cin>>fees;
}
void student::display()
{
cout<<"Registerno:"<<regno<<endl;
cout<<"Name:"<<name<<endl;
28
cout<<"fees:"<<fees<<endl;
}
void main()
{
clrscr();
student s,*sp;
sp = &s;
sp🡪getdata();
sp🡪display();
getch();
}
DIY
OUTPUT 1:
29
13. Write a program to perform push items into the stack.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define n 3
class stack
{
private:
int a[n],top,i;
public:
stack()
{
top=-1;
}
31
cout<<"Thank you"<<endl;
exit(0);
}
default: cout<<"Invalid choice"<<endl;
}
}
}
sample run
32
33
DIY
34
14. Write a program to pop elements from the stack.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define n 3
class stack
{
private:
int a[n],top,i;
public:
stack()
{
top=-1;
}
void push(int item);
void pop();
void display();
};
void stack::push(int item)
{
if(top==n-1)
{
cout<<"Stack is full"<<endl;
return;
}
top++;
a[top]=item;
cout<<item<<"is successfully pushed"<<endl;
}
void stack::pop()
{
if (top==-1) // checking underflow condition
{
cout<<”Stack is empty”<<endl;
return;
}
35
cout<<a[top]<<” popped”;
top--;
}
void stack::display()
{
if(top!=-1)
{
cout<<"Stack contains";
for(i=0;i<=top;i++)
cout<<setw(3)<<a[i];
cout<<endl;
}
else
cout<<"stack is empty"<<endl;
}
void main()
{
clrscr();
stack s;
int choice, pitem;
while(1)
{
cout<<endl<<"1.Push"<<endl<<”2.Pop”<<endl<<"3.Display"<<endl<<"4.Exit"<<endl;
cout<<"Enter your choice"<<endl;
cin>>choice;
switch(choice)
{
case 1:
{
cout<<"Enter the item to be pushed"<<endl;
cin>>pitem;
s.push(pitem);
break;
}
case 2:
{
s.pop();
break;
}
36
case 3:
{
s.display();
break;
}
case 4:
{
cout<<"Thank you"<<endl;
getch();
exit(0);
}
default: cout<<"Invalid choice"<<endl;
}
}
}
Sample run
37
DIY
OUTPUT 1: OUTPUT 2
38
OUTPUT 3: OUTPUT 4:
OUTPUT 5: OUTPUT 6:
OUTPUT 7: OUTPUT 8:
39
OUTPUT 9: OUTPUT 10:
40
15.Write a program to perform enqueue and dequeue.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<stdlib.h>
#define n 3
class queue
{
private:
int a[n],front,rear,count,i;
public:
queue();
void enqueue(int x);
void dequeue();
void display();
};
queue::queue()
{
front=-1;
rear=-1;
count=0;
}
void queue::enqueue(int x)
{
if(rear==n-1)
{
cout<<"Queue is full"<<endl;
return;
}
if(front==-1)
{
front=0;
rear=0;
41
}
else
rear++;
a[rear]=x;
count++;
cout<<x<<"is successfully inserted"<<endl;
}
void queue::dequeue()
{
if(front == -1)
{
cout<<"Queue is empty"<<endl;
return;
}
else
{
int de=a[front];
if(front==rear)
{
front=-1;
rear=-1;
}
else
front++;
count--;
cout<<de<<"is succefully deleted"<<endl;
}
}
void queue::display()
{
if(count>0)
{
cout<<"Queue contains";
for(i=front; i<=rear; i++)
42
cout<<setw(3)<<a[i];
cout<<endl;
}
else
cout<<"Queue is empty"<<endl;
}
void main()
{
clrscr();
queue q;
int choice,itm;
while(1)
{
cout<<endl<<"1.Enqueue"<<endl<<"2.Dequeue"<<endl<<"3.Display"
<<endl<<"4.Exit"<<endl;
cout<<"Enter your choice"<<endl;
cin>>choice;
switch(choice)
{
case 1:
{
cout<<"enter the item to be inserted"<<endl;
cin>>itm;
q.enqueue(itm);
break;
}
case 2:
{
q.dequeue();
break;
}
case 3:
{
q.display();
43
break;
}
case 4:
{
cout<<"Thank you"<<endl;
getch();
exit(0);
}
default: cout<<"Invalid choice"<<endl;
}
}
}
Sample run
44
DIY
OUTPUT 1: OUTPUT 2:
OUTPUT 3: OUTPUT 4:
45
OUTPUT 5: OUTPUT 6:
OUTPUT 7: OUTPUT 8:
46
16. Write a program to create a linked list and append nodes.
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class linklist
{
private:
struct node
{
int data;
node *link;
}*start;
public:
linklist();
void append(int x);
void count();
void display();
};
linklist::linklist()
{
start=NULL;
}
void linklist::display()
{
if(start==NULL)
{
cout<<endl<<"linked list is empty"<<endl;
return;
}
cout<<"Linked list contains"<<endl;
node *tmp=start;
while(tmp!=NULL)
{
cout<<tmp->data<<" ";
tmp=tmp->link;
}
}
void linklist::append(int x)
{
node *nnode;
nnode=new node;
nnode->data=x;
nnode->link=NULL;
if(start==NULL)
{
start=nnode;
47
cout<<endl<<x<<"is inserted as the first node"<<endl;
}
else
{
node *tmp=start;
while(tmp->link!=NULL)
tmp=tmp->link;
tmp->link=nnode;
cout<<endl<<x<<"is appended"<<endl;
}
}
void linklist::count()
{
node *tmp;
int c=0;
for(tmp=start;tmp!=NULL;tmp=tmp->link)
c++;
cout<<endl<<"Number of nodes in the linked list="<<c<<endl;
}
void main()
{
clrscr();
linklist *x=new linklist();
x->display();
x->append(5);
x->count();
x->append(6);
x->display();
x->count();
x->append(7);
x->display();
x->count();
getch();
}
48
Sample run
DIY
OUTPUT 1:
49
SECTION B - SQL
17. Generate the electricity bill for one consumer.
1. Create a table for household electricity bill with the following fields:
RR_Number Varchar2(6)
Consumer_name Varchar2(10)
Date_billing Date
Units Number(4)
Table created.
50
insert into ebill
values('A006','solanki','24-feb-2018',190);
1 row(s) inserted.
5. Compute the bill amount for each customer as per the following rules
● Min_amt Rs. 50
update ebill
set amount=50;
10 row(s) updated.
51
● First 100 units Rs. 4.50/unit
update ebill
set amount=amount+units*4.50
where units<=100;
6 row(s) updated.
DIY
Create a table for household electricity bill with the following fields:
RR_Number Varchar2(6)
Consumer_name Varchar2(10)
Date_billing Date
Units Number(4)
52
Insert 10 records
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
53
5. Compute the bill amount for each customer as per the following rules
● Min_amt Rs. 50
● First 100 units Rs. 4.50/unit
● >100 units Rs. 5.50/unit
54
18. Create a student database and compute the result.
Name Type
Student_id Number(4)
Student_name Varchar2(25)
Sub1_marks Number(3)
Sub2_marks Number(3)
Sub3_marks Number(3)
Sub4_marks Number(3)
Sub5_marks Number(3)
Sub6_marks Number(3)
2. Add records into the table for 5 students for name, student_id, student_name and marks
in 6 subjects using insert command
55
values(1005,'netra',35,36,35,42,49,41);
1 row(s) inserted.
3. Display the description of the fields in the table using desc command
desc student;
update student
set percentage=total/6.0;
5 row(s) updated.
6. Compute the result as “pass” by checking if the student has scored more than 35 marks in
each subject
update student
set result='pass'
where m1>=35 and m2>=35 and m3>=35 and m4>=35 and m5>=35 and m6>=35;
2 row(s) updated.
7. Compute the result as “fail” by checking if the student has scored less than 35 marks in
any subject
update student
set result='fail'
where m1<35 or m2<35 or m3<35 or m4<35 or m5<35 or m6<35;
3 row(s) updated.
56
8. Retrieve all the records of the table
select * from student;
57
12. Count the number of students who have passed
select count(*)
from student
where result='pass';
58
DIY
Name Type
Student_id Number(4)
Student_name Varchar2(25)
Sub1_marks Number(3)
Sub2_marks Number(3)
Sub3_marks Number(3)
Sub4_marks Number(3)
Sub5_marks Number(3)
Sub6_marks Number(3)
2. Add records into the table for 10 students for student_id, student_name and marks in 6
subjects using insert command
1.
2.
3.
4.
5.
6.
7.
8.
59
9.
10.
3. Display the description of the fields in the table using desc command
6. Compute the result as “pass” by checking if the student has scored more than 35 marks in
each subject
7. Compute the result as “fail” by checking if the student has scored less than 35 marks in any
subject
60
8. Retrieve all the records of the table
61
13. Count the number of students who have failed
62
19. Generate the Employee details and compute the salary based on the
department.
Assume the department names as purchase (id=01), accounts (id=02), sales (id=03), apprentice
(id=04).
1 row(s) inserted.
1 row(s) inserted.
1 row(s) inserted.
1 row(s) inserted.
1 row(s) inserted.
1 row(s) inserted.
1 row(s) inserted.
4. Find the names of all employees who work for the accounts department
select ename
from employee
where did=(select did from dept where dname='accounts’);
64
5. How many employees work for accounts department?
select count(*)
from employee
where did=(select did from dept where dname='accounts');
6. What is the minimum, maximum and average salary of employees working for accounts
department
8. Retrieve the department names for each department where only one employee works
select dname from dept
where did in(select did from employee
group by did
having count(*)=1);
1 row(s) updated.
65
10. Add a new column to the table employee, called Bonus number(5) and compute 5% of the
salary to the said field
Table altered.
update employee
set bonus=esalary*0.05;
5 row(s) updated.
11. Delete all the rows the employees in the apprentice department
delete from employee
where did=(select did from dept where dname='apprentice');
1 row(s) deleted.
12. Display all records from employee.
select * from employee;
66
DIY
1. Create the following table employee.
1.
2.
3.
4.
5.
67
3. Insert the records and write the output.
1.
2.
3.
4.
4. Find the names of all employees who work for the accounts department
6. What is the minimum, maximum and average salary of employees working for accounts
department
68
7. List the employees working for a particular supervisor
8. Retrieve the department names for each department where only one employee works
10. Add a new column to the table employee, called Bonus number(5) and compute 5% of the salary
to the said field
11. Delete all the rows the employees in the apprentice department
69
12. Display all records from the employee table.
70
20. Create a database for the bank transaction.
71
3. insert into customer values
(102,'raj','KG Road, Bangalore', 8452415255);
1 row(s) inserted.
7. Display all records from bank table whose transaction date is greater than 5-feb-2018
select * from bank where trdate > '5-feb-2018';
72
8. Join two tables(bank and customer)
select accno, cname, customer.cno from
bank,customer
where customer.cno=bank.cno;
9. Display count of all records and their corresponding transaction, group by transaction
type.
select trtype,count(*)
from bank
group by trtype;
10. Display all records from customer, order by customer name in descending order.
select *
from customer
order by cname desc;
73
12. Alter the customer table to change the size of the customer address to char(50).
alter table customer
modify caddress char(50);
Table altered.
14. Create a table containing customer number range between 100 and 101
create table tempcust
as
(
select *
from customer
where cno between
100 and 101
);
Table created.
15. Display records from customers whose name starts with ‘s’
select *
from customer
where cname like's%';
74
18. Create a view on the customer table showing customer_no and customer phone number.
create view vcustomer
as
(select cno,cphone from customer);
View created.
21. Display account number from bank who have more than one transaction.
select accno,count(*)
from bank
group by accno
having count(*)>1;
no data found
22. Display all records from customer whose phone number is NULL
select * from customer
where cphone=null;
no data found
75
25. Drop table customer.
drop table customer;
Table dropped
DIY
2.
76
3.
2.
3.
4.
77
7. Display all records from bank table whose transaction date is greater than 5-feb-2023
9. Display count of all records and their corresponding transaction, group by transaction
type.
10. Display all records from customer, order by customer name in descending order.
78
12. Alter the customer table to change the size of the customer address to char(50).
14. Create a table containing customer number range between 100 and 101
15. Display records from customers whose name starts with ‘s’
79
18. Create a view on the customer table showing customer_no and customer phone number.
21. Display account number from bank who have more than one transaction.
22. Display all records from customer whose phone number is NULL
80
SECTION C - HTML
21. Write a HTML program to create a study timetable
<html>
<head><title> Study timetable</title></head>
<body bgcolor="yellow">
<h1><center>MY STUDY TIME TABLE FOR THE WEEK</center></h1>
<center><img src="exam.jpg" height="300" width="300"></center>
<br>
<table border=3 align="center">
<tr>
<th>Day/Time</th>
<th>5.00 -6.30 AM</th>
<th>4.30-5.30 PM </th>
<th>5.30 -6.30 PM </th>
<th>6.30 -7.30 PM </th>
<th>9.00 -10.30 PM </th>
</tr>
<tr>
<th>MONDAY</th>
<td>Physics</td>
<td>Chemistry</td>
<td>Maths</td>
<td>Comp. Science</td>
<td>English</td>
</tr>
<tr>
<th>TUESDAY</th>
<td>Maths</td>
<td>Comp. Science</td>
<td>English</td>
<td>II Lang</td>
<td>Physics</td>
</tr>
<tr>
<th>WEDNESDAY </th>
<td>English</td>
<td>II Lang</td>
<td>Physics</td>
<td>Chemistry</td>
<td>Maths</td>
</tr>
<tr>
<th>THURSDAY</th>
<td>Comp. Science</td>
<td>Physics</td>
<td>English</td>
<td>II Lang</td>
<td>Chemistry</td>
81
<td>Maths</td>
</tr>
<tr>
<th>FRIDAY</th>
<td>Comp. Science</td>
<td>English</td>
<td> II Lang </td>
<td>Chemistry</td>
<td>Maths</td>
</tr>
<tr>
<th>SATURDAY</th>
<td>Physics</td>
<td>English</td>
<td>II Lang</td>
<td>Chemistry</td>
<td>Maths</td>
</tr>
</table>
<br>
<marquee >Action is the fundamental key to success</marquee>
</body>
</html>
82
22. Write a HTML program with table and form.
<html>
<head><title> form</title></head>
<body bgcolor="orange">
<h3><center>APPLICATION FORM</center></h3>
<form action="test.php">
<table border=1 color="blue" cellspacing="5" cellpadding="5" align ="center">
<tr>
<td><label>student name</label></td>
<td><input type="text"></td>
</tr>
<tr>
<td><label>Date of Birth</label></td>
<td><input type="date"></td>
</tr>
<tr>
<td><label>Gender</label></td>
<td><input type="radio" name="G" >MALE
<input type="radio" name="G" >FEMALE</td>
</tr>
<tr>
<td><label>email </label></td>
<td><input type="email" >
</tr>
<tr>
<td><label>Second Language chosen</label></td>
<td>
<select type="Second Language">
<option value="Hindi">Hindi</option>
<option value="Kannada">Kannada</option>
<option value="French">French</option>
</td>
</tr>
<tr>
<td><label>Subjects chosen: </label></td>
<td>
<input type="checkbox"> Physics
<input type="checkbox"> Chemistry
<input type="checkbox"> Biology
</td>
</tr>
<tr align="center" >
<td colspan="2">
<input type="submit">
<input type="Reset"></td></tr>
</form>
</html>
83
84
VIVA QUESTIONS
2019-20
Section –A
C++
1. What is object and class in
OOP? Object is an instance of a
class. Class is collection of
similar objects.
A class binds data members and member functions together.
3. List the access specifiers used with a class. Name the default access specifier.
○ Private
○ Public
○ Protected
The default access specifier is private
[Access specifiers define the scope of the
data]
The members declared as "private" can be The members declared as "public" are
accessed only within the same class and accessible within the class as well as from
not from outside the class. outside the class.
8. Define sorting
The process of arranging elements either in ascending or descending order is called sorting.
All objects are initialized to same set of Different objects can be initialized to
values. different values.
86
14. Differentiate between base class and derived class.
Base class Derived class
87
19. List the various operations performed on arrays.
The different operations performed on arrays are
1. Traversing
2. Searching
3. Inserting
4. Deleting
5. Sorting
6. Merging
Section-B SQL
21. What is SQL? Mention one SQL package.
SQL stands for Structured Query Language. Language used to communicate with
RDBMS.
Oracle, Sybase, Microsoft SQL Server, Access
88
25. Differentiate DROP and DELETE commands in SQL
DELETE DROP
DELETE is used to remove tuples or rows DROP is used to remove entire table
from a table.
89
count( ) this function returns the number of rows in the table that satisfies the condition specified in the
where condition.
Max() this function used to get the maximum value from a column.
Min( ) this function used to get the minimum value from a column.
Avg() this function is used to get the average value of a numeric column.
Section-C
HTML
we can select or mark single option we can mark or check all the options
on radio button over the checkbox
Radio buttons are used for a The checkboxes are used for
specific answer. getting multiple answers.
33. Mention the purpose of <tr><th> and <td> tags used in the table.
<tr> =Table row.
It is used to create a row
<th>=table heading
Used for headings. The text will be bold.
<td>=table data
Used to add data to the table.
34. What is XML?
XML stands for eXtensible Markup Language.
It is a markup language for documents containing structured information.
Structured information contains both content (words,pictures etc) and some indication of
90
what role that content plays.
XML is a markup language much like HTML. XML was designed to describe data. XML
tags are not predefined in XML. You must define your own tags.
<i> The <i> tag will italicize the text inside the tag.
<u> The <u> tag will underline the text inside the tag.
Header Tags The header tags <h1>, ... <h6> allows us to place
additional importance on the text within such
tags.
<h1> has the largest size, and <h6> the smallest
<center> The <center> tag causes all the text within the tag
to be centered
91
Dynamic content, which allows the user to dynamically change Web page
content.(depending on time and geographical location)
Dynamic positioning of Web page elements.
Dynamic style, which allows the user to change the Web page's color, font, size or content.
Can be used to create animations, games, applications, provide new ways of navigating
through web sites.
VIVA QUESTIONS
2021-22
1. Mention the different access specifiers in C++ Ans:
Private, Ans:Public and Protected
4. What is an object?
Ans: Instance of a class (Or Any Relevant Definition).
5. Define class.
Class is a way of grouping objects having similar characteristics
8. What is an array?
Ans: An array is a set of homogeneous elements under the same name and same data type
92
11. What is function overloading?
Ans: Two or more functions have same name, but differs in number of arguments or
data type of arguments.
4. What is an object?
Ans: Instance of a class (Or Any Relevant Definition)
5. Define class.
Ans: Class is a way of grouping objects having similar characteristics. (Or Any Relevant
Definition)
7. What is an array?
94
Ans: An array is a set of homogeneous elements under the same name and same data type.
OR
An array is a collection of elements of the same data type and referred by a single name.
12.Define constructor.
Ans: Constructor is a special member function that has the same name as that of a class
used to initialize the objects of a class automatically.
13.What is destructor?
Ans: Destructor is a special member function which will be executed automatically
when an object is destroyed (Any Relevant Definition)
16.Define pointer?
Ans: A pointer is a variable that holds the memory address of another variable.
18.Define stack.
Ans: STACK is a special type of data structure where data items are inserted and deleted
from one (same) end called top of the stack. It follows LIFO.(Last In First Out)
19.What is an inheritance?
Ans: Inheritance is the capability of one class to acquire the properties from another class.
23.What is DHTML?
Ans: Dynamic Hyper Text Markup Language (DHTML) refers to web content that
changes each time it is viewed. (Any Relevant Definition)
28.What is XML
XML is an Extended MarkUp Language for documents containing Structured
information (Any Relevant Definition)
SQL
29.Mention the DDL Commands in SQL
Create , Alter and Drop Commands
31. Mention the difference between delete and drop command in SQL
Delete command - deletes the records of the table
Drop command - deletes the structure of the table ( remove the table from the database)
96
33. Differentiate between order by and group by commands in SQL
Order by – Sort the records in ascending or descending order of the specified column
Group by – List the identical records / data into groups
97
FULL FORMS
1 CPU Central Processing Unit
2 XT Extended technology
3 AT Advanced technology
4 ATX Advanced Technology Extended
5 SATA Serial Advanced technology Attachment
6 BIOS Basic input Output System
7 CMOS Complementary Metal Oxide Semiconductor
8 POST Power On Self Test
10 ISA Industrial Standard Architecture
11 PCI Peripheral Component Interconnect
12 AGP Accelerated Graphics Port
13 IDE Integrated Digital Electronics
14 USB Universal Serial Bus
15 SCSI Small Computer System Interface
16 VGA Visual Graphics Adapter
17 MODEM Modulator Demodulator
18 DVI Digital Video Interface
19 MIDI Musical Instrument Digital Interface
20 DRAM Dynamic Random Access Memory
21 SRAM Static Random Access Memory
22 SDRAM Synchronous Dynamic Random Access Memory
DDR- Double Data Rate Synchronous Dynamic Random Access
23
SDRAM Memory
24 UPS Uninterrupted Power Supply
25 SMPS Switched Mode Power Supply
26 BCNF Boyce Code Normal Form
27 DBMS Database Management System
28 SQL Structured Query Language
29 ISAM Indexed Sequential Access Method
30 DDL Data Definition Language
31 DML Data Manipulation Language
98
32 DCL Data Control Language
33 TCL Transaction Control Language
34 DQL Data Query Language
35 ARPANET Advanced Research Projects Agency Network
36 TCP/IP Transmission Control Protocol/Internet Protocol
37 HTTP Hypertext Transmission Protocol
38 MIME Multipurpose Internet Mail Extensions
39 URI Uniform Resource Identifier
40 FTP File Transfer Protocol
41 SLIP Serial Line Internet Protocol
100