12 Ip Model To Print
12 Ip Model To Print
b) Write a Python program to display a BAR CHART of the number of students in a school. (3)
(i) Use different colors for each bar.
(ii) Title for x axis should be ‘Groups’ andtitle for y axis should be ‘Number of
Students’
(iii) Ensure the title of chart is “Group wise Students” and grid line must be shown.
Sample data: Group: I,II,III,IV and Strength: 38,30,45,49
a) Create a table DRUGDB with the fields given in below table and assuming data type
of your own.
b) Consider the table DRUGDB. Write the SQL commands for queries given below:
(i) To increase the price of “Paracetamol” by 35.
(ii) To display the drugid,Rxid and pharmacy name of all records in descending order of
their price.
(iii) Display all the details of the drugs where name starts with ‘C’ and has ‘sh’ somewhere
in the name.
(iv) Display the drug name in lower case along with price rounded off to nearest interger.
(v) Delete the field name loc from drugdb table.
B1. Problem Solving using PANDAS & MATPLOTLIB [5 + 3 = 8]
a) Write the code to create a DataFrame ‘df’ and answer the questions followed. (5)
Maths Science SST
Amit 100 100.0 60.0
Mohan 95 50.0 57.48
Sudha 85 90.0 53.58
Write the commands in SQL for (i) to (vi) and output for (vii) and (viii).
(i) To list the names of items and their unit price that have unit priceless than 800 and discount
more than 5%.
(ii) To display the number of items that have more than 10% as discount.
(iii) To display item code and unit price in decreasing order of unit price.
(iv) To increase the unit price of each item by 10% of their unit price.
(v) To display the highest unit price of items.
(vi) To display the names of items that have ‘Baby’ anywhere in their item names.
Find Output :
(vii) SELECT MID (Item,1,2) FROM Infant;
SELECT AVG(UnitPrice) FROM Infant WHERE DATEPURCHASE ‘2015–01–01’;
C1. Problem Solving using PANDAS & MATPLOTLIB [5+3=8]
a) Write the code to create a DataFrame ‘RESULT’ and answer the questions followed. (5)
Col1 Col2 Col3
T1 100.0 100.0 60.0
T2 95.8 100.0 57.48
T3 NaN 100.0 53.58
T4 82.0 85.4 49.20
i) Write a command to add one column Total = col1+col2+col3
ii) Write a command to add one row T5 with values 75.6, 98.6, 56.0
iii) Write a command to change the column names Col1 to Maths, Col2 to Science, Col3 to
SST.
iv) Write a command to print Score of Moths and Science only.
v) Write a command to update a value of T3 Row and Col1 / update NaN to 85.0
b) Write a Python program to display the Result using a LINE PLOT (table is given in Q1 (a) )
(3)
Maths Science SST
Amit 100 100.0 60.0
Mohan 95 100.0 57.48
Sudha 85 100.0 53.58
(i) Set the title of graph is “Result Analysis”
(ii) Display the legends.
(iii) Display the label of x axis to “Name” and y axis to “Score”
C2. SQL Queries:-Consider the following tables CARDEN. Write SQL commands for the
following statements.
vi) Write a command to add one column Total = Maths+ Science + SST
vii) Write a command to add one row T5 with values 75.6, 98.6, 56.0
viii) Write a command to print Score of Maths and Science only.
ix) Write a command to updatemarks of Science of Sudha to 85.0
x) Write a command to delete a row - Mohan
c) Write a Python program to display the given Result using a BAR CHART (3)
Maths Science SST
Amit 100 100.0 60.0
Mohan 95 100.0 57.48
Sudha 85 100.0 53.58
(i) Set the title of graph is “Result Analysis”
(ii) Display the legends.
(iii) Display the label of x axis to “Name” and y axis to “Score”
D2 SQL Queries: [7]
Write the commands in SQL for (i) to (vi) and output for (vii) and (viii).
(viii) To list the names of items and their unit price that have unit priceless than 800 and discount
more than 5%.
(ix) To display the number of items that have more than 10% as discount.
(x) To display item code and unit price in decreasing order of unit price.
(xi) To increase the unit price of each item by 10% of their unit price.
(xii) To display the highest unit price of items.
(xiii) To display the names of items that have ‘Baby’ anywhere in their item names.
Find Output :
(xiv) SELECT MID (Item,1,2) FROM Infant;
(xv) SELECT AVG(UnitPrice) FROM Infant WHERE DATEPURCHASE ‘2015–01–01’;
E1. Problem Solving using PANDAS & MATPLOTLIB [5+3=8]
a) Write the code to create a DataFrame ‘RESULT’ and answer the questions followed. (5)
Col1 Col2 Col3
T1 100.0 100.0 60.0
T2 95.8 100.0 57.48
T3 NaN 100.0 53.58
T4 82.0 85.4 49.20
i) Write a command to add one column Total = col1+col2+col3
ii) Write a command to add one row T5 with values 75.6, 98.6, 56.0
iii) Write a command to change the column names Col1 to Maths, Col2 to Science, Col3 to
SST.
iv) Write a command to print Score of Moths and Science only.
v) Write a command to update a value of T3 Row and Col1 / update NaN to 85.0
b) Write a Python program to display the Result using a LINE PLOT (table is given in Q1 (a) )
(3)
Maths Science SST
Amit 100 100.0 60.0
Mohan 95 100.0 57.48
Sudha 85 100.0 53.58
(iv) Set the title of graph is “Result Analysis”
(v) Display the legends.
(vi) Display the label of x axis to “Name” and y axis to “Score”
E2. SQL Queries:-Consider the following tables CARDEN. Write SQL commands for the
following statements.
Draw the following bar graph representing the number of students in each class.
F2. SQL Queries:-Write the SQL Commands to perform the following:- [7]
i) Create a student table with the student_id, name, and marksas attributes where
the student_id is the primary key.
ii) Insert the details of a new student in the above table.
iii) Delete the details of a student in the above table.
iv) Use the select command to get the details of the students with marks more than 80.
v) Write a SQL query to display names into capital letters, small letters, display first
3 letters of name, display last 3 letters of name, display the position the letter 'A' in
name.
vi) Remove extra spaces from left, right and both sides from the text –
“Informatics Practices Class XII”.
vii) Display dayname, monthname, day, dayname, day of month, day of year for today’s
date.
G1. Problem Solving using PANDAS & MATPLOTLIB [5+3=8]
A. Write a program in Python Pandas to create the following DataFrame batsman from a
Dictionary: (5)
B_NO Name Score1 Score2
1 Sunil Pillai 90 80
2 Gaurav Sharma 65 45
3 PiyushGoel 70 90
4 Kartik Thakur 80 76
Perform the following operations on the DataFrame :
i) Add both the scores of a
batsman and assign to column
“Total”
ii) Display the highest score in
both Score1 and Score2 of
the DataFrame.
iii) Display the DataFrame.
iv) Display the details of PiyushGoel
statements.
m) To display the names of all Silver colored Cars.
n) To display name of car, Company and capacity of Cars in descending order of their
seating capacity
o) To display the highest charges at which a vehicle can be hired from Carden.
p) To increase the charges by 5% for Suzuki company
q) Write a SQL query to display CarName and Company together of those cars which
name are having 'n' at anywhere or charges greater than 14
r) Write output for the following MYSQL queries:-
(v) SELECT LEFT(CarName, 3) FROM CARDEN;
(vi) SELECT MID(CarName, 2,3) FROM CARDEN;
(vii) SELECT POW(CAPACITY, 2) FROM CARDEN WHERE CHARGES IN
(12,14);
(viii) SELECT MAX(CHARGES), COMPANY FROM CARDEN GROUP BY
COMPANY;