Worksheets For IP
Worksheets For IP
PAGE NO.
UNIT UNIT NAME
NO.
FROM TO
4|Page
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP NAME OF CHAPTER: Series
TOPIC: Series (Create Series, Access element, Filter value)
WORKSHEET NO. 1
QN. Questions M
1 Write a program to create a series to print scalar value “5” four times. 2
2 Write a program to create a series object F1 using a dictionary that stores 2
the number of furniture in each lab of your school.
Note: Assume four furniture names are Table, Sofa, Chair and stool having
40, 2,45,26 items respectively and pandas library has been imported as pd.
3 What will be the output of the following code: 1
import pandas as pd
L= [9,10,12]
S=pd.Series(L)
Dbl=pd.Series(data = S*2)
print(“New Series: “)
print(Dbl)
4 Write a program to create a series object using a dictionary that stores the 2
number of students in each house of CLASS 12D of your school.
Note: Assume four house names are Beas, Chenab, Ravi and Satluj having
18, 2, 20, 18 students respectively and pandas library has been imported
as pd.
5 What will be the output of the following code: 1
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>print(A==data)
What will be the output:
a. True b. False c. [35,45,55,40] d. Error
6 Find the output of following program. import numpy as np 1
d=np.array([10,20,30,40,50,60,70])
print(d [-4:])
7 What will be the output of the following code: 1
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>print (A[A>45])
8 Write the output of the given command: import pandas as pd 1
s=pd.Series([1,2,3,4,5,6],index=['A','B','C','D','E','F'])
print(s[s%2==0])
9 What will be the output of the following code: 1
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>print ([A>45])
10 What will be the output of the following code: 1
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>A[2:5]=25
>>>print (A)
11 Write a program to create a series object comp using a list that stores the 2
number of quantity of computer item in lab of your school. Note: Assume four
computer item names as index are KB, Mouse, computer and printer
havingvalues are 30, 25, 20, 2 items respectively and pandas library has been
imported as pd.
6|Page
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: Series
TOPIC: Series Attribute and methods
WORKSHEET NO. 2
Q. Questions M
No
1 Which attribute is used to get total number of elements in a Series? 1
a. size b. itemsize
c. shape d. ndim
2 To display last five rows of a series object ‘S’, you may write: 1
a. S.Head()
b. S.Tail(5)
c. S.Head(5)
d. S.tail()
3 To display top five rows of a series object ‘S’, you may write: 1
a. S.head()
b. S.Tail(5)
c. S.Head(5)
d. S.tail()
4 _________________method in Pandas can be used to change the index 1
of rows and columns of a Series or DataFrame:
(i) rename() (ii) reindex() (iii) reframe() (iv) none of the above
5 CSV stands for ______________ 1
6 Pandas Series is: _____ 1
a. 2-Dimensional b. 3-Dimensional c. 1 Dimensional d. Multidimensional
7 Python pandas was developed by:___________ 1
a. Guido van Rossum b. Travis Oliphant
c. Wes McKinney d. Brendan Eich
8 The command to install the pandas is: 1
a. install pip pandas b. install pandas
c. pip pandas d. pip install pandas
9 The name “Pandas” is derived from the term: 1
a. Panel Data b. Panel Series
c. Python Document d. Panel Data Frame
10 We can analyse the data in pandas with 1
a. Series b. Data Frame
c. Both of the above d. None of the above
11 Pandas is a: __________ 1
a. Package b. Language
c. Library d. Software
12 Which of the following import statement is not correct? 1
a. import pandas as CLASS12 b. import pandas as 1pd
c. import pandas as pd1 d. import pandas as pd
13 Which of the following is not an attribute of pandas data frame? 1
a. length b. T
c. Size d. shape
14 import pandas as pd 1
s=pd.Series([1,2,3,4,5], index=['akram','brijesh','charu','deepika','era'])
8|Page
print(s['charu'])
a. 1 b. 2 c. 3 d. 4
15 Assuming the given series, named stud, which command will be used to 1
print 5 as output?
Amit 90
Ramesh 100
Mahesh 50
john 67
Abdul 89
Name: Student, dtype: int64
a. stud.index b. stud.length
c. stud.values d. stud.size
16 A social science teacher wants to use a pandas series to teach about Indian 1
historical monuments and its states. The series should have the monument
names as values and state names as indexes which are stored in the given
lists, as shown in the code. Choose the statement which will create the
series:
import pandas as pd
Monument=['Qutub Minar','Gateway of India','Red Fort','Taj Mahal']
State=['Delhi','Maharashtra','Delhi','Uttar Pradesh']
a. S=df.Series(Monument, index=State)
b. S=pd.Series(State, Monument)
c. S=pd.Series(Monument, index=State)
d. S=pd.series(Monument, index=State)
17 Difference between loc() and iloc().: 1
a. Both are Label indexed based functions.
b. Both are Integer position-based functions.
c. loc() is label-based function and iloc() integer position-based function.
d. loc() is integer position-based function and iloc() index position-based
function.
18 Method or function to add a new row in a Series is: 1
a. .locate() b. .loc()
c. join d. add()
19 Rasha wants to set all the values to zero in Series, choose the right 1
command to do so:
a. S1=0 b. S1[]=0
c. S1[:]=0 d. S1[:]==0
20 Write the output of the given program: import pandas as pd 1
S1=pd.Series([5,6,7,8,10],index=['v','w',' x','y','z'])
Output required (5,)
a. print(S1.shape()) b. print(S1.shape)
c. print(S1.values) d. print(S1.size())
21 To check if the Series object contains NaN values, attribute is display. 1
a. hasnan b. nbytes
c. ndim d. hasnans
***
9|Page
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: Series
TOPIC: Vector operation, slicing
WORKSHEET NO. 3
QN Questions M
.
1 Consider the following series named animal: 2
dtype: object
Write the command that generates the output as:
2 Green
4 Yellow
dtype: object
6 What will be the output of the given code? 2
import pandas as pd
s=pd.Series([3,6,9,12,14],index=['a','
b','c','d','e']) print(s[‘a’]+s[‘c’])
11 | P a g e
7 2
TOTAL
***
12 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: DATA FRAME
TOPIC: CREATE DATA FRAME by various method
Remove row and column of DataFrame
WORKSHEET NO. 4
QN Questions M
1 Write a Python code to create a DataFrame stock with appropriate 2
column headings from the list given below:
[[101,'Gurman',98], [102,'Rajveer',95], [103,'Samar' ,96],
[104,'Yuvraj',88]]
15 | P a g e
import pandas as pd
Year1={'Q1':5000,'Q2':8000,'Q3':12000,'Q4': 18000}
Year2={'A' :13000,'B':14000,'C':12000}
totSales={1:Year1,2:Year2}
df=pd.DataFrame(totSales)
print(df)
8 Consider the given DataFrame ‘Stock’: 4
Name Price
0 Nancy Drew 150
1 Hardy boys 180
2 Diary of a wimpy kid 225
3 Harry Potter 500
Write suitable Python statements for the following:
i. Add a column called Special_Price with the following
data: [135,150,200,440].
ii. Add a new book named ‘The Secret' having price 800.
iii. Remove the column Price.
iv.Remove first and third rows from DataFrame
9 Consider the given DataFrame df: 4
Q1 Q2 Q3 Q4
0 5000 8000 12000 18000
1 10 20 30 40
Write suitable Python statements for the following:
i. Add a column called Q5 with the following data:
[2000,44].
ii. Add a new record with appropriate values.
iii. Remove the column Q2, Q4.
iv.Remove first and second rows from DataFrame.
10 Write a python code to create empty DataFrame 1
TOTAL
***
16 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: DATA FRAME
TOPIC: CREATE DATA FRAME by various method
Remove row and column of DataFrame
WORKSHEET NO. 5
QN Questions M
1 Write a Python code to create a DataFrame with appropriate column 2
headings from the csv file given below:
city Maxtemp Mintemp Rainfall
0 Delhi 40 32 24.1
1 Bengaluru 31 25 36.2
2 Chennai 35 27 40.8
3 Mumbai 29 21 35.2
19 | P a g e
7 What will be the output of following code and Answer the following: 2
i. List the index of the DataFrame df
ii. List the column names of DataFrame df.
import pandas as pd
x={'Qtr1':5000,'Qtr2':8000,'Qtr3':12000,'Qtr4': 18000}
y={'p' :13000,'q':14000,'r':12000}
totSales={1:x,2:y}
df=pd.DataFrame(totSales)
print(df)
8 Consider the given DataFrame ‘temp’: 4
city Maxtemp Mintemp Rainfall
0 Delhi 40 32 24.1
1 Bengaluru 31 25 36.2
2 Chennai 35 27 40.8
3 Mumbai 29 21 35.2
Write suitable Python statements for the following:
i. Add a column called area with the following data:
[135455,153330,225000,442540].
ii. Add a new city named ‘calcutta having maxtemp 20,mintemp 12
and rainfall
iii. Remove the column rainfall.
iv. iv.Remove first and third rows from DataFrame
9 Consider the given DataFrame df: 4
Qtr1 Qtr2 Qtr3 Qtr4
0 5000 8000 12000 18000
1 10 20 30 40
Write suitable Python statements for the following:
i. Add a column called Qtr5 with the following data:
[1444,20].
ii. Add a new record with appropriate values.
iii. Remove the column Qtr1, Qtr3.
iv. iv.Remove first and second rows from DataFrame.
10 Write a python code to create empty DataFrame 1
TOTAL
***
20 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: DATA FRAME
TOPIC: CREATE DATA FRAME by various method
Remove row and column of DataFrame
WORKSHEET NO. 6
Q. Questions M
No
1 Write a Python code to create a DataFrame ‘lib’ with appropriate column 2
headings from the csv file given below:
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
2 Write a Python code to create a DataFrame ‘lib’ by using list: 2
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
3 Write a Python code to create a DataFrame ‘lib’ by using dictionary 2
method:
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
4 Write a Python code to create a DataFrame ‘lib’ by using Series method: 2
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
5 Write a Python code to display output of Transpose of DataFrame . 2
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
6 Write a Python code to create a DataFrame ‘lib’ with appropriate column 2
headings save the DataFrame in sample.csv:
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
7 Write a Python code to create a DataFrame ‘temp’ and save the 2
DataFrame in temp.csv file
23 | P a g e
city Maxtemp Mintemp Rainfall
0 Delhi 40 32 24.1
1 Bengaluru 31 25 36.2
2 Chennai 35 27 40.8
3 Mumbai 29 21 35.2
8 Consider the given DataFrame: 4
Pcd title Price qty
0 P01 Notebook 85 500
1 P02 Pencilbox 76 200
2 P03 WaterBottle 129 50
3 P04 SchoolBag 730 70
Write suitable Python statements for the following:
i. Add a column called ACC_NO with the following data:
[135,153,225,442].
ii. Add a new Record
iii. Remove the column qty.
iv. Remove first and third rows from DataFrame
24 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER:Data Frame
TOPIC: max(),min(),sort_values(),sort_index(),sum() function of Data Frame and add
two DataFrame,rename index,rename columns and rename both index and columns
WORKSHEET NO. 7
QN Questions M
1 Consider the following dataframe: student_df [10x1]
Name CLASS marks
Anamay XI 95
Aditi XI 82
Mehak XI 65
Kriti XI 45
1. Write a statement to get the minimum value of the column
marks.
2. Write a statement to get the maximum value of the column
marks.
3. Write a statement to get the sum value of the column marks.
4. write a statement to get the average value of the column marks.
5. Write a statement to get Transpose of DataFrame student_df.
6. Write a statement to get the sorted value of the column marks.
7. Write a statement to get the sorted value of the column name
ascending.
8. Write a statement to get the sorted value of the column name
descending.
9. Write a statement to get the sort index of DataFrame.
10. Write a statement to get the sorted column index of
DataFrame.
2 Write the code in pandas to create the following DataFrames: [10x1]
df1 df2
mark1 mark2 mark1 mark2
0 10 15 0 30 20
1 40 45 1 20 25
2 15 30 2 20 30
3 40 70 4 40 10
5 10 50 3 50 30
Write the commands to do the following operations on the
DataFrames given above:
1.To add DataFrames df1 and df2.
2.To add 10 values into df1 DataFrame
3.To add 5 values into mark1 columns of DataFrame
4.To add DataFrame d1 into d2
d1 d2
mark1 mark2 mark1 mark2
0 10 15 0 30 20
1 40 45 1 20 25
2 15 30 2 20 30
3 40 70 4 40 10
5 10 50 3 50 30
5.To subtract df2 from df1
27 | P a g e
6.To rename column mark1 as m1 in df2.
7.To change index label of df1 from 0 to zero and from 1 to one
8.To rename column mark1 as m1, mark2 as m2 and row 0 to 00
and 1 to 01 of df2 DataFrame
9.To change the column heading of df1 to m11 for mark1 and m12
for mark2
10. Do for following
d1 d2
mark1 mark2 mark1 mark2
0 10 15 0 30 20
1 40 45 1 20 25
f1 f2
m1 m2 mark1 mark2
0 10 15 0 30 20
1 40 45 1 20 25
Print(d1[:2]+d2[:2])
Print(f1[:2]+f2[:2])
TOTAL 20
***
28 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER:Data Frame
TOPIC: max(),min(),sort_values(),sort_index(),sum() function of Data Frame and add
two DataFrame,rename index,rename columns and rename both index and columns:
WORKSHEET NO. 8
Q. Questions M
No
1 Create following batsman DataFrame using csv method [1x10]
Do following operation
1) Add score1 and score2 and assign it to column total
2) Display lowest score of score1.
3) Display highest score of score2
4) change index to player1,player2, player3,player4
5) Display all the details of DataFrame whose score1 <75
6) Display only name of DataFrame whose score1 <75
7) Display name and score1 of DataFrame whose score1 <75
8) Display DataFrame in descending order of score2
9) Change the column name to batsmanno,bname, s1 ,s2 and sum
of DataFrame
10)Add 5 score to those who have more than 75 score2
TOTAL 10
***
33 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: DataFrame
TOPIC: Access row and column using loc and iloc method, access and change individual
element of data frame by at and iat
WORKSHEET NO. 9
QN Questions M
1 loc and iloc
Create DataFrame df using csv method and write python code as per direction
0 1 2 3
Product Company qty price
101 cpu compaq 40 9000
102 mouse compaq 20 400
103 keyboard dell 10 700
104 printer hp 2 20000
105 hdd sony 500 450
106 cd sony 1000 25
107 scanner hp 4 5500
108 speaker dell 6 900
1)Display all product except product no 101 and 102
2)Display all the product details of record no 102,104 and 106.
3)Display product and company details of all records of DataFrame
4)Display product and company details of 101 and 104 records of DataFrame
5)Display name of all products of DataFrame.
6)Display first record of DataFrame.
7)Display price of all product of DataFrame.
8)Display company name of all product of DataFrame.
9)Display quantity and company details of all records of DataFrame
10)Display the details of record no 104
2 0 1 2 3
Product Company qty price
101 cpu compaq 40 9000
102 mouse compaq 20 400
103 keyboard dell 10 700
104 printer hp 2 20000
105 hdd sony 500 450
106 cd sony 1000 25
107 scanner hp 4 5500
108 speaker dell 6 900
36 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER:DataFrame
TOPIC: Access row and column using loc and iloc method,access and change individual
element of DataFrame by at and iat
WORKSHEET NO. 10
Q. Questions M
No
1 loc and iloc 1x10
Create DataFrame df using csv method and write python code as per
direction
0 1 2 3
name dept age salary
101 Heena sales 40 14000
102 Ayush Purchase 28 20400
103 diohm sales 30 37700
104 varshabh Purchase 25 20000
105 shubhi Purchase 22 45000
106 priyansh sales 21 10000
107 ankush IT 40 55000
108 samy IT 36 60900
42 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII – IP
NAME OF CHAPTER: -CREATE DATA FRAME
TOPIC: Assertion & Reason
WORKSHEET NO. 11
QN Questions M
Directions: In the following questions, a statement of Assertion (A) is
followed by a statement of Reason (R). Mark the correct choice as:
(A) Both Assertion (A) and Reason (R) are true, and Reason (R) is the
correct explanation of Assertion (A).
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not
the correct explanation of Assertion (A).
(C) Assertion (A) is true, but Reason (R) is false.
(D) Assertion (A) is false, but Reason (R) is true.
1 Q.1. Assertion (A): DataFrame is a two-dimensional labelled array. 1
Its columns types can be heterogeneous i.e., of varying types.
Reason (R): We need a DataFrame with a Boolean index to use the
Boolean indexing.
2 Assertion (A): Iteration is a general term for taking each item of 1
something one after another. Reason (R): itertuples () returns the
iterator yielding each index value along with a series containing the data
in each row.
3 Assertion (A): Indexing can also be known as sub selection. 1
Reason (R): Pandas DataFrame.loc attribute access group of rows and
columns by label(s) or a boolean array in the given DataFrame.
4 Assertion (A): To delete a column from Panda DataFrame, drop() method 1
is used. Reason (R): Columns are deleted by dropping columns with
index label.
5 Assertion (A): Rows can also be selected by passing integer location. 1
Reason (R): Integer location can be pass to the iloc[] method
6 Assertion (A): head() function returns first n rows from the object based 1
on position.
Reason (R): n is the selected number of rows whose default value is 3.
7 Assertion (A): List of dictionary can be passed to form a DataFrame. 1
Reason (R): Keys of dictionary are taken as row names by default.
8 Assertion (A): Indexing can also be known as sub selection. 1
Reason (R): Pandas DataFrame.loc attribute access group of rows and
columns by label(s) or a Boolean array in the given DataFrame.
9 Assertion (A): CSV files are available to open in any spreadsheet 1
program, including Google Sheets, Open Office, and Microsoft Excel.
Reason (R): Using a spreadsheet program can serve a user's needs
better since it has cells where data sorted in rows and columns.
10 Assertion (A):- While creating a DataFrame with a nested or 2D 1
dictionary, Python interprets the outer dict keys as the columns and the
inner keys as the row indices.
Reasoning (R):- A column can be deleted using remove command
TOTAL 10
***
48 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
50 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
(i) print(S.iloc[1:3])
(ii) print(S.loc[‘B’ : ‘D’])
4. Consider a list L and a Series object S storing 3 values (10, 20 and 30). What will be
the output of the following statements.
(i) L*2
(ii) S*2
5. Find the output of the following code:
import pandas as pd
S = pd.Series(10, index = [‘a’, ‘b’, ‘c’])
print(S.size)
print(S.ndim)
print(S.hasnans)
6. Find the output of the following code:
import pandas as pd
x = (10,4)
S = pd.Series(data = x*2)
print(S)
51 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
52 | P a g e
9. Write a statement to transpose a dataframe df.
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
53 | P a g e
print(df2)
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
1. A Python list namely section stores the section names (‘A’, ‘B’, ‘C’, ‘D’) of class 12 in
your school. Another list contri stores the contribution made by these students to a
charity fund endorsed by the school. Write code to create a Series object that stores the
contribution amount as the values and the section names as the indexes.
2. While reading from a csv file using read_csv() into a dataframe, what argument will
you add so that the first row is not used as the column heading?
3. You want to read data from a CSV file in a dataframe but you want to provide your
own column names to dataframe. What additional argument would you specify in
read_csv()?
4. While reading from a csv file using read_csv() into a dataframe, what argument will
you add so that the top n number of rows are not read into the dataframe?
5. Which argument would you give to read_csv() if you want to read top 10 rows of
data only?
6. Write statement to read from a CSV file Employee.csv and create a dataframe from
it. Assume pandas library has been imported as pd.
7. Write a statement to read only three records from the file employee.csv in
dataframe. Assume that Pandas library has been imported as pd.
8. Write statement to read from sport.csv file where the separator is a tab character.
Assume that pandas library has been imported as pd.
9. Given a dataframe allDF. Write a statement to write the data in this dataframe into a
csv file namely all.csv. Assume that pandas library has been imported as pd.
10. Write command to store data of dataframe mdf into a csv file Mydata.csv, with
separator character as ‘@’.
54 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
8. Name two functions provided by Pandas library that help you to read and write to
CSV files from Python code.
9. Which Pandas’ data structure does the read_csv() function read the data into?
55 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
(a) Write the command which will display the names of the furniture having rent >
250
(b) Write command to name the series as Furniture.
5. Write a program to create a Series object with 6 random integers and having
indexes as: [‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘v’].
6. A dataframe namely Result stores the details of students’ marks in different subjects
for a class of 50 students. The records are arranged in the descending order of total
marks obtained by a student:
Eng IP Maths
23 77 78 78
11 82 85 67
22 55 66 66
34 66 76 73
9 78 60 44
: : : :
(i) Write a statement to print the five least scoring students’ details.
(ii) Write a statement to get the maximum marks stored in subject IP.
(iii) Write a statement to print the details of the student who scored maximum marks in
the subject Eng.
(iv) Write a statement to print the three highest scoring students.
(v) Write a statement to display the marks scored by a student with roll number 22, in
the subject Math.
56 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA HANDLING USING PANDAS (UNIT – 1)
1. The python code written below has syntactical errors. Rewrite the correct code
and underline the corrections made.
import Pandas as pd
Import numpy as np
s = pd.Series [1, 2, 3, 4, 5 ]
Print(s.index)
2. The python code written below has syntactical errors. Rewrite the correct code
and underline the corrections made.
import pandas as pd
S1 = Pd.Series([1,2,3,4])
S2 = pd.Series([5,6,7,8])
df = pd.Dataframe(s1,s2)
Print(DF)
(i) statement 1: fill the blank to give column heading as ‘C1’, ‘C2’ and ‘C3’.
(ii) statement 2: fill statement that creates dataframe n1 that stores the values of
dataframe df multiplied by 3.
(iii) statement 3: fill statement that adds a new column ‘C4’ in the dataframe n1,
which stores the difference of column ‘C3’ with column ‘C2’.
(iv) statement 4: fill statement to drop column ‘C4’.
(v) statement 5: fill statement to drop the index 2 from dataframe n1.
(vi) statement 6: fill statement to display the sum of rows with indexes 2 onwards
from the dataframe df.
57 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
67 | P a g e
20. You can set different width for different bars in bar chart. (True/False)
21 If you are given to plot a histogram using numpy array as per the code given below
then answer any of four question from (i) to (v)
(v) To fill in blank on Line 10 for showing histogram what can beeused ?
(a) plt.show() (b) plt_show()
(c) plot_show() (d) plt.show
************
68 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 2
69 | P a g e
B. Bar chart
C. Pie chart
D. Scatter plot
9. Which method is used to plot horizontal bar graph in pyplot ?
A. horizontal_bar()
B. barh()
C. hbar()
D. bar()
10. Which method is used to plot histogram in pyplot?
A. his()
B. hist()
C. Hist()
D.histogram()
11. Consider the following program and answer any four question from (i) to
(v):
import _______ as plt #line 1
plt.bar ([2,3,4,8,1],[2,4,7,3,5], label= _____ ) #line 2
plt.legend( ) #line 3
plt.xlabel(____ ) #line 4
plt.ylabel(‘Height’) #line 5
plt._______ (‘Vertical Bar Chart’) #line 6
________________ #line 7
(ii) Name the label that can be used to represent the bar chart in Line 2 .
a) Data (b) Data Values
b) Values for X axix (d) All of these
(iv) Which method will take place at Line 6 for setting heading on the top of Chart ?
(a) Title() (b) title()
(c) Head() (d) All of these.
12. Consider the following case and answer the from (i) to (v)
70 | P a g e
import …………. as pd #line 1
import matplotlib. _____ as plt #line 2
data= {‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’, ‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]}
df=pd. _________ (data) #line 6
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2, linestyle=’:’ , fill= False)
#line 7
_____________ #line 8
13. Mr. Vijay is working in the mobile app development industry and he was
comparing the given chart on the basis of the rating of the various apps available
on the play store and answer the questions (i) to (v).
71 | P a g e
He is trying to write a code to plot the graph. Help Mr. Vijay to fill in the blanks of the
code and get the desired output.
plt.__________(apps,ps_rating,color='m',label=__________) #Statement 2
,Statement 3
plt.xlabel("Apps")
plt._____________("Rating") #Statement 4
plt._________ #Statement 5
plt.________ #Statement 6
************
72 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 3
**************
73 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 4
2. Collect data about colleges in Delhi University or any other university of your choice
and number of courses they run for Science, Commerce and Humanities, store it in a
CSV file and present it using a bar plot.
3. Collect the minimum and maximum temperature of your city for a month and present
it using a histogram plot.
4. Plot the following data on line chart:
Runs in Overs 10 20
MI 110 224
RCB 85 210
5. Write code to plot a line chart to depict the run rate of T20 match from given data:
Overs Runs
5 45
10 79
15 145
20 234
7. How to change the thickness of line, line style, line color, and marker properties of
a chart?
74 | P a g e
8. Mrs. Sharma is a coordinator in the senior section school. She represented data on
number of students who passed the exam on line chart as follows:
She has written the following code but not getting the desired output. Help her
by correcting her code.
*************
75 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
CLASS XII :– INFORMATICS PRACTICES (065)
TOPIC :- DATA VISUALISATION (UNIT – 1)
WORKSHEET - 5
1. Consider that a survey has to be done on how much distance the following vehicles have
covered in a span of five days. The data collected can be plotted in different plotting methods.
plot the data using Line plot:
BIKES
DAYS DISTANCE COVERED IN KMS
ENFIELD HONDA YAHAMA KTM
DAY 1 50 80 70 80
DAY 2 40 20 20 20
DAY 3 70 20 60 20
DAY 4 80 50 40 50
DAY 5 20 60 60 60
2. Consider question No.9 and plot the data using Bar Chart.
3. Consider question No.9 and plot the data using Pie Plot.
4. Consider question No.9 and plot the data using Scatter Plot.
5. Consider question No.9 and plot the data using Histogram Plot.
6. Write a Python program to draw line charts from the given financial data of ABC Co.
for 5 days in the form a DataFrame namely fdf as shown below :
Day1 Day2 Day3 Day4 Day5
0 74.25 56.03 59.30 69.00 89.65
1 76.06 68.71 72.07 78.47 79.65
2 69.50 62.89 77.65 65.53 80.75
3 72.55 56.42 66.46 76.85 85.08
7. Write a program to create a horizontal bar chart for India's medal tally.
Australia 80 59 59 198
England 45 45 46 136
India 26 20 20 66
Canada 15 40 27 82
8. Write a python code to draw the following bar graph representing the total sales in
each quarter. Add the title, label for X-axis, Y-axis. Use the following data for
plotting the graph.
76 | P a g e
Sales = [450,300,500,850]
Qtr = [“Qtr1”, “Qtr2”, “Qtr3”,”Qtr4”]
77 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:1 (Questions) ::CLASS XII – IP
93 | P a g e
a. Write SQL query to print records in descending order of year
of admission.
b. Write SQL query to display house and number of students in
each house.
c. Write SQL query to display CLASS wise highest fees.
d. Predict output.
SELECT LENGTH(SNAME) FROM STUDENT;
TOTAL 25
94 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:2 (Questions) ::CLASS XII – IP
97 | P a g e
iii) SELECT UPPER (MID("start up india",10));
10 Shreya, a database administrator has designed a database for a 4
clothing shop. Help her by writing answers of the following questions
based on the given table:
TABLE : CLOTH
CCODE CNAME SIZE COLOUR PRICE DOP
C001 JEANS XL BLUE 990 2022-01-21
C002 T SHIRT M RED 599 2021-12-12
C003 TROUSER M GREY 399 2021-11-10
C004 SAREE FREE GREEN 1299 2019-11-12
C005 KURTI L WHITE 399 2021-12-07
i. Write a query to display cloth names in lower case. (1)
ii. Write a query to display the lowest price of the cloths.(1)
iii. Write a query to count total number of cloths purchased of
medium size.
iv. Write a query to count year wise total number of cloths
purchased.
11 Write suitable SQL query for the following: 5
i. Display name of the Month from your date of birth.
ii. Convert email-id to lowercase.
iii. Count the number of characters in your name.
iv. To remove leading spaces from the ‘ VANDE BHARAT ‘.
v. Display the string ‘CHEST’ from the string ‘MANCHESTER
UNITED’.
TOTAL 25
98 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:3 (Questions) ::CLASS XII – IP
QN Question M
1 The …… function works with data of multiple rows at a time and returns 1
aggregate value.
a. SUM()
b. AVG()
c. MAX()
d. COUNT()
2 The ……. Clause arrange the result set in the order of single column, 1
multiple columns and custom sort order too.
a. HAVING
b. GROUP BY
c. ORDER BY
d. DISTINCT
3 Which clause is used in query to place the condition on group in clause. 1
a. WHERE
b. HAVING
c. GROUP BY
d. Both (a) and (b)
4 Give output of the following queries as per given table: 2
Table: Interior
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 RED ROSE DOUBLE BED 2022-02-23 32000 15
2 SOFT TOUCH BABY COT 2020-01-22 9000 10
3 ROUGH WOOD BABY COT 2021-02-15 8500 10
4COMFORT ZONE OFFICE TABLE 2020-09-27 20000 20
5 LION KING DOULE BED 2015-07-15 10000 20
I. SELECT COUNT(DISTINCT TYPE) FROM INTERIORS;
II. SELECT SUM(PRICE) FROM INTERIORS WHERE TYPE = ‘BABY COT’;
5 Aryan, a database administrator, has grouped records of a table with the 2
help of group by clause. He needs to further filter groups of records
generated through group by clause. Suggest suitable clause for it and
properly explain its usage with the help of an example.
100 | P a g e
She need to perform following task on the table so help her to write the SQL
query: -
i. To fetch last 1 character from the flight number column.
ii. To display the values of flight name column in upper case.
8 Given Table Course: 2
Find out the output for given SQL command:
11
Devansh, a database analyst has created the following table: Salesman
He has written following queries:
(a) select sum(salary) from salesman where bonus is null and Salary>
20000;
(b) select avg(salary)+min(bonus) from salesman where storetype=
‘Health’;
(c) select max(salary) from salesman where storetype= ‘software’;
(d) select length(SNAME) from salesman where bonus is NULL;
(e) select count(bonus) from salesman ;
TOTAL 25
101 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:4 (Questions) ::CLASS XII – IP
QN Question M
1 The COUNT() function ignores duplicate and null values while counting 1
the records. State True or False.
a. True
b. False
2 In MYSQL, …….. option causes a group function to consider only 1
unique values of the argument expression.
a. DESC
b. ORDER BY
c. DISTINCT
d. None of the above
3 Which SQL statement do we used to find the total number of records 1
present in the table product?
a. SELECT * FROM PRODUCT;
b. SELECT COUNT(*) FROM PRODUCT;
c. SELECT FIND(*) FROM PRODUCT;
d. SELECT SUM() FROM PRODUCT;
4 Briefly explain the purpose of the following SQL functions: 2
i. power()
ii. mod()
103 | P a g e
10
104 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:5 (Questions)
QN Question M
1 Write the output of the following command: 1
SELECT ROUND(49.88);
a. 49.88
b. 49.0
c. 9.8
d. 50
2 Write output of the following : 1
SELECT LEFT(‘INDIA IS GREAT’,5);
a. INDIA
b. GREAT
c. INDIA IS
d. IS GREAT
3 Assertion (A) : SELECT MOD(15,3); will produce the output as 0. 1
Reason (R) : POWER() function is used to get the power of the given
values.
a. Both Assertion(A) and Reason(R) are true and Reason(R) is the
correct explanation of assertion (A).
b. Both Assertion(A) and Reason(R) are true but Reason(R) is not the
correct explanation of assertion (A).
c. Assertion (A) is true but reason(R) is false.
d. Assertion (A) is false but reason(R) is true.
4 Find the output of the following query: 2
(i) SELECT ROUND(7658.345,2);
(ii) SELECT MOD(ROUND(13.9,0),3);
5 Find the output of the following SQL queries: 2
i) SELECT SUBSTR(‘FIT INDIA MOVEMENT’,5);
ii) SELECT INSTR(‘ARTIFICIAL INTELIGENCE’, ‘AI’);
6 A relation Vehicles is given below : 2
106 | P a g e
9 Consider a table "MYPET" with the following data: 3
TOTAL 25
107 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:6 (Questions)
QN Question M
1 Write the output of the following SQL statement: 1
SELECT ROUND(458.45,-1);
a. 450
b. 460
c. 458
d. 500
2 The SUBSTR() function in MYSQL is an example of …………. 1
a. Date function
b. Text function
c. Aggregate function
d. Math function
3 Assertion (A) :SELECT INSTR(‘WORD MAP’, ‘MAP’); will produce the 1
output 6.
Reason (R) : INSTR() function takes two arguments as string and
substring and returns the position of the first occurrence of a
specified substring from a given string.
a. Both Assertion(A) and Reason(R) are true and Reason(R) is the
correct explanation of assertion (A).
b. Both Assertion(A) and Reason(R) are true but Reason(R) is not the
correct explanation of assertion (A).
c. Assertion (A) is true but reason(R) is false.
d. Assertion (A) is false but reason(R) is true.
4 Sreenath created the following table STUDENT in his database. 2
Table : STUDENT
Rollno Name CLASS Mark
1 Ritika 12 40
2 Angad 12 35
3 Kaveri 11 42
4 Lalitha 12 21
5 Daniel 11 44
6 Rabindra 11 39
7 Rabia 11 28
He wants to now count number of students in each CLASS where the
number of students is more than 3. He has executed the following
query.
SELECT MAX(MARKS) FROM STUDENT WHERE COUNT(*)>3 GROUP BY
CLASS;
But, he got an error. Identify the error and rewrite the query.
5 Briefly explain the purpose of the following SQL functions: 2
i. NOW() ii. RTRIM( )
6 Help suman in predicting the output of the following queries: 2
i) select length(mid(‘NETWORKING’,2,3));
ii) select DAYOFYEAR(‘2012-02-08’);
7 A numeric data field AMOUNT store a value 936.432, Write MySQL 2
query for the following
i) to display amount up to one(1) decimal.
ii) to display amount as a whole number.
109 | P a g e
8 Consider the following SQL string : ‘Examination’ 2
Write commands to display:
a) ‘min’
b) ‘nation’
OR
Write SQL
Commands for the following:
I. Display the maximum and minimum price of drugs offered by all
pharmacies.
II. Display sum of price for each PharmacyName having more than
one drug.
III. To display total no of drug of each pharmacy name.
IV. Display details of PHARMADB in descending order of price.
11 Write the SQL functions which will perform the following operations: 5
i) To display the name of the day of the current date.
ii) To remove spaces from the beginning of a string, “ Python”.
iii) To display the name of the month eg, January or February from
your date of birth.
iv) To display the starting position of word “Information” from
“Information Technology”
v) To compute the power of two numbers a and b
TOTAL 25
110 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:7 (Questions)
QN Question M
1 Write the output of the following SQL command: 1
SELECT SUBSTR(‘COMPUTER’,3,4);
a. MPUT
b. PU
c. PUTE
d. MP
2 The string function that returns the index of first occurrence of substring 1
is ………….
a. INSERT()
b. INSTR()
c. INSTRING()
d. INFSTR()
3 Assertion (A) : HAVING clause is often used with the GROUP BY 1
clause.
Reason (R) : HAVING clause is used to check specified condition.
a. Both Assertion(A) and Reason(R) are true and Reason(R) is the
correct explanation of assertion (A).
b. Both Assertion(A) and Reason(R) are true but Reason(R) is not the
correct explanation of assertion (A).
c. Assertion (A) is true but reason(R) is false.
d. Assertion (A) is false but reason(R) is true.
4 Give any two differences between POW () and SUM (). 2
5 Ms. Mohini is working in a school and stores the details of all students in 2
a table school data.
Table : SCHOOLDATA
Write the SQL statements from the above given table to:
i) To remove leading spaces from the column name
ii) Display the names of the students who were born on Sunday
6 Predict the output of the following queries: 2
i. Select round(6.5675,2);
ii. Select mid(‘PRE_BOARD_EXAM’,4,6);
7 Write the output of the following SQL queries: 2
i. SELECT DAYOFMONTH(‘2015-01-16’);
ii. SELECT DAYOFYEAR(‘2014-01-30’);
8 Consider the table HOTEL given below: 2
Empno Category Salary
E101 Manager 60000
112 | P a g e
E102 Executive 65000
E103 Clerk 40000
E104 Manager 62000
E105 Executive 50000
Mr. Vinay wanted to display average salary of each category. He
entered the following SQL statement. Identify the error and rewrite the
correct SQL statement.
SELECT CATEGORY, SALARY FROM HOTEL
GROUP BY CATEGORY;
9 Predict the output of the following queries: 3
i. SELECT INSTR (‘Very good’, 'good');
ii. SELECT MID('Quadratically',5,6);
iii. SELECT RIGHT (‘Command', 3);
10 Carefully observe the following table named ‘stock’. 4
PID PName Category Qty Price
1 Keyboard IO 15 450
2 Mouse IO 10 350
3 Wifi-router NW 5 2600
4 Switch NW 3 3000
5 Monitor O 10 4500
6 Printer O 4 17000
i. To display the records in decreasing order of price.
ii. To display category and category wise total quantities of
products.
iii. To display the category and its average price.
iv. To display category and category wise highest price of the
products.
11 Write the SQL functions which will perform the following operations: 5
i) To display the day of the current date.
ii) To display the first four letter of the text “EDUCATION”.
iii) To display the text “EDUCTAION” in lower case.
iv) To remove spaces from the beginning and end of a string, “ CBSE ”.
v) To compute the sum between two numbers, n1 and n2
TOTAL 25
113 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:8 (Questions)
Q Question M
N
1 Which of the following is not a built-in function? 1
a. SUM
b. AVG
c. MAX
d. TOTAL
2 What is returned by INSTR(‘JAVA POINT’,’P’); ? 1
a. 6
b. 7
c. Point
d. JAVA
3 Assertion (A): SELECT RIGHT(‘Program’,4) ; Output will be ‘ram’ 1
Reason (R) : It is used to return a specified number of characters
from the right of the string. The number of characters returned is
determined by the second argument.
a. Both Assertion(A) and Reason(R) are true and Reason(R) is the
correct explanation of assertion (A).
b. Both Assertion(A) and Reason(R) are true but Reason(R) is not the
correct explanation of assertion (A).
c. Assertion (A) is true but reason(R) is false.
d. Assertion (A) is false but reason(R) is true.
4 Predict the output of the following queries based on the given table: 2
115 | P a g e
7 What will be the output of : 2
i. SELECT ROUND(124.44) + MOD(1201,3);
ii. SELECT MOD(30.500,5) + ROUND(100.50,1);
8 Differentiate between SUBSTR() and INSTR(). 2
9 A school “ABC” maintains the following MySQL table named ‘student’ 3
having following structure to store the details of their students:
116 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:9 (Questions)
QN Question M
1 Which of the following is correct answer of given query? 1
SELECT MOD(26,5);
a. 2 b. 3 c.4 d.1
2 Assertion (A) : The ORDER BY clause sorts the result set in 1
descending order by default.
Reason (R) : To sort a result set in ascending order we can use ASC
keyword with ORDER BY clause.
a. Both Assertion(A) and Reason(R) are true and Reason(R) is the
correct explanation of assertion (A).
b. Both Assertion(A) and Reason(R) are true but Reason(R) is not
the correct explanation of assertion (A).
c. Assertion (A) is true but reason(R) is false.
d. Assertion (A) is false ut reason(R) is true.
3 Which keyword is used to arrange the result of order by clause in 1
descending order?
a. DSEC b.DES c.DESC d.DESNO
4 Briefly explain the purpose of the following SQL functions: 2
i. SUBSTR() ii. LEFT()
5 Help Reshma in predicting the output of the following queries: 2
i) select round(783.34,-2);
ii) select round(456.335,2);
6 Given Table Course: 2
118 | P a g e
He has written following queries :
i) Select MAX(DOB ) from emp;
ii) Select ENAME from EMP where YEAR(DOJ)=2020;
9 Consider the table Garment and write the query: 3
119 | P a g e
KENDRIYA VIDYALAYA SANGATHAN – AHMEDABAD REGION
CLASS XII – IP
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:10 (Questions)
QN Question M
1 Find the Output of SQL command : 1
select concat (concat (‘Inform’, ‘atics’),‘Practices’);
a. Informatics Practices
b. Informatic Practices
c. Inform practices
d. Inform atics practices
2 The outputs of the given two commands are 20 and 17 respectively. 1
Select COUNT(*) From Student;
Select COUNT(Age) From Student;
How many NULL values are there in Age column of the Student table?
a. 17
b. 20
c. 3
d. None of these
3 If column “Fees” contains the data set (5000,8000,7500,5000,8000), 1
what will be the output after the execution of the given query?
SELECT SUM (DISTINCT Fees) FROM student;
i. 20500
ii. 10000
iii. 20000
iv. 33500
4 State any two differences between single row functions and multiple row 2
functions.
5 Consider the decimal number x with value 8459.2654. Write commands 2
in SQL to:
i. round it off to a whole number
ii. round it to 2 places before the decimal.
6 Anjali writes the following commands with respect to a table employee 2
having fields, empno, name, department, commission.
Command1 : Select count(*) from employee;
Command2: Select count(commission) from employee;
She gets the output as 4 for the first command but gets an output 3 for
the second command. Explain the output with justification.
7 Consider the following SQL string: “Preoccupied” Write commands to 2
display:
a. “occupied”
b. “cup”
8 Considering the same string “Preoccupied” Write SQL commands to 2
display:
a. the position of the substring ‘cup’ in the string “Preoccupied”
b. the first 4 letters of the string
9
121 | P a g e
Write SQL commands to:
a. Display the average price of each type of vehicle having quantity
more than 20.
b. Count the type of vehicles manufactured by each company.
c. Display the total price of all the types of vehicles.
10
122 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
Q.No. Question Ma
rks
1 Which of the following is the correct output of the following SQL 1
command?
SELECT ROUND(7876.4568,2);
(i) 7876.46 (iii) 7876.45
(ii) 7900 (iv) 7900.4568
2 Aggregate functions are also known as : 1
(i) Scalar functions (iii)Single Row Functions
(ii) Multiple Row functions (iv)Hybrid Functions
3 Primary law in India for matters related to e-commerce and cyber 1
crime is :
(i) IT Act 1995 (iii) IT Act 2000
(ii) IT Act 1998 (iv) IT Act 2010
4 Ravisha as stored the records of all students of her class in a MYSQL 1
table. Suggest a suitable SQL clause that she should use to display the
names of students in alphabetical order.
(i) SORT BY (iii) ALIGN BY
(ii) GROUP BY (iv) ORDER BY
5 To remove the leading and trailing space from data values in a column 1
of MySql table, we use
(i) Left() (iii) Right()
(ii) Trim() (iv) Ltrim
6 If the substring is not present in a string, the INSERT() returns: 1
(i) -1 (iii) 1
(ii) NULL (iv) 0
7 Differentiate between COUNT() and COUNT(*) functions in MYSQL. 2
Give suitable examples to support your answer.
8 Keshav has written the following query to find out the sum of bonus 2
earned by the employees of WEST zone.
SELECT zone, TOTAL(bonus) FROM employee HAVING zone = ‘WEST’;
But he got an error. Identify the errors and rewrite the query by
underlining the correction(s) done.
9 Consider the table Patient given below and write SQL Commands. 3
Table : Patiend
Patientid Name City Phone Dateofadm Departmen
t
1000001 Ritvik Garg Delhi 68476213 2021-12-10 Surgery
1000002 Rahil Arora Mumbai 36546321 2022-01-08 Medicine
1000003 Mehak Bhatt Delhi 68421879 2022-02-02 Cardiology
1000004 Soumik Rao Delhi 26543266 2022-01-11 Medicine
1000005 Suresh Sood Bangalore 65432442 2021-03-09 Surgery
(i) Display the details of all patients who were admitted in
January.
(ii) Count the total number of patients from Delhi.
(iii) Display the last 2 digits of the Patientid of all patients from
Surgery Department.
124 | P a g e
10 Write an output (i-iii) for the following SQL commands. 3
Table : FASHION
ID Product Price Qty
F01 Kajal 970 10
F02 Foundation 2100 15
F03 Night Cream 1700 20
F04 Day Cream 1400 10
F05 Shampoo 1200 25
F06 Lipstick 850 32
125 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
126 | P a g e
1 Compact Petrol 56000 70000
HatchBack
2 Compact Diesel 34000 40000
HatchBack
3 MUV Petrol 33000 35000
4 MUV Diesel 14000 15000
5 SUV Petrol 27000 54000
6 SUV Diesel 18000 30000
7 Sedan Petrol 8000 10000
8 Sedan Diesel 1000 5000
i. Display fuel wise average sales in the first quarter
ii. Display segment wise highest sales in the second quarter
iii. Display the records in the descending order of sales in the
second quarter.
10 Write MySQL statements for the following : 3
i. To create a database named FOOD.
ii. To create a table named Nutrients based on the following
specification:
Column Name DataType Constraints
Food_Item Varchar(20) Primary key
Calorie Integer
11 Preeti manages database in a blockchain start-up. For business 4
purposes, she created a table named BLOCKCHAIN. Assist her by
writing the following queries:
Table : BLOCKCHAIN
Id User Value Hash Transaction_date
1 Steve 900 ERTYU 2020-09-19
2 Meesha 145 @345r 2021-03-23
3 Nimisha 567 #wert5 2020-05-06
4 Pihu 678 %rtyu 2022-07-13
5 Kopal 768 rrt4% 2021-05-15
7 Palakshi 534 wer@3 2022-11-29
127 | P a g e
KENDRIYA VIDYALAYA SANGATHAN, AHEMDABAD REGION
NAME OF CHAPTER/ TOPIC: DATABASE QUERY USING SQL
WORKSHEET NO.:13 (Questions from Revision of Class XI) ::CLASS XII – IP
128 | P a g e
10 Write an SQL query to join two tables on the basis of common field Code and display the 3
subject in ascending order. Detail of the table are given below:
Table :BOOK
Code Subject
B1 ENGLISH
B2 PHYSICS
B3 HISTORY
B4 SCIENCE
Table : STOCK
S_CODE PUB QTY CODE
P12 GYAN CHAND 250 B1
P14 PUSTAK HOUSE 340 B2
P16 SONKA BOOKS 245 B3
11 The table Professional is created in a database. The details of the 4
different professional courses are given below:
Ref_ID Course Duration Eligibility Fee
M/001 MBA 2 Graduate 600000
B/--2 B.Tech 4 UG 750000
Graduate
B/003 B.Pharm 4 UG 780000
Graduate
B/004 BBA 3 UG 530000
Graduate
M/002 MSc 2 Graduate 480000
M/003 MCA 2 Graduate 500000
i) To display ref_id, courses and fee whose duration is 3 years or
more.
j) To display all such courses with the fee whose eleigibility is
‘Graduate’
k) To reduce the fee for all the courses by 50000
l) To display the courses, their duration and eligibility whose fee
is in the range to 500000 to 750000.
12 Monika has created following table named WORKER: 5
W_ID F_NAME L_NAME CITY STATE
102 SAHIL KHAN KANPUR UTTAR
PRADESH
104 SAMEER PARIKH ROOP PUNJAB
NAGAR
105 MARY JONES DELHI DELHI
106 MAHIR SHARMA SONIPAT HARYANA
107 ATHARVA BHARDWAJ DELHI DELHI
108 VEDA SHARMA KANPUR UTTAR
PRADESH
(i) Insert a new record in the table having following values:
[109,’SONA’, ‘GEORGE’, ‘SURAT’,’GUJARAT’]
(ii) To change the value of state from ‘PUNJAB’ to ‘HARYANA’.
(iii) To remove the records of those students whose L_Name is
‘SHARMA’.
(iv) To add a new column ‘WAGE’ of suitable datatype.
(v) To display records of city as ‘DELHI’.
25
129 | P a g e
KENDRIYA VIDYALAYA SANGATHAN (AHMEDABAD REGION)
2023-24
CLASS XII – IP
NAME OF THE CHAPTER: Introduction to Computer Network
WORKSHEET : 1
130 | P a g e
KENDRIYA VIDYALAYA SANGATHAN (AHMEDABAD REGION)
2023-24
CLASS XII – IP
NAME OF THE CHAPTER: Introduction to Computer Network
WORKSHEET : 2
(i) Suggest an ideal cable layout for connecting the above UNITs.
(ii) Suggest the most suitable place i.e. UNIT to install the server for the above
NGO.
(iii) Which network device is used to connect the computers in all UNITs?
(iv) Suggest the placement of Repeater in the UNITs of above network.
(v) NGO is planning to connect its head office in Delhi, which is more than 1500
km from NGO. Which type of network out of LAN, WAN or MAN will be formed?
2 Vidyadevi was inspired by her granddaughter who uses technology for hr day 5
to day activities. Being a learner and teacher all her life, he wanted to open an
email account and interact with her friends and family. Her granddaughter
created an email account for her and he started sending mails to her friends.
This was a big achievement for her. Her granddaughter explained her how to
132 | P a g e
send mails, how to create email address, what protocols are used. There are
few doubts in her mind which you can help her with.
iii) Mail access tarts with client when user needs to download email from the
______.
(a)mailbox (b)mail server (c)IP server (d)Internet
Number of computers :
133 | P a g e
ii) Suggest the most suitable place to house the server. Justify your answer
iii) Suggest the placement of following devices with justification:
a)repeater b) hub/switch
AGRA
DELHI
PRODUCTION Office WAREHOUSE
head
Office
ADMIN SHIPPING
Number of computers:
ADMIN 120
WAREHOUSE 60
PRODUCTION 35
SHIPPING 18
Delhi Head Office 12
i) Suggest the most appropriate location of the server inside the AGRA Office
(out of the four buildings) to get the best connectivity for maximum
number of computers. Justify your answer.
ii) Suggest and draw cable layout to efficiently connect various buildings
134 | P a g e
within the AGRA Office for a wired connectivity.
iii) Which networking device will you suggest to be procured by the company
to interconnect all the computers of various buildings of AGRA Office?
iv) Company is planning to get its website designed which will allow
shopkeepers to see their products, shipping details themselves on its
server. Out of the static or dynamic, which type of website will you
suggest?
v) Which of the following will you suggest to establish the online face to
face communication between the people in the ADMIN office of AGRA
and Delhi head office?
5 Samarth is the hardware engineer of IT company. He has been given the task 5
of installing a network in the school lab which has around 40 computers.
i)Suggest the most suitable type of network topology he should use in order to
maximize speed and make each computer independent of network breakdowns.
a)bus topology b)star topology c)ring topology d)mesh topology
ii)In order to allow data transfer from server to only the intended computers
which network device is required in the lab to connect the computers?
a) switch b)hub c)router d)gateway
iii) After setting up the lab and internet in the lab, Samarth is now required to
enable videos and animations to be played on the web browser for students of
multimedia class. Which browser tool/service can be used ?
135 | P a g e
KENDRIYA VIDYALAYA SANGATHAN (AHMEDABAD REGION)
2023-24
CLASS XII – IP
NAME OF THE CHAPTER: Societal Impacts
WORKSHEET : 1
1. Phishing 2. Hacking
137 | P a g e
KENDRIYA VIDYALAYA SANGATHAN (AHMEDABAD REGION)
2023-24
CLASS XII – IP
NAME OF THE CHAPTER: Societal Impacts
WORKSHEET : 2
Reasoning (R):- Mostly all electronic waste comprises of toxic chemicals such
as lead, beryllium, mercury etc.
5 Define e-waste. What are the various methods for effective e- waste 2
management?
6 What do you mean by Digital property rights? Explain. 2
7 Give any 2 benefits of ICT on today’s society? 2
8 State 2 benefits of e-waste recycling? 2
9 What do you understand by Net Etiquettes? Explain any two such etiquettes. 2
10 What are some side effects of spending too much time on computers? 3
11 What are the impacts of E-waste on the environment? 3
140 | P a g e
Case Based Questions:
QUES: XYZ Company developed software, related to face recognition with a team of 15
software developers. XYZ company Registered the software with a face symbol to easily
recognize their software. Before approval of software by the registering firm, Rohit one of the
team member of the software published the same software in internet under different name as
it is his own development.XYZ firm recognized this activity and informed to the police. The
police people arrested the Rohitas and removed the software from the internet. Police advice
the XYZ firm to apply for patent as the software is a new invention.
1. XYZ firm registered the software with face symbol to easily recognize their software .in this
context face symbol is called
(1) Copyright (2) IPR (3) Trademark (4) None of the above
Answer is: (3)
Answer is: 4
QUES: Mr. Vinod is the administrator of a school computer network. Help him to take
appropriate decision to achieve computer security and safe online access.
(i) Suggest a device to be used to filter network traffic to/from school network to provide
network security.
(ii) Which software he can use to get protection from Viruses and Spyware
(iii) Tell him what he has to disable if possible in browser so that online patterns are not tracked
(iv) Suggest an active protection mechanism so that he can find a solution to spam
(v) Suggest one active protection solution to PC Intrusion
Ans)
(i) Firewall
(ii) Anti-Virus and Anti-Spyware software
(iii) Cookies
(iv) Anti-Spam software
(v) Authorization/Authentication/Firewall
QUES: Mr. Seth who is a business man by profession faced following situations. Identify the
type of crime for each situation/incident happened to him?
(i) He was constantly receiving abusive emails
142 | P a g e
(ii) He clicked on an unknown link received as a result his personal sensitive information was
acquired by someone
(iii) Derogatory messages were posted on him online
(iv) His identity was used by someone to steal money
(v) His laptop was controlled by somebody in an unauthorized way
Ans)
(i) Cyber Bullying
(ii) Phishing
(iii) Cyber Trolls
(iv) Identity Theft
(v) Hacking
143 | P a g e