0% found this document useful (0 votes)
0 views

UT1class12IP2425

This document is a Unit Test for Class XII Informatics Practices at Nehru World School, Ghaziabad, covering various topics related to dataframes and series in Python using pandas. It consists of multiple-choice questions, very short answer questions, short answer questions, and longer coding tasks, totaling a maximum of 35 marks. The test assesses students' understanding of Python programming concepts, specifically in data manipulation and analysis using pandas.

Uploaded by

suchitnehagarg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

UT1class12IP2425

This document is a Unit Test for Class XII Informatics Practices at Nehru World School, Ghaziabad, covering various topics related to dataframes and series in Python using pandas. It consists of multiple-choice questions, very short answer questions, short answer questions, and longer coding tasks, totaling a maximum of 35 marks. The test assesses students' understanding of Python programming concepts, specifically in data manipulation and analysis using pandas.

Uploaded by

suchitnehagarg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Nehru World School, Ghaziabad

N23S24UTI
Unit Test -1, 2024-25
Class – XII
Subject- Informatics Practices (065)

Name : __________ Time : 1 ½ hours


Roll no. : _________ Maximum Marks: 35
General Instructions :
1. All questions are compulsory.
2. Q-1 to Q-9 are objective type questions carrying 01 mark each.
3. Q-10 to Q-13 are Very Short Answer type questions carrying 02 marks each.
4. Q-14 to Q-16 are Short Answer type questions carrying 03 marks each.
5. Q-17 is carrying 04 marks.
6. Q-18 is carrying 05 marks.
_________________________________________________________________________________________

1. The arithmetic operation between Series of different index will result in __________________.
a) Error b) Wrong Output c) NaN d) NULL
2. Which of the following is not a valid function that can be used with dataframes ?
a) count() b) sum() c) length() d) mad()
3. The command to delete the record with index 1 in a dataframe df is:
a) del df[1] b) df.drop(1)
c) df.pop(1) d) df[1].pop
4. a) To get the number of elements in a series object _____________ attribute may be used.
a) index b) size c) itemsize d) ndim
OR
b) Given a pandas series called Sequences, the command which displays the first four rows is:
a) print(Sequences.head(4))
b) print(Sequences.Head(4))
c) print Sequences.Heads(4))
d) print(sequences.Heads(4))
5. A dataframe can be thought of as a group of multiple series object.
a) True b)False
6. To display the third element of a series object ‘ S’ you will write____________.
a) S[:3] b) S[3] c) S[:2] d) S[2]
7. Consider the following dataframe student :

Roll_No Name Age Marks


1 Arun 18 68
2 Mohit 14 47
3 Karan 13 78
4 Lalit 16 87
5 Ravi 14 60
What will be the command to transpose the data?
a) Student.t b) student.T c) student.transpose d) None of these
8. Consider the dataframe student given above write the command to create a series of names only.
_________________________________________________
9. A dictionary Grade contains the following:
Grade={‘Name’:[ ‘Rashmi’,’Harsh’,’Ganesh’, ‘Priya’,’Vivek’], ‘Grade’:[‘A1’,’A2’,’B1’,’A1’,’B2’]}
What will be the statements create a Dataframe named “Gr”.
a) Gr = pd.DataFrame(Grade) c) Gr = pd.dataframe(dict)
b) Gr = pd.dataframe(grade) d) None of the above.
10. What will be the output of the following python code: 2
import pandas as pd
df = pd.DataFrame([[10,5,5],[20,10,30],[30,15,20]],index=['A','B','C'], columns=['X','Y','Z'])
f1=df.reindex(['B','A','D'])
print(f1)
11. Write a Python code to count the number of rows and columns of a dataframe for 2
studentdata(Stno,Sname,Age,Class).
12. Write a Pandas program to create dataframe from the given dictionary. Assign the data lables as
[‘a’, ‘b’, ‘c’, ‘d’, ‘e’]. Also change the score in row 'd' to11.5. 2
exam = {'name': ['Anastasia', 'Dima', 'Emily', 'Laura', 'Kevin'], 'score': [np.nan, 9, 20, 14.5, np.nan,
19], 'attempts': [1, 3, 2, 3, 2], 'qualify': ['no', 'yes', 'yes', 'no', 'no']}
13. Considering the dataframe ‘student’ given in question 7 , write the command to make the names as
the index of the dataframe. Also write the output of your command.
14. State the similarities and differences of a list, a series and a dataframe. 3
15. Explain the attributes size, shape and ndim with suitable examples.
16. Consider two objects ‘x’ and ‘y’ . ‘x’ is a list and ‘y’ is a series. Both have values 20, 40, 90, 110.
What will be the output of following two statements considering that these objects have already
been created. Also give justification of your answer.
a) Print(x*2) b) print(y*2)
17. Consider the following dataframe, and answer the questions given below: 4
df = pd.DataFrame({'Phy':[20, 40, 50, 44, 30],'Chem':[58, 25, 54, 30, 29], 'Math':[20, 16, 70, 36, 82],
'IP':[80, 37, 55, 80, 60]})
Write the code for the following :
a) Print last three columns .
b) Display subset rows(3,4,5) and cols(first two columns).
c) Remove the rows 3 and 4.
d) Add another column to the dataframe that gives the total of all subjects.
18. Consider the above dataframe of subjects and marks answer the following questions:
a) Add student names as index to the dataframe. 1
b) Create a series of IP marks using the data from dataframe. 2
c) Explain the usage of head and tail functions 2

You might also like