Sample Paper General Instruction
Sample Paper General Instruction
___________________________________________________________________________
General Instruction:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 02 questions carrying 04 marks each.
7. Section E has 03 questions carrying 05 marks each.
All programming questions are to be answered using Python Language only
SECTION A – 18 MARKS
a) Size b) Shape
c) Values d) ndim
a) Quartile b) Histogram
c) Mean d) Median
a) character b) separator
c) char d) sep
Q4. Which argument must be set with plotting function for legend() to 1
display the legend ?
a) Data b) Label
c) Name d) Sequence
Q5. To skip first 5 rows of csv file, which argument will you give in read_csv() 1
a) skiprows=5 b) skip=5
c) skip_rows=5 d) noread=5
a) iterate() b) iterrows()
c) itercols() d) iteritems()
(a) 6 (b) 7
Q8. Which of the following commands is used to delete the column ‘Grade’ in 1
the DataFrame df?
(a) df.drop(‘Grade’,axis=1,inplace=True)
(b) df.drop(‘Grade’,axis=0,inplace=True)
(c) df.drop(‘Grade’,axis=1,inplace=False)
(d) df.delete(‘Grade’,axis=0,inplace=True)
Q9. The Teacher needs to know the marks scored by the student with roll 1
number 4. Help her to identify the correct set of statements from the
given option:
Q10. Which of the following command will display the total no of elements in 1
the dataframe? (DataFrame Name: dataframe1)
Select pow(char(98),3);
(a) 5 (b) 7
(c) 0 (d) 8
Q14. The command used to save a plotted graph using pyplot function is------ 1
---------
(a) Many primary keys and many (b) One primary key and one
unique keys.
unique key
(c) One primary key and many (d) Many primary keys and one
unique keys. unique key.
Q16. To skip first 5 rows of CSV file , which argument will you give in 1
read_csv ( )?
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
ii. Both A and R are true and R is not the correct explanation for A
Reasoning(R): Multiple rows functions don’t work with all the rows in
the table.
SECTION B – 14 MARKS
C1 C2 C3
0 13 23 37
1 19 20 21
2 11 12 13
3 13 14 15
b. Write code to drop the index 2 from the above Dataframe. The
Dataframe should be modified after this statement
OR
a. Write the code to display the sum of rows with indexes 2 onwards
from the Dataframe mdf.
Q20. In the table “Student”, Priya wanted to increase the Marks (Column 2
Name, Marks) of those students by 5 who have got Marks below 33. She
has entered the following statement:
import pandas as pd
list1=[-10,-20,-30]
ser = pd.Series(list1*2)
print(ser)
Q23. You have a DataFrame with data about students(rno,name and fees). 2
You want to export the DataFrame to a CSV file. The file should have
the same columns as the original CSV file. Write a Python program to
export the DataFrame to a CSV file.
Q24. Consider the following line graph. Write the code to plot it. 2
SECTION C – 15 MARKS
iii. Display the records in the descending order of sales in the second
quarter
OR
Q28. Consider the table Flight given below, write command in SQL for (i) to 3
(iv) and output for (v) and (vi)
Q29. In a database there are two tables "Product" and "Client" as shown 3
below :
Table: Product
OR
Table: ITEM
Table: BRAND
ICode Brand
101 Sony
202 HP
303 LG
404 IFB
Write MySql queries for the following :
(ii) To display ICode, Price and BName, of the item which has IName as
"Television".
Q30. Write a python code for the following Dataframe Library using python 3
SECTION D – 8 MARKS
TABLE: BLOCKCHAIN
iii. Write a query to display all the transactions done in the month of May.
iv. Write a query to count total number of transactions in the year 2022.
Q32. Draw a double bar graph chart showing the Cities in the X axis and 4
happiness index in the Y axis for Male and Female. Use legends as Male
and Female for identifying purpose.
import pandas as pd
Plot the line graph of data of all the quarters in one chart and also gives
the legends to identify the quarters.
SECTION E – 15 MARKS
iv. To remove all the probable leading and trailing spaces from the
column userid of the table named user.
OR
c. To remove the records of those students whose marks are less than
30.
Q34. Write the code for the following questions on the basis of following 5
DataFrame ‘Sales’
b. Display the sales made by Madhu and Ankit in the year 2016 and
2017
c. Delete the data for sales man Kinshuk from the DataFrame Sales
Stream No of Courses
Stream_1 Science 38
Stream_3 Humanities 30
ii. Write the code to the following dataframe (coursed) in a csv file
named ‘course.csv’ in the given file path. ‘D:\IP\IP_2023-
24\course.csv, but don’t write the column and row
headings/labels.
iii. Read the above csv file and print the middle row
OR
ii. Write the code to store this above data in csv file (‘sales.csv’)
iii. Read the above created csv file according to given below condition:
a. Make sure to read first row as data and not as column header
iv. Write the code to represent the data of csv file in terms of Line
Chart with appropriate title and labels and legend.