D.A.V. Institutions, Chhattisgarh: Compulsory
D.A.V. Institutions, Chhattisgarh: Compulsory
Code: 065
General Instructions:
This question papercontains five sections, Section Ato E.
2. Allquestions are compulsory.
Section A has 18 questions carrying 0l mark each.
Section B has 07 Very Short Answer type questions carrying 02 marks each.
Section Chas 0s Short Answer type questions carrying 03 marks each.
Section Dhas 02 questions carrying 04 markS each.
Section E has 03 questions carrying 0S marks each.
All programming questions are to be answered using Python Language only.
SECTION A
1. How manv elements will be there in the series named 'S|?
SI =pd.Series(range(5))
print(Sl )
a) 5 b) 4
c)6 None of the above
2. Which method/command is used to delete row or column in a DataFrame ?
(a)delete( ) (b)del
4. Initially in a relation there are 4 tuples and 7 attributes. Ater adding a new revord what will be the
cardinality of that relation
e. 5
b. 8
C
d. 7
1
S. Which of the following SQI. functions is not belong to the multi row functions category?
a) l.ENGTHO b) AVG()
)SUM) d) MIN)
6. To check ifthe Series object contains NaN values. which attribute is used?
(a) hasnan (b) nbytes
(c) ndim (d) hasnans
12. 1fa Dataframe is created using a 2D dictionary. then the indexes/row labels are formed from
b
Series
List of Dictionaries
d.
Structured Ndarray
Al of these
|4. In SQIL, the domain which is not vet assigned is
a. null
represented by ?
b
empty
dummy value
d. 7ero0)
IS, What is the minimun number of
a. 1
arguments required for plot) function in matplotlib?
b. 2
C. 3
d. 4
18. Assertion (A): Insert, Update, Delete, Select are the DMI. commands.
Reason (R): The DMI. commands manipulate the data stored in the database tables.
3
SECTION-B
import pandas as pd
SI-pd.Series(data |35,45,5S,40|)
print( SI<45) # statement1
OR
Sarvani,aData Analy st with a multinational brand has designed the DatalFrame df that contains the
four quarter' s sales data of different stores as shown below:
Store Qtrl Qtr2 Qtr3 Qtr4
Storel 700 300 4S0 200
Store2 9s0 400 500 300
Store3 650 800 100 400
Predict the output of the following python statement:
a.
print(df.iloc[ 1:2.1:3|)
b.
print(df.loc|1,Qtrl )
20. Consider the given SQL. string:
23. Consider the tollowing data frame 'emp' and answer the following
ImpName Salary
Rohit S0000
Vinay 43000
Sahil 70000
Kailash 55000
4 Dipika 35000
a) Write pvthon statement to delete first two records of dataframe.
b) Write python statement to renameSalary' column of dataframe with Wages'.
4
24. Predict the output ofthe given P'ython code: 2
import pandas as pd
Sl-pd.Series( data |10,70)
S2-pd.Series Sl+S)
print(S2)
print(S2*3)
25. What wil be the output of the 2
following code?
import pandas as pd
A-pd.Series(|23.79.53,91,20.65)
print(A.sort aluesascending False))
prnt(s.ndim)
SECTION C
27. Write suitablePython code to create 'Favourite |lobby' Bar Chart based on the given data with
following specifications
X-axis label - hobbies' y-axis label number of' people'
llobbies =|Dance', "Music', "Painting', 'Games' ]|
People |300,400,1 00,500|
Alsogive suitable python statement to save this chart.
5
28. Write M\ SQl statements for the following: 3
i. select truncate(7892.126.-)
i. selcct round( 390S.618,2)
sclect pow(sqrt(l00),2)
OR
You have given a Dataframe df,Write Python command to
The indexes of the Dataframe.
print:
ii. The column names of Dataframe.
The last 3 rows of the Dataframe
(a) Adda new column 'percentage' to the data frame with given
values.
98, 97, 84
(b) Add a new row with values -.
*Gauri', 23, 88, 'Mumbai'
(c) Rename the column Place' with Address'.
SECTIOND
31. ldentify and write answers of the following
a)It isa type of key constraint that follows referential integrity rule.
b) It is total number of tuples in a relation.
6
that contains data about Computer Olympiad
T: Som, a data analyst hasdesioned the Data Erame df
Answer the following questions: 4
.CO2*, CO3', CO4. 'COS' as indeses shown below.
SECTION E
iii. To remove the records of'those departments whose periods are less than 20.
iv. To add a new column duration of suitable datatype.
To display record of teacher with id as TI0.
34. Answer the following
) What is CSV? Name the detault delimiter character ofCSV files?
ii) What do you understand bv Boolean indexing?
ii) Out of Series and Dataframc, Which Pandas Objcct cannot grow n SI7e:
5
35. Given the following set of data ie. Weish measurements for I6 small orders of Irench-tries
Weigh(in grams) |78 72 69 81636765 75 79 74 71 8371 79 80 69|
Write suitable Pthon code to gCnerate a histogram based on the given data. along witn an
appropriate chart title and both axis labels. Also give suitable python statement to save this cnart.
OR
Consider the tollow ing graph. Write the code to plot it. Label the X and Y axis.
19
18
Marks
sccured
17
16
151
14
A 13
12
1-0 1-5 2-0 2-5 3-0 3-5 4-0 4-5 5-0
Tests
Also give suitable python statement to save this chart as pdf.
2 |
2.S.
2^
| -