AISSCE XII Informatics Practices 065 – Practical Question Paper Set #1 – Download Word File
All India Senior Secondary Certificate Examination
XII Informatics Practices 065- Practical Question Paper Set #1
Answer Key of Set 1 Practical Examination Question Paper
Q1. Problem Solving using PYTHON [5 + 3 = 8]
- Write the code to create the series ‘serObj’ and answer the questions followed. (5)
Jan 31
Feb 28
Mar 31
Apr 30
- Write the command to add one row: ‘May’ – 31
- Write the command to update Feb to 29
- Write the command to change index to 1,2,3,4,5 in place of Jan, Feb, Mar, Apr and May.
- Write a command to print a month name having number of days less than 31.
- Write the output:
- print(serObj < 30)
- print(serObj + 3)
Answer: import pandas as pd # importing pandas
serObj = pd.Series([31,28,31,30], index=[‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’]) # creating series
>>> serObj
Jan 31
Feb 28
Mar 31
Apr 30
dtype: int64
(i) serObj[‘May’] = 31 # Adding one more row
>>> serObj
Jan 31
Feb 28
Mar 31
Apr 30
May 31
dtype: int64
(ii) serObj[‘Feb’] = 29 # Updating value of Feb
>>> serObj
Jan 31
Feb 29
Mar 31
Apr 30
May 31
dtype: int64
(iii) serObj.index = [1, 2, 3, 4, 5] # to change the month name
>>> serObj
1 31
2 29
3 31
4 30
5 31
dtype: int64
(iv) serObj.index = [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’] # to change the month name
serObj[serObj < 31].index
Index([‘Feb’, ‘Apr’], dtype=’object’)
(iv) Output
(a) print(serObj < 30)
Jan False
Feb True
Mar False
Apr False
May False
dtype: bool
(b) print(serObj + 3)
Jan 34
Feb 32
Mar 34
Apr 33
May 34
dtype: int64
(b) Write a Python program to display a BAR CHART of the number of students in a school. (3)
- Use different colors for each bar.
- Title for x axis should be ‘Groups’ and title for y axis should be ‘Number of Students’
- 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
Answer:
import matplotlib.pyplot as plt
Group = [‘I’, ‘II’, ‘III’, ‘IV’]
Strength = [38,30,45,49]
plt.bar(Group, Strength, color=[‘red’, ‘green’, ‘blue’, ‘black’])
plt.xlabel(‘Group’)
plt.ylabel(‘Number of Students’)
plt.title(“Group wise Students”)
plt.grid(True)
plt.show()
Output:
Q2 SQL Queries: [2+5=7]
- Create a table DRUGDB with the fields given in above table and assuming data type of your own.
- Consider the table DRUGDB. Write the SQL commands for queries given below:
- To increase the price of “Paracetamol” by 35.
- To display the drugid, Rxid and pharmacy name of all records in descending order of their price.
- Display all the details of the drugs where name starts with ‘C’ and has ‘sh’ somewhere in the name.
- Display the drug name in lower case along with price rounded off to nearest interger.
- Delete the field name loc from drugdb table.
Answer:
(a) CREATE TABLE DRUGDB (
RxID CHAR(10) PRIMARY KEY,
DrugID INTEGER,
Drugname VARCHAR(30),
Price DECIMAL(10,2),
PharmacyName VARCHAR(40),
Loc VARCHAR(20)
);
(b) SQL Commands
(i) UPDATE DRUGDB SET price = price + 35 WHERE Drugname = ‘PARACETAMOL’;
(ii) SELECT DRUGID, RXID, PHARMACYNAME
FROM DRUGDB
ORDER BY PRICE DESC;
(iii) SELECT * FROM DRUGDB WHERE DRUGNAME LIKE ‘C%SH%’ ;
(iv) SELECT LOWER(DRUGNAME), ROUND(PRICE, 0) FROM DRUGDB ;
(v) ALTER TABLE DRUGDB DROP LOC;