Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Test -1 Informatics Practices

Class- XII
Max. Marks – 25

Q1. Create a series ‘COLOURS’ having 4 elements with index labels ‘R’, ‘G’,’B’,’W’ and
data as color names as RED, GREEN, BLUE,WHITE. (1)

Q2. Create a series Friends from a dictionary having roll numbers of 5 of your friends
as keys and their names as data. (1)

Q3. Differentiate between Series and DataFrame? (2)

Q4. Consider the below given code fragments. Will they produce the same output?
Why/Why not? (2)

CODE1 CODE2
A=[5,6,9] A=pd.Series(data=[5,6,9])
Obj1=pd.Series(data=A*2) obj2=pd.Series(data=A*2)
print(obj1) print(obj2)

Q5. What will be the output of the following code? (3)

Q6. Consider two objects X and Y. X is a list and Y is a series. Both have values
10,20,30,100. What will be the output of the following two statements considering that
the above objects have been created already? (3)

1) print(X+2) 2) print(Y+2)
Also justify your answer.
Q7. Give the output of the following code? (6)

Q8. Given a series object S as given below answer the questions-


import pandas as pd
S=pd.Series( data=[2,3,5,4])
a) Calculate the cubes of the series values. (1)
b) Give the output for print(S>3) (1)
c) Give the output for print(S[S>3]) (1)
d) Create another series S2 storing values as 1,2,5,6,4 and then add both the
series and display the result. (2)
e) What will be displayed
S3=S2.sub(S, fill_value=2) (1)
print(S3)
f) Change the values at the 2nd and 3rd row index to 6. (1)

You might also like