KENDRIYA VIDYALAYA NO.
1 ICHHANATH SURAT
PT-I TEST (JULY 2019)
SUB. : I.P. MARKS : 40
CLASS: XII DURATION : 90 MIN.
Q. Question Marks
1 Find the error (Four Errors) 2
import numpy
a1 = [Link]( [ [1,2,3,4] ] )
L1= [1,2,3,4]
print(L1+2)
print(a1+2)
L1[2:4]=-5
a1[2:4]=5
2 Find Output 3. Create an ndarray with values ranging from 10 2+2
to 50 each spaced with difference of 5
A=[Link](10)**3
print(a)
print(a[2:9:3)
4 Find Output (2 marks) 5 Write the shape of the following nd array (any two) 3+1
(a)
a1=[Link](1,26,1) 2 4 6 8
a2=[Link](5,5) (b)
x= a2[0][2]+a2[-2][-4] 2
y = a2[1,3]=44 4
z=a2[2:4] 6
w=a2[:3,:3]
print(x, y, z, w) // assume in separate line (c)
1 2 3 4
5 1 7 8
6 Predict the output of the following code Write two difference between Numpy Array with 2+2
fragment : Python Lists type objects.
x=[1,2,3,99,99,3,2,1)
x1,x2,x3 = [Link] (x, [3,5] )
print(x1, x2, x3)
7 Find Output (2 marks) 8. Write difference between iloc() and loc() function of 2+2
g=[Link]( [ [9,8,7], python pandas.
[6,5,4],
])
y = [Link]( [ [99],
[99]
])
R=[Link]( [g,y])
print((R)
9 Given a data fram namely data as shown 2
in adjacent figure (fruit names are row Color count price
labels), write code statement to(any two) Apple Red 3 120
(a) Find al the rows with the label Apple Green 9 110
Apple extract all columns Pear Red 25 125
(b) List only the columns count and Pear Green 26 150
price using loc Lime Green 99 70
(c) List only rows with labels Apple
and pear using loc
10 A dataframe fdf stores data about 2
passengers, flights and years. First few Year Month Passengers
rows of dataframe are shown as 0 2009 January 112
adjoining figure 1 2009 February 118
2 2009 March 132
Using above dataframe write commands 3 2010 January 129
for the following 4 2010 Febrary 121
(a) Compute total passengers per
year
(b) Computer average passengers
per month
11 Write two difference between Write command to apply() , and applymap() function 2+2
pivot_table() and pivot() function when [Link] on the dataframe named [Link]
both are performing pivoting. Separately each command
12 Write one difference between Line Chart Write the output of the following code 2+2
and Scatter Chart and also write the import [Link] as pl
name of functions used to create line X=[Link](4)
chart and scatter chart Y=[5, 25, 45, 65]
[Link](-2, 4)
[Link](x,y)
[Link](“A Sample Bar Chart”)
[Link]()
13 What is pyplot ? is it a Python Library? 14 Find the errors 2+2
(assue all libraries are imported)
A=range(10,50,12)
B=range(90,200,20,40,40,30)
[Link](A,B)
14 Given a data frame df1 as shown below 15 2+2
MinTemp MaxTemp RainFall
1990 2000 2010
A 52 340 890 0 20 30 2.3
B 64 480 560 1 30 45 3.5
C 78 688 1102 2 25 32 5.5
D 94 766 889 3 28 30 5.6
5 23 25 6.0
Write code to create
(a) Write a command to calculate minimum value
(a) A Line chart from 1990 and 2010 for each of the column
columns of data frame df1 (b) Write command to calculate variance for the
(b) Create a bar chart plotting the column rainfall
three columns of dataframe df1
16 Write difference between reindex() and 2
reindex_like() function with example.
TOTAL
***
KENDRIYA VIDYALAYA NO. 1 ICHHANATH SURAT
PT-II TEST (AUG 2019)
SUB. : I.P. MARKS : 40
CLASS: XII DURATION : 90 MIN.
Q. Question Marks
1 What is Histogram? How is it useful? 2
2 Create a box plot from the following set of data (Horizontal Orientation). And Also Add a title 2
“Horizontal Boxplot”, xAxis Title as “Value-Range”,
34, 18, 100, 27, 54, 52, 93, 59, 61, 87, 68, 85, 78, 82, 91
3 Find Output (Assume All required modules are imported) 2
X=[Link](4)
Y=[5, 25, 5, 20]
[Link](X,Y)
[Link](“A Simple Bar”)
[Link]()
4 Write the difference between Line chart and Scatter Chart (2 difference min) 2
5 Write python code to draw the 2
graph as given beside
(It’s a cos graph use
values are from 1,25, with step of
1.25)
take COS value of each value
6 2
Write the code to draw the following scatter graph
X = values are from 1 to 5
Y = square of X values
(No need to write output in different colors)
7 Val is a list having three lists inside it. It contains summarisied data of three different trials 3
conducted by company ABC. Create a bar chart that plots these three sublists of Val in a single
chart. Keep the width of each bar as 0.25. Also Change the color of each set of of Bars
I Bar Sets as as Blue=’b’, II Set of Bars as green=’g’, 3rd Set of Bars as red=’r’)
8 Consider the code given below (all required libraries ar imported) and the ouput produced by it. 3
Why is the chart showing one bar only while we are the plotting four values on the chart.
A=[3,6,9,12]
B=[30,48,54,48]
[Link](-3,5)
[Link](a,b)
[Link]()
Also correct the code to print al the four bars
9 Find output 2
X=[10,20,30,40,50]
Y=[2,4,6,8,10]
[Link](X,bins=10, cumulative=True)
[Link]()
10 Find the Ouptut 2
X=[10,10,50,40,20,20,20,30,20,10]
Y=[20,40,50,70,100]
[Link](X,bins=[10,20,30,40,50], histtype='step' )
[Link](1,10)
[Link]()
11 Write the types of various histograms that can be created through hist() function ? 2
12 What is a box plot? What are the different arguments taken by boxplot() function. 2
13 [Link](p,q,’k’,’d’,’5,’red’) 2
Write the description of the argument what it indicates i.e.
p, q, k, d, 5, red
14 How engineering is different from and software engineering 2
15 What do you understand by feasibility study? 2
16 What are the two main drawback of spiral model? 2
17 Write the difference between validation and verification? 2
18 Describe in brief all the phases waterfall model. 4
Total 40
KENDRIYA VIDYALAYA NO. 1 ICHHANATH SURAT
HALF YEARLY EXAM. (OCT 2019)
SUB. : I.P. MARKS : 40
CLASS: XII DURATION : 90 MIN.
Section A
Q. Question Marks
No.
1 Create an nd array with values ranging from 5 to 50 each spaced with a difference of 2
5 (using Numpy Array)
2 Write the two difference between numpy arrays and List (with example) 2
3 An ndarray X contains the following data : (any two) 2
[ [0 1 2 3 ]
[4567]
[ 8 9 10 11 ]
[ 12 13 14 15 ]
]
What will be returned by the statements?
(a) print ( x[02, 0:2] )
(b) print ( x[ 2:0, 2:0] )
(c) print ( x [2:0:-1, 2:0:-1] )
4 Consider following two arrays: 2
Ar1 =
array ([ [0, 1, 2],
[3, 4, 5],
[6, 7, 8] ] )
Ar2 =
Array ( [ [10, 11, 12],
[13, 14, 15],
[16, 17, 18] ])
Write command to concatenate Ar1 and Ar2 : (a) row-wise (b) column-wise.
5 Write commands to split the following array depicted below. Give alternate solutions. 2
array ( [ [ 0, 1, 2 Ar2 =
Array ( [ [10, 11, 12],
[13, 14, 15],
[16, 17, 18] ])
, 3, 4, 5,],
[ 6, 7, 8, 9, 10, 11],
Array( [ [ 0, 1] array( [ [ 2, 3], array( [ [ 4, 5],
[ 6, 7], [ 8, 9], [ 10, 11],
[12, 13] ]) [14, 15] ]) [16, 17] ])
6 What is the different between reindex() and reindex_like() function (with example) 3
Write the command for
Reindex dataframe wdf so that two new row get added to it while the previous data
is retained. Fill the new row with values 10.0.
7 Find Ouput 3
def increment (n) :
n. append ([49] )
return n [ 0 ] , n [ 1 ], n[ 2 ], n [ 3 ]
L = [23, 35, 47]
m1, m2, m3, m4 = increment(L)
print (L)
print (m1, m2, m3,m4, len(L) )
print (L [3] == m4)
8 What following commands are doing ? 3
(a) df .pivot_table(df, index = ‘rows’ , columns = ‘cols’ , values = ‘values’ ,
aggfunc = [Link]).
(b) df .grouoby ([‘key1’ , ‘key2’ ,] )[ [ ‘co1A’ , ‘co1B’]].sum( )
( c) [Link][row_selection, co1_list] .sum ( )
9 Compare bar ( ) and barh( ) functions. 2
10 Given a data frame df1 as shown below 3
1990 2000 2010
(a) 52 340 890
(b ) 64 480 560
(c ) 78 688 1102
(d ) 94 766 889
Write code to creat :
(a ) A scatter chart from the 1990 and 2010 columns of dataframe df1
( b) A line chart from the 1990 and 2000 columns of dataframe df1
(c ) create a bar chart plotting the three columns of dataframe df1
11 Given the following set of data : 2
Weight measurements for 16 small orders of French fries (in grams).
78 72 69 81 63 67 65 75
79 74 71 83 71 79 80 69
( a ) create a simple histogram from above data
( b) create a horizontal histogram from above data
( c) create a step type of histogram from above data
( d) create a cumulative histogram from above data
Or
Write difference between iloc() and loc() function of python pandas.
SECTION B 0
12 What is feasibility study ? 1
13 Why is, scalability, an important factor in software development ? 1
14 What are the quality of the good software ? 2
15 Write two difference between water fall model and spiral model 2
16 What is the need of software engineering 2
17 What is the agile software development ? 2
18 What is scrum ? 1
19 What is the difference between a commit and a push request on a version control 2
system ?
20 Write a short note on Git, . 1
SECTION C 0
21 Define the following Term with respect to a Database terminology (any four) 2
Degree Domain Primary Key Cardinality
22 Differential between CHAR and VARCHAR datatypes. 1
23 Write two advantages of MySql Database. 2
24 Write the output of following Queries ( 5 x 1 ) = 5 5
(a) SELECT DISTINCT SAL FROM EMP ;
(b) SELECT ENAME FROM EMP WHERE ENAME LIKE '_ _A%' ;
(c) SELECT JOB, SUM(SAL), MIN(SAL), FROM EMP GROUP BY JOB
(d) SELECT 2 * 2 FROM DUAL ;
(e) (e) SELECT JOB, COUNT(*) FROM EMP GROUP BY JOB ;
25 Write SQL Queries for following 5
(a) WRITE A QUERY TO DISPLAY ENAME AND SAL OF EMPLOYEES WHOSE
SALARY IS GREATER THAN OR EQUAL TO 3000 FORM TABLE EMP
(b) WAQ TO DISPLAY NAME, JOB, SALARY OF THOSE EMPLOYEE WHO ARE
HIRED IN 1981
(c) Insert a Record in the Employee Table with the following Data
2, Jagannath , Mishra , jmishra 4000) ;
(d) WRITE A QUERY TO DISPLAY THE SUM, AVERAGE, HIGHEST AND LOWEST
SALARY OF THE EMPLOYEES GROUPED BY DEPARTMENT NUMBER AND SUB-
GROUPED BY JOB
(e) WRITE A QUERY TO DISPLAY THE NUMBER OF EMPLOYEE WITH THE SAME
JOB
26 What do you understand by Referential Integrity 2
27 Write the difference between Having and Where Clause in SQL 1
28 Write the difference between following two commands 2
Select count(Comm) from emp
Select count(*) from emp
60
EMP TABLE
TABLE STRUCTURE
Name Null? Type
------------------------------- -------- ----
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
RECORDS
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
--------- ---------- --------- --------- --------- --------- - -------- ---------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
DEPT TABLE
TABLE STRUCTURE
Name Null? Type
-------------------------- -------- ----------
DEPTNO NOT NULL NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
RECORDS
DEPTNO DNAME LOC
--------- -------------- ----------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
3
OR
Write a NumPy program to create a 3x3 identity matrix, i.e. non
diagonal
elements are 1, the rest are 0. Replace all 0 to random number
from 1 to 10
Find the output of the following code: 3
import pandas as pd
data = [{'a': 10, 'b': 20},{'a': 6, 'b': 32, 'c': 22}]
#with two column indices, values same as dictionary keys
df1 = [Link](data, index=['first', 'second'], columns=['a',
'b'])
#With two column indices with one index with other name
df2 = [Link](data, index=['first', 'second'], columns=['a',
'b1'])
print(df1)
print(df2)
3
3
3
3
3
3
3
3
0
4
4
70
KENDRIYA VIDYALAYA NO. 1 ICHHANATH SURAT
PT-I TEST (AUG 2021)
SUB. : I.P. MARKS : 40
CLASS: XII DURATION : 90 MIN.
Q. Question Mar A
ks n
s
1 Fill in the blank 1 C
s = [Link]([1,2,3,4,5],____________= ['a','b','c','d','e'])
(a) key (b) values (c) index (d) indices
2 To get the third element of a series you need to write : 1 A
(a) s[2] (b) s[3] (c) s[:2] (d) s[:3]
3 Find Output 1 B
S1 = [Link]([1,2,3,4,5],index = ['a','b','c','d','e'])
S2 = [Link]([1,2,3,4,5],index = ['a','b','c','d','f'])
print(S1+S2)
(a) (b) (c) (d)
a-2 a-2.0 a-2 a-2.0
b-4 b-4.0 b-4 b-4.0
c-6 c-6.0 c-6 c-6.0
d-8 d-8.0 d-8 d-8.0
e-10 e-Nan e-10 e-Nan
f-10 f-Nan f-NaN f-10
4 Find Output of following code 1 A
s=[Link]()
print ([Link])
(a) (0,) (b) (0,0) (c) (0,1) (d) None
5 Find the Incorrect statement 1 D
(a) Series is size immutable data structure
(b) Series is homogeneous data structure
(c) Series indexes by default starts with 0
(d) With Series object iloc() function can not be used
6 S1 = [Link]([1,2,3,4,5],index = ['a','b','c','d','e']) 1 C
Which of the following will not give same result (odd one out)
(a) S[:3] (b) [Link][:3] (c) [Link][:3] (d) s[0:3]
7 The Axis 1 identifies a dataframe’s ………………… 1 B
(a) rows (b) columns (c) values (d) datatypes
8 To delete a row from a dataframe , you may use statement………. 1 C
(a) remove (b) del (c) drop (d) cancel
9 Data points plotted on a graph are called ………………………… 1 D
(a) points (b) pointers (c) marks (d) markers
10 ………………………….. and ………………….. functions help you to iterate over a 1 A
dataframe
(i) iterrows() (ii) itermitems() (iii) itermcols
(a) I, II (b) II, II (c) I,III (d) I,II,III
11t Question No 11-15 are based on following Data Frame (df) * *
o1 A B C
5 0 15 17 19
1 16 18 20
2 20 21 22
11 Which of the following statement will replace all the values of column C as Not a 1 A
Number
(a) df[‘C’]=[Link] (b) df[‘C’] = NULL
(c ) df[‘C’ ] = NAN (d) df[‘C’] = “”
12 Which of the following will generate error 1 B
(a) df[‘C’]=[Link] (b) df[‘C’] = [2,5]
(b) df[‘C’] = [12,15,18] (d) None of the above
13 Which statement will find the maximum values in Column A 1 C
(a) [Link]() (b) df['A'].max()
(c) Both a and b (d) None of the Above
14 [Link] will print the values 1 B
(a) (4,3) (b) (3,3) (c) 3, (d) 3,1
15 After executing the statement [Link]([0]) data frame will have value of 1 A
16 Question No 16 to 20 are based on following Data Frame (df) ** **
to
20 MARKS
Tests Rohit Suman
Unit1 85 97
Unit2 88 99
Unit3 79 90
Unit4 67 75
16 Fill in the blank 1 D
import matplotlib._________ as Plt
Tests= [‘unit1’, ‘unit2’, ‘unit3’, ‘unit4’]
Rohit [85,88,79,67]
Suman= [97,99,90,75]
(a) plot (b) python (c) graph (d) pyplot
17 Plt.________(Tests,Rohit,Suman) # To draw a line chart 1 B
(a) Line (b) Plot (c) Bar (d) DrawLine
18 ______________ # Label Y Asis as Marks 1 C
(a) [Link](“Marks”) (b) [Link](“Marks”)
(c) [Link](“Marks”) (d) [Link](“marks”)
19 ______________ # Add Legent “Rohit”, “Suman” for the lines 1 C
(a)[Link]() (b)[Link](‘Rohit’,’Suman’)
(c)[Link]([‘Rohit’,’Suman’] (d) [Link](‘Rohit’,’Suman’)
20 Which function is necessary at the end of the graph to display graph on the screen 1 A
(a) [Link]() (b) [Link]() (c) [Link]() (d) [Link]()
21 Question No 21 to 26 are based on following : * *
to
25 DF
rno name marks
0 1 veena 30
1 3 alok 40
2 5 tisha 50
3 7 tanvi NaN
21 total1= [Link](axis=0) 2 A
print(total1) will give the result
(a) rno 4 name 4 marks 3 (b) rno 4 names – marks 4
(c ) rno 4 name 4 marks 4 (d ) rno =3 names 0 marks 4
22 To fill the missing values in the DF the correct method / function is 2 C
(a) [Link]('B') (b) [Link](0) (c) both A and B (d) None of the above
23 To Find the maximum values only in column Marks and rno correct method is 2 D
(a) df[ 'A','B' ].max(axis=0) (b) df[ 'A','B' ].max(axis=1)
(c) df[ ‘A’ and ‘B’ ].max() (d) df[ ['A','B'] ].max()
24 To Add a New column named percent, which is calculated as marks*100/500 what 2 A
is the correct code given as below
(a) df['percent']= df['marks']*10/500
(b) df[' percent ']= marks * 10/500
(c) df[' percent ']= [Link] * 10/100
(d) All of the Above
25 [Link]=['aa','bb','cc','per'] #1 2 B
[Link]=['first','second','third'] #2
for given above two statement what is the correct
(a) #1 will change the row labels of data frame and #2 will change Column
Names
(b) #1 will change the column labels of data frame and #2 will change row
labels of data frame
(c) Both above statements are correct
(d) Both Above statements are incorrect
26 All Pandas Data Structure are ________________ mutable but not always __________ 2 C
mutable
(a) size, values
(b) semantic, size
(c) value, size
(d) None of the Above
27 [Link] [3:7, 3:6] will display 2 A
(a) Row No 3 to 6 and column no 3 to 5
(b) Row No 3 to 7 and column no 3 to 6
(c) Column No 3 to 6 and row no 3 to 5
(d) Column No 3 to 7 and row no 3 to 6
28 2 B
For the Given Code Output Will be
(a) key data (b) key data (c) key data (d) key
data
5 A A 5 A 25 A 0
7 B B 7 B 49 B 0
9 C C 9 C 81 C 0
29 Mr. Ankit is working in an organization as data analyst. He uses Python Pandas and ** **
to Matplotlib for the same. He got a dataset of the passengers for the year 2010 to 2012
30 for January, March and December. His manager wants certain information from him,
but he is facing some problems. Help him by answering few questions given below:
29 He wants to print the details of "January" month along with the number of 2 B
passengers, Identify the correct statement:
a. p=[Link] [ df3['month']=='jan' ]
b. p=[Link] [ df3['month']='jan' ]
c. s= [ [Link]=='jan' ]
d. s=[Link] [ month=='jan' ]
30 2 A
import pandas as ____________ #Statement 1
data={"Year":[2010,2010,2012,2010,2012],"Month":
["Jan","Mar","Jan","Dec","Dec"],"Passengers":[25,50,35,55,65]}
df=pd.____________________(data) #Statement 2
print(df)
(a) pd, DataFrame (b) DataFrame, pd (c) Alias, Frame (d) pd, Series
***