Upload
vikas-saxena
View
275
Download
0
Embed Size (px)
Citation preview
7/29/2019 Class Xii Board Practical Question
1/29
LIST OF PRACTICAL QUESTIONS FOR CLASS XII
1. Define a class named Cricket in C++ with the following descriptions :
private members
Target_scope int
Overs_bowled int
Extra_time intPenalty int
cal_penalty() a member function to calculate penalty as follows :
if Extra_time 10 but
7/29/2019 Class Xii Board Practical Question
2/29
4. Define a class named Serial in C++ with the following descriptions :
private members
serialcode int
title 20 char
duration float
noofepisodes integer
Public members a constructor function to initialize duration as 30 and noofepisodes as 10.
Newserial() function to accept values for serialcode and title.
otherentries() function to assign the values of duration and noofepisodes with the
help of corresponding values passed as parameters to this function.
dispdata() function to display all the data members on the screen.
5. Define a class Competition in C++ with the following descriptions:
Data Members
Event_no integer Description char(30)
Score integer
qualified char
Member functions
A constructor to assign initial values Event_No number as 101,Description as State level Score i
50 , qualified N.
Input() To take the input for event_no,description and score.
Award(int) To award qualified as Y, if score is more than the cutoffscore passed as
argument to the function else N.
Show() To display all the details.
Q6 Write UDF in C++ which accepts an integer array and its size as arguments/ parameters and assign
the elements into a 2 D array of integers in the following format :
if the array is 1,2,3,4,5
The resultant 2D array is given below
1 0 0 0 0
1 2 0 0 0
1 2 3 0 0
1 2 3 4 0
1 2 3 4 5
Q7 Write UDF in C++ to print the row sum and column sum of a matrix A[2][5]
.
Q8 Write UDF in C++ to find a name from a list of names using binary search method.
Q9. Write UDF in C++ to insert an element in a one-dimensional sorted array in such a way that after
insertion the array remains sorted.
Q10. Write UDF in C++ to sort an array in ascending order using bubble sort.
7/29/2019 Class Xii Board Practical Question
3/29
Q11. Write UDF in C++ to sort an array (storing names) in ascending order using insertion sort.
Q12.Write UDF in C++ to sort an array of structures on the basis of admno, in ascending order using
Selection sort.
struct student
{ int admno;
char name[20];
};
Q13. Suppose A, B, C are the array of integers having size m, n, m+n respectively .The elements o
array A appear in ascending order, the elements of array B appear in descending order. Write a UD
in C++ to produce third array C after merging arrays A and B in ascending order. Take the arrays A, B
and C as argument to the function.
Q14.Write a function findsort(),to find whether the given integer Array arr[10] is sorted in ascendin
order or descending order or is not in order. The function should return A for ascending , D fo
descending and N for no order.
Q15.Write a function in C++ which accepts an integer array and its size as arguments/parameters anexchanges the values of first half side elements with the second half side elements of the array.
example : if the array is 8,10,1,3,17,90,13,60 then rearrange the array as 17,90,13,60,8,10,1,3
Q16.Write a function in C++ which accepts an integer array and its size as arguments/parameters an
exchanges the values at alternate locations .
example : if the array is 8,10,1,3,17,90,13,60 then rearrange the array as 10,8,3,1,90,17,60,13
Q17. Write a function in C++ which accepts an integer array and its size as arguments/parameters anreverse the contents of the array without using any second array.
Q18.Write a function in C++ which accepts an integer and a double value as arguments/parameters. Th
function should return a value of type double and it should perform sum of the following series :
x-x2/3! + x3/5! x4/7! + x5/9! upto n terms
Q19. Assume an array E containing elements of structure employee is required to be arranged i
descending order of salary. Write a C++ function to arrange the same with the help of bubble sort , th
array and its size is required to be passed as parameters to the function. Definition of structure Employe
is as follows : struct employee
{
int Eno;char name[25];
float salary;
};
Q20.Given two arrays of integers X and Y of sizes m and n respectively . Write a function name
MERGE() which will produce a third array Z , such that the following sequence is followed .
(a) All odd numbers of X from left to right are copied into Z from left to right.(ii) All even numbers of X from left to right are copied into Z from right to left.
(iii) All odd numbers of Y from left to right are copied into Z from left to right.
(ii) All even numbers of Y from left to right are copied into Z from right to left.
7/29/2019 Class Xii Board Practical Question
4/29
Q21. class stack
{ int data[10];
int top;
public:
Stack( ) { top=-1;}
void push ( ); // to push an element into the stack
void pop ( ) ; // to pop an element into the stack
void display( );// to display all the elements from the stack};
complete the class with all function definition.
Q22. Write a function in C++ to perform a DELETE, insert & Display operation in a dynamically
allocated queue considering the following description:
struct Node
{ float U,V;
Node *Link;
};
class QUEUE{ Node *Rear, *Front;
public:
QUEUE( ) { Rear =NULL; Front= NULL;}
Void INSERT ( );
Void DELETE ( );
~QUEUE ( );
}
Q23. Write a function in C++ to perform a PUSH , pop & Display operation in a dynamically allocate
stack considering the following :Struct Node
{ int X,Y;
Node *Link;
};class STACK
{ Node * Top;
public:
STACK( ) { TOP=NULL;}
void PUSH( );
void Pop( );~STACK( );
};
Q24. Define function stackpush( ) to insert and stackpop( ) to delete and display, for a static circular
queue of array a[10].
Q25.Write a function in C++ to read the content from a text file STORY.TXT, count and display th
number of alphabets present in it and display the count of lines starting with alphabet A.
7/29/2019 Class Xii Board Practical Question
5/29
Q26. Write a function in C++ to read the content from a text file NOTES. TXT, count and display th
number of blank spaces present in it and also count and display the word the appearing in the text.
Q27.Assuming the class EMPLOYEE given below, write functions in C++ to perform the following:-
(i) Write the objects of EMPLOYEE to binary file.
(ii) Reads the objects of EMPLOYEE from binary file and display them on screen.
class EMPLOYEE{
int ENC;
char ENAME[0];
public:
Void GETIT(){ cin>> ENO;gets(ENAME);}
Void SHOWIT() { cout>> ENO
7/29/2019 Class Xii Board Practical Question
6/29
Q32. Given a binary file SPORTS.DAT, containing records of the following structure type:
struct sport
{ char Event[20];
Char Participant[10][30];
};
Write a function in C++ that would read the contents from the file SPORTS.dat and create a fil
named Atheletic.dat copying only those records from sports.dat where the event name
Atheletics.
Q33 class Queue
{ int data[10];
int front, rear;
public:
Queue(){front=rear=0;}
void insert();
void delet();
void display();
};Complete the class with all function definitions:
Q34 WAF sum() in c++ with two arguments, double X and int n. The function should return a value of
type double and it should find the sum of the following series:
1+ X / 2! + X3 / 4! + X5 / 6!+ X7 / 8!+ X9 / 10! ++ X 2n-1 / (2n)!
Q35 WAF check() to check if the passed array of 10 integers is sorted or not. The function should retur1 if arranged in ascending order, -1 if arranged in descending order, 0 if it is not sorted.
Q36 Given the following class:char *info={ over flow,under flow};
class stack
{
int top;
stk[5];
void err_rep(int errornum){cout
7/29/2019 Class Xii Board Practical Question
7/29
Q37. Following is the structure of each record in a data file named Laugh.dat
struct LAUGHTER
{
int idno;
` char Type[5];
char Desc[255];
};
Write a function to update the file with a new value of LaughterType. The value of laughter number anlaughter type are read during the execution of the program.
38) Write a function in C++ which accepts an integer array and its size as arguments / parameters and
then from 1-d array assign the values in 2 d array such that the odd numbers are copied in the first row
and even numbers in the second row of a two dimensional array. The unused cells of two dimensional
array must be filled with 0.
If the array is 1, 2, 3, 4, 5, 6
The resultant 2-D array is given below
1 3 5 0 0 00 0 0 6 4 2
39) Write a function to count the number of house number that are starting with 13 from a text file th
contains house numbers of all students in a school. The file house.txt contains only house numbers as
record.
Example : If the file house.txt contains the following records,
10101
1011313101
13103The function should display the output as 2.
40) Write a function in c++ to read and display the records of computers that cost more than Rs.
20000 from the binary file COMP.DAT, assuming that the binary file is containing the object
of the following class :
class COMPUTER
{ int srno;
char model[25];
float price;
public:float Retpr( ) { return price; }
void Enter( ){ cin>>srno>>price; gets(model); }
void Display( ){ cout
7/29/2019 Class Xii Board Practical Question
8/29
class student
{
int student_no;
char student_name[20];
int mark;
public:
void enterDetails( )
{
cin>> student_no >> mark ; gets(student_name);}
void showDetail( );
int get_mark( ){ return mark;}
};
Assuming a binary file RESULT.DAT contains records belonging to student class, write a
user defined function to separate the records having mark
(i) Greater than 79 into EXCELLENT.DAT file
(ii) Greater than 59 but less than 80 into AVERAGE.DAT file.
(iii)Remaining records should be in RESULT.DAT file.
42) Define a class NUTRITION in C++ with following description:
Private Members:
Access number Integer
Name of Food String of 25 characters
Calories Integer
Food type String
Cost Float
AssignAccess( )Generates random numbers between 0 to 99 and return it.
Public Members A function INTAKE( ) to allow the user to enter the values of Name of Food, Calories, Food typ
cost and call function AssignAccess() to assign Access number.
A function OUTPUT( ) to allow user to view the content of all the data members, if the Food typ
is fruit.
43) Assume an array A containing elements of structure Teacher is required to be arranged in
Descending order of salary. Write a C++ program to arrange the same with the help of selection sort.
The array and its size is required to be passed as parameters to the functions. Definition of structureTeacher is as under:
struct Teacher{
int ID;
char Teacher_name[25];
float Salary;};
44) Define a class Departmental with the following specification :
private data members
7/29/2019 Class Xii Board Practical Question
9/29
Prod_name string (45 charactes) Listprice long
Dis_Price long [ Discount Price] Net long [Net Price ]
Dis_type char(F or N) [ Discount type]
Cal_price() The store gives a 10% discount on every product it sells. However at the time o
festival season the store gives 7% festival discount after 10% regular discount. The discount type ca
be checked by tracking the discount type. Where F means festival and N means Non- festival .Th
Cal_price() will calculate the Discount Price and Net Price on the basis of the following table.
public members
Constructor to initialize the string elements with NULL, numeric elements with 0 and characte
elements with N
Accept() - Ask the store manager to enter Product name, list Price and discount type . The function
will invoke Cal_price() to calculate Discount Price and Net Price .
ShowBill() - To generate the bill to the customer with all the details of his/her purchase along wit
the bill amount including discount price and net price.
45)Write a function in c++ to count the number of capital vowels present in a text file FILE.TXT.
46)Define a class PhoneBill in C++ with the following descriptions.
Private members:
CustomerName of type character array
PhoneNumber of type long
No_of_units of type int
Rent of type int
Amount of type float.
calculate( ) This member function should calculate the value of amount as Rent+ cost for the
units.Where cost for the units can be calculated according to the following conditions.
No_of_units Cost
First 50 calls Free
Next 100 calls 0.80 @ unit
Next 200 calls 1.00 @ unit
Remaining calls 1.20 @ unitPublic members:
* A constructor to assign initial values of CustomerName as Raju, PhoneNumber as
Product Name List Price(Rs.)Washing Machine 12000
Colour Television 17000
Refrigerator 18000
OTG 8000
CD Player 4500
7/29/2019 Class Xii Board Practical Question
10/29
259461, No_of_units as 50, Rent as 100, Amount as 100.
* A function accept ( ) which allows user to enter CustomerName, PhoneNumber, No_of_units
And Rent and should call function calculate ( ).
* A function Display ( ) to display the values of all the data members on the screen.
47) Write a function in C++ which accepts an integer array and its size as arguments/parameters and
assign the elements into a two dimensional array of integers in the following format (size must be odd)
the array is 1 2 3 4 5 or If the array is 10 15 20The output must be the output must be
1 0 0 0 5 10 0 20
0 2 0 4 0 0 15 0
0 0 3 0 0 10 0 20
0 2 0 4 0
1 0 0 0 5
48) Write a function RevText() to read a text file Input.txt and Print only word in reverse order .
Example:
If value in text file is:INDIA IS MY COUNTRY
Output will be:AIDNI SI MY COUNTRY
49) Given the binary file ITEM.DAT, containing the records of the following structure:
class item
{int item_no;
char item_name[20];
int stock;
public:int itmreturn()
{
return item_no;
}
};
Implement the function DelStock(), which delete a record of matching item_no entered through thekeyboard.
50) Write a function in C++ to count and display the no of lines starting with the vowel A having
single character in the file Vowel.TXT.
Example:If the Line contains:
A boy is playing there.
I love to eat pizza.
7/29/2019 Class Xii Board Practical Question
11/29
A plane is in the sky.
Then the output should be: 2
(51) Write a function in c++ to read and display the records of computers that cost more than Rs.
20000 from the binary file COMP.DAT, assuming that the binary file is containing the objects of th
following class :
class COMPUTER
{ int srno;
char model[25];float price;
public:
float Retpr( ) { return price; }
void Enter( ){ cin>>srno>>price; gets(model); }
void Display( ){ cout
7/29/2019 Class Xii Board Practical Question
12/29
55)Define a class named PRODUCT in C++ with following description: 4
Private Members:
P_NO // Product number P_Type // Product Type
P_Name // Product Name
P_Price // Product Price
A function Get_Prod ( ) to set the price of the product according to the following:
For the value of P_Type MobileP_Name P_Price
SONY 15000
SAMSUNG 13000
For P_Type other than Mobile
P_Price gets included 14% Extra charge for installation.
Public Members:
A constructor to assign initial values of P_NO, P_Type and P_Name as NOT ASSIGNED and
P_Price as 0.
A function Get_Info( ) to input the values of P_NO, P_Name and P_Type and also invoke Get_Prod
) function.
A function Disp_Info( ) to display the value of all the data members.
56) Define a class Society with the following specifications.
Private Members :
society_name char (30)house_no integer
no_of_members integer
flat char(10)
income float
Public members:
A constructer to assign initial values of society_name as Mahavir Nagar, flat as A Type, house_noas 56, no_of_members as 6, income as 50000.
input( ) to read data members.
alloc_flat( ) To allocate flat according to incomeincome >=50000 - Flat A Type
income >=25000 and income
7/29/2019 Class Xii Board Practical Question
13/29
If the content of the file FUNCTION.TXT is as follows:
The school function is taking place in December. Our school has participated in many inter- scho
events. The school life is the best.
The function Total() should display the following:
Total number of word school:4
58) Define a class Movie in C++ with following description:
Private Members
Mcode //Data member for Movie codeType //Data member for the type of Movie
Rating //Data member for Movie critic rating
Collections //Data member for movie collections per day
Assign() //A function to assign Rating a value based on Collections as follows:
Collections Rating
1000000 && 5500000 4****
Public Members
Read() //A function to enter value of Mcode,Type and Collections . It will invoke Assign()
function.
Display() //A function to display Mcode,Type,Rating and Collections
Ret_Rating() //A function to return value of Rating
(59)Write function definition for Sales( ) in C++ to read and display the details of the regions having asale of 20000 or more from a binary file COMPANY.DAT which contains objects of the following
class.class Company
{
int Id; //Region id
char C_Name[20]; //Company Namechar Region[30]; //Region(South,North,East, West)
float Sales; //total sales
public:
void Accept_Val(); //Function to enter the details
void Show_Val(); //Function to display the details
float RSales(){return Sales;}};
60) WAF which is passed a character pointer and that function should reverse the string.
7/29/2019 Class Xii Board Practical Question
14/29
(1) Study the following tables STAFF and SALARY and write SQL commands for the questio
(i) to (iv) and give output for SQL queries (v) to (vi)
Relation : STAFF
ID NAME DOJ DEPT SEX QUALF
10
1Siddharth 12/01/02 Sales M MBA
10
4Raghav 8/05/88 Finance M CA
10
7Naman 14/05/88 Research M MTECH
11
4Nupur 1/02/03 Sales F MBA
10
9 Janvi 18/7/04 Finance F ICWA10
5Rama 14/4/07 Research M BTECH
11
7Jace 27/6/87 Sales F MTECH
11
1Binoy 12/1/90 Finance M CA
13
0Samuel 7/3/99 Sales M MBA
18
7 Ragini 12/12/02 Research F BTECHrelation : SALARY
ID BASIC ALLOWANCE COMM_PERC
10
115240 5400 3
10
423000 1452 4
10
714870 2451 3
11
4 21000 3451 1410
924500 1452 10
10
517000 1250 2
11
712450 1400 3
11
113541 3652 9
13 25000 4785 15
7/29/2019 Class Xii Board Practical Question
15/29
0
18
714823 5862 2
i) Display the name of all CAs who are working for more than 5 years
ii) Display the number of staff joined year-wiseiii) Hike the Allowance of all female staff working in finance sector and joined the company
before 2000
iv) Display the average salary given to the employee in each departmentv) SELECT DEPT, COUNT(*)
FROM STAFF
WHERE SEX=mGROUP BY DEPT
HAVING COUNT(*) >2;
vi) SELECT AVG(BASIC+ ALLOWANCE), QUALF
FROM SALARY S1, STAFF S2
WHERE S1.ID=S2.ID
GROUP(QUALF) ;
vii) SELECT DISTINCT QUALF FROM STAFF;viii) SELECT NAME, BASIC+ALLOWANCE
FROM STAFF S, SALARY SA
2) Consider the following tables SCHOOL and ADMIN. Write SQL commands for the statement
(i) to (iv) and give outputs for SQL queries (v) to (viii).
SCHOOL
CODE TEACHERNAME SUBJECT DOJ PERIOD
S
EXPERIENC
E
1001 RAVISHANKAR
ENGLISH 12/03/2000 24 10
1009 PRIYA RAI PHYSICS 03/09/1998 26 12
1203 LISA ANAND ENGLISH 09/04/2000 27 5
1045 YASHRAJ MATHS 24/08/2000 24 15
1123 GANAN PHYSICS 16/07/1999 28 3
1167 HARISH B CHEMISTRY 19/10/1999 27 5
1215 UMESH PHYSICS 11/05/1998 22 16
ADMIN
CODE GENDER DESIGNATION1001 MALE VICE PRINCIPAL
1009 FEMALE COORDINATOR
1203 FEMALE COORDINATOR
1045 MALE HOD
1123 MALE SENIOR TEACHER
1167 MALE SENIOR TEACHER
1215 MALE HOD
i) To display TEACHERNAME, PERIODS of all teachers whose periods less than 25.
7/29/2019 Class Xii Board Practical Question
16/29
ii) To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and ADMIN
whose gender is male.
iii) To display the TEACHERNAME subject wise.
iv) To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the school afte
01/01/1999.
v) SELECT MAX (EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY SUBJECT;
vi) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE DESIGNATION =
COORDINATOR AND SCHOOL.CODE=ADMIN.CODE;
vii) SELECT DESIGNATION, COUNT (*) FROM ADMIN GROUP BY DESIGNATION HAVING
COUNT (*)
7/29/2019 Class Xii Board Practical Question
17/29
(iii) Display total fare of all the airlines.
(iv) To display departure and arrival points of flight no 1C302 and MU499.
Give the Output:
(v) SELECT COUNT(DISTINCT FL_NO) FROM FLIGHT;
(vi) SELECT MIN(NOOFSTOPS) FROM FLIGHT
WHERE FL_NO = IC899;
(vii) SELECT AVG(FARE) FROM FARE
WHRE AIRLINES = Indian Airlines;
(viii) SELECT FL_NO, NO_FLIGHTS FORM FLIGHTWHERE DEPARTURE=MUMBAI;
4) Consider the following tables CUSTOMER and MOBILE. Write SQL commands for the
statements (i) to (iv) and give outputs for SQL queries (v) to (viii)
(i) To display the records of those customer who take the connection of Bsnl and Airtel
7/29/2019 Class Xii Board Practical Question
18/29
in ascending order of Activation date.
(ii) To decrease the amount of all customers of Reliance connection by 500.
(iii) Count the no. of companies giving connection from CUSTOMER table whose name starts with P
(iv) To display the ID and Cname from table Customer and Make from table Mobile,
with their corresponding matching ID.
(v) select Cname , Make form Customer, Mobile where Customer.ID = Mobile.ID;
(vi) select Connection , sum(Amount) from Customer group by Connection ;
(vii) SELECT COUNT(DISTINCT Make) FROM Mobile; .
(viii) SELECT AVG(Amount) FROM Customer where Validity >= 180;
5) Consider the following tables ARTIST and GALLERY. Write SQL commands for the statements
(C1) 6 to (C4) and give outputs for SQL queries (D1) to (D4)
1. To display A_NAME(Artist Name) and TITLE of all Modern type paintings from table ARTIST
2. To display the details of all the Artists in descending order of TITLE within TYPE from table
7/29/2019 Class Xii Board Practical Question
19/29
3. To display the A_NAME, G_NAME and Date of Display (D_OF_DISPLAY) for all the Artists
who are having a display at the gallery from the tables ARTIST and GALLERY.
4. To display the highest price of paintings in each type from table ARTIST
5. SELECT A_NAME, TITLE, PRICE FROM ARTIST WHERE PRICE BETWEEN 120000 AND
300000;
6. SELECT DISTINCT TYPE FROM ARTIST ;
7. SELECT MAX(FEES),MIN(D_OF_DISPLAY) FROM GALLERY;
8. SELECT COUNT(*)FROM ARTIST WHERE PRICE
7/29/2019 Class Xii Board Practical Question
20/29
(d) To insert a new row in the GRADUATE table:
11,KAJOL, 300, computer sc, 75, 1
(e) Give the output of following sql statement based on table GRADUATE:
(i) Select MIN(AVERAGE) from GRADUATE where SUBJECT=PHYSICS;
(ii) Select SUM(STIPEND) from GRADUATE WHERE div=2;
(iii) Select AVG(STIPEND) from GRADUATE where AVERAGE>=65;
(iv) Select COUNT(distinct SUBDJECT) from GRADUATE;
(f) Assume that there is one more table GUIDE in the database as shown below:
Table: GUIDE
g) What will be the output of the following query:
SELECT NAME, ADVISOR FROM GRADUATE,GUIDE WHERE SUBJECT=
MAINAREA;
Q7.
Employees
Empid Firstname Lastname Address City
010 Ravi Kumar Raj nagar GZB
105 Harry Waltor Gandhi nagar GZB
152 Sam Tones 33 Elm St. Paris
215 Sarah Ackerman 440 U.S. 110 Upton
244 Manila Sengupta 24 Friendsstreet
New Delhi
300 Robert Samuel 9 Fifth Cross Washington
335 Ritu Tondon Shastri Nagar GZB
400 Rachel Lee 121 Harrison
St.
New York
441 Peter Thompson 11 Red Road Paris
EmpSalary
MAINAREA ADVISOR
PHYSICS VINOD
COMPUTER SC ALOK
CHEMISTRY RAJAN
MATHEMATICS MAHESH
7/29/2019 Class Xii Board Practical Question
21/29
Empid Salary Benefits Designation
010 75000 15000 Manager
105 65000 15000 Manager
152 80000 25000 Director
215 75000 12500 Manager
244 50000 12000 Clerk
300 45000 10000 Clerk
335 40000 10000 Clerk
400 32000 7500 Salesman
441 28000 7500 salesman
Write the SQL commands for the following :
(i) To show firstname,lastname,address and city of all employees living in paris
(ii) To display the content of Employees table in descending order of Firstname.
(iii) To display the firstname,lastname and total salary of all managers from the tables Employee
and empsalary , where total salary is calculated as salary+benefits.
(iv) To display the maximum salary among managers and clerks from the table Empsalary.
Give the Output of following SQL commands:
(i) Select firstname,salary from employees ,empsalary where designation = Salesman and
Employees.empid=Empsalary.empid;
(ii) Select count(distinct designation) from empsalary;
(iii) Select designation, sum(salary) from empsalary group by designation having count(*) >2;
(iv) Select sum(benefits) from empsalary where designation =Clerk;
Q8 . Write the SQL commands for the following on the basis of tables INTERIORS and NEWONES
Table: INTERORS
SNO ITEMNAME TYPE DATEOFSTOC
K
PRIC
E
DISCOUNT
1 Red Rose Double Bed 23/02/02 32000 15
2 Soft Touch Baby Cot 20/1//02 9000 10
3 Jerrys Home Baby Cot 19/02/02 8500 10
4 Rough Wood Office Table 01/01/02 20000 205 Comfort Zone Double Bed 12/01/02 15000 20
6 Jerry Look Baby Cot 24/02/02 7000 19
7 Lion King Office Table 20/02/02 16000 20
8 Royal Tiger Sofa 22/02/02 30000 25
9 Park Sitting Sofa 13/12/01 9000 15
10 Dine Paradise Dining Table 19/02/02 11000 15
Table: NEWONES
SN ITEMNAME TYPE DATEOFSTO PRIC DISCOUN
7/29/2019 Class Xii Board Practical Question
22/29
O CK E T
11 White Wood Double Bed 23/02/02 20000 20
12 James 007 Sofa 20/02/03 15000 15
13 Tom Look Baby Cot 21/02/03 7000 10
(i) To list the ITEMNAME which are priced at more than 1000 from the INTERIORS table
(ii) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before 22/01/02
from the INTERIORS table in descending order of ITEMNAME
(iii) To show all information about the sofas from the INTERIORS table
(iv) To display ITEMNAME and DATEOF STOCK of those items in which the discountpercentage is more than 15 from INTERIORS table
(v) To count the number of items, whose type is Double Bed from INTERIORS table
(vi) To insert a new row in the NEWONES table with the following data
14,True Indian, Office Table, 28/03/03,15000,20
(vii) Get the Output (Use the above table without inserting the record)
a) Select COUNT(distinct TYPE) from INTERIORS
b) Select AVE(DISCOUNT) from INTERIORS where TYPE=Baby Cot
c) Select SUM(Price) from INTERIORS where DATEOF STOCK
7/29/2019 Class Xii Board Practical Question
23/29
F01 2
C01 6
T02 3
1. To list the names from books of Text type.
2. To display the names and price from books in ascending order of their price.
3. To increase the price of all books of EPB publishers by 50.
4. To display the Book Name, Quantity_Issued and Price for all books of EPB publishers.
5. Select max(price) from books;
6. Select count(DISTINCT Publishers) from books where Price >=400;
7. Select Book_Name, Author_Name from books where Publishers = First;
8. Select min(Price) from books where type = Text;
10. Consider the following tables FACULTY and COURSES. Write SQL commands for the statements
(i)
to (iv) and give outputs for SQL queries (v) to (viii)
7/29/2019 Class Xii Board Practical Question
24/29
(i) To display details of those Faculties whose date of joining is before 31-12-2001.
(ii) To display the details of courses whose fees is in the range of 15000 to 50000 (both values included
(iii) To increase the fees of Dreamweaver course by 500.
(iv) To display F_ID, Fname, Cname of those faculties who charged more than15000 as fees.
(v) Select COUNT(DISTINCT F_ID) from COURSES;
(vi) Select MIN(Salary) from FACULTY,COURSES where COURSES.F_ID = FACULTY.F_ID;
(vii) Select SUM(Fees) from courses Group By F_ID having count(*) > 1;
(viii) Select Fname, Lname from FACULTY Where Lname like M%;
11.
7/29/2019 Class Xii Board Practical Question
25/29
(i) To display the name of all Games with their Gcodes
(ii) To display details of those games which are having PrizeMoney more than 7000.(iii) To display the content of the GAMES table in ascending order of ScheduleDate.
(iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in
column Number 2 or 4)
(v) SELECT COUNT(DISTINCT Number) FROM GAMES;
(vi) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES;(vii) SELECT SUM(PrizeMoney) FROM GAMES;
(viii) SELECT DISTINCT Gcode FROM PLAYER;
Q12.
7/29/2019 Class Xii Board Practical Question
26/29
(i) Display FirstName and City of Employee having salary between 50,000 and 90,000
(ii) Display details of Employees who are from PARIS city.
(iii) Increase the benefits of employee having W_ID = 210 by 500.(iv) Count number of employees whose name starts from character S.
(v) Select MAX(salary) from desig(vi) Select FirstName from employee, desig
where designation = MANAGER AND employee.W_ID = desig.W_ID;
(vii) Select COUNT (DISTINCT designation) from desig;
(viii) Select designation, SUM(salary) from desig
Group by designation Having count (*) > 2;
Q13
7/29/2019 Class Xii Board Practical Question
27/29
Write the SQL commands:-
(i) To display Firstname, Lastname, Address and City of all employees living
in ND from the table EMPLOYEES.
(ii) To display the contents of EMPLYEES table in descending order offirstname.
(iii) To display the firstname, lastname, and Total Salary of all mangers from
the table EMPLOYEES and EMPSALARY. Where total salary is
calculate as Salary + Benefits.
(iv) To display the maximum salary among Managers and Clerks from
EMPSALARY.(v) Write the output of the following:-
(a) Select COUNT (DISTINCT DESIGNATION) FROM
EMPSALARY.
(b) Select firstname, salary from EMPLOYEES, EMPSALARY
WHERE Designation = Salesman
AND EMPLOYEES. Emid = EMPSALARY. Emid.(c) Select designation. Sum (salary) from EMPSALARY Group ByDesignation Having Count (*)>2;
(d) Select SUM (Benefits) from EMPLOYEES where designation =clerk;Consider the following tables Product and Clint. Write SQL commands for the statement (i) to (iv) and give outputs for
SQL queries (v) to (viii)
7/29/2019 Class Xii Board Practical Question
28/29
Table: PRODUCT
P_ ID
ProductName Manufac
turer
Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95
Table:CLIN
T C_ID ClientName City P_ID
01 Cosmetic Shop Delhi FW05
06 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty Woman Delhi FW12
16 Dreams Banglore TP01
(i) To display the details of those Clients whose City is Delhi.
(ii) To display the details of Products Whose Price is in the range of 50 to 100(Both values included).
(iii) To display the ClientName, City from table Client, and ProductName and Price from table Product, with their
corresponding matching P-ID.
(iv) To increase the Price of all Products by 10.
(v) SELECT DISTINCT City FROM Client;
(vi) SELECT Manufacturer, MAX(Price), Min(Price), Count(*) FROM Product GROUP BY Manufacturer;
(vii) SELECT ClientName, ManufacturerName FROM Product, Client WHERE Client.Prod-ID=Product.P_ID;
(viii) SELECT ProductName, Price * 4 FROM Product;
7/29/2019 Class Xii Board Practical Question
29/29
Consider the following tables item and Customer. Write SQL Commands for the statement (i) to (iv) and give outputs fo
SQL queries (v) to (viii).
Table: ITEM
I_ID
ItemName Manufa
cture
Price
PC01 Personal Computer ABC 35000
LC05 Laptop ABC 55000
PC03 Personal Computer XYZ 32000
PC06 Personal Computer COMP 37000
LC03 Laptop PQR 57000
Table: CUSTOMER
C_ID CustomerName City l_ID
01 MRS REKHA Delhi LC03
06 MANSH Mumbai PC03
12 RAJEEV Delhi PC06
15 YAJNESH Delhi LC03
16 VIJAY Banglore PC01
(i) To display the details of those customers whose city is Delhi.
(ii) To display the details of item whose price is in the range of 35000 to 55000 ( both values included)
(iii) To display the customer name, city from table Customer, and itemname and price from table Item, with their
corresponding matching I_ID.
(iv) To increase the price of all items by 1000 in the table Item.
(v) SELECT DISTINCT City FROM Customer;
(vi) SELECT ItemName, MAX(Price), Count(*) FROM Item GROUP BY ItemName;
(vii) SELECT CustomerName, Manufacturer FROM Item, Customer WHERE Item.Item_Id=Customer.Item_Id
(viii) SELECT ItemName, Price* 100 FROM Item WHERE Manufacture= ABC;