Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Grade XII-IP Self Evaluation (Python Series)

Total questions: 25

Worksheet time: 25mins

Name
Class
Date
1.

data ={‘a’:10.,’b’:11.,’c’:12.}

s =pd.Series(data)

index values of s is __________

a)

0,1,2

b)

10,11,12

c)

a,b,c

d)

10a,11b,12c

2.

Pandas Series is a

a)

one-dimensional labeled array

b)

two-dimensional labeled array

c)

three-dimensional labeled array

d)

multi-dimensional labeled array

3.

s = pd.Series(20, index=[2, 3, 4, 5,6])

print (s) will print 20 ______times

a)

4

b)

5

c)

6

d)

1

4.

Give the output:

s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1]

print(s.loc[1])

a)

10

b)

20

c)

40

d)

50

5.

Give the output:

s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])

print(s.iloc[1])

a)

10

b)

20

c)

40

d)

50

6.

By default Series.tail() function display last ___ rows.

a)

3

b)

4

c)

5

d)

6

7.

__________ function is used to delete an element from series.

a)

delete

b)

drop

c)

remove

d)

pop

8.

___________ method in Pandas can be used to change the index of rows and columns of a Series or Dataframe

a)

rename()

b)

reindex()

c)

reframe()

d)

None of these

9.

Given a Pandas series called “S”, the command which will display the last 4 rows is ________________

a)

print(S.tail(4))

b)

print(S.Tail(4))

c)

print(S.tails(4))

d)

print(S.Tails(4))

10.

Given a Pandas series called “S”, the command which will delete the 1st row(index value 0) ______________

a)

S.delete(0)

b)

S.drop(0)

c)

S.pop(0)

d)

S.del(0)

11.

Given a Pandas series called Sequences, the command which will display the first 4 rows is _______.

a)

print(Sequences.head(4))

b)

print(Sequences.Head(4))

c)

print(Sequences.heads(4)

d)

print(Sequences.Heads(4))

12.

Command to create empty Series is

a)

s=pd.emptySeires()

b)

s=pd.Series(empty)

c)

s=pd.Series()

d)

s=pd.Series(NaN)

13.

Gurjeet has created a Series S but forgot to give the index values. Choose the command that will be used to give index values

a)

S.newindex=[10,20,30,40,50]

b)

S.index=[10,20,30,40,50]

c)

S.Series(index=[10,20,30,40,50])

d)

S.modifyindex=[10,20,30,40,50]

14.

Command to assign a name for the indexes

a)

S.indexname

b)

S.name.index

c)

S.index.name

d)

S.nameindex

15.

A Series represents ________ column(s) in memory.

a)

Single

b)

Double

c)

Multiple

d)

all of these

16.

Pandas Series is capable of holding ______data type.

a)

only integer

b)

only string

c)

only integer and string

d)

any

17.

Write single line Pandas statement to declare a Pandas series named Packets having tuple dataset as: 125, 92, 104, 92, 85, 116, 87, 90

a)

Packets = pd.Series((125, 92, 104, 92, 85, 116, 87, 90))

b)

Packets = pd.Series([125, 92, 104, 92, 85, 116, 87, 90])

c)

Packets = pd.Series({125, 92, 104, 92, 85, 116, 87, 90})

d)

None of the above

18.

Write python series to print scalar value “10” 5 times

a)

s = pd.Series(10, index=[5])

b)

s = pd.Series(10, index=[10,5])

c)

s = pd.Series(10, index=[10*5])

d)

s = pd.Series(10, index=[11,12,13,14,15)

19.

Write a single line command to create a series by given list C and index values

C=[‘red’,’green’,’blue’] , index values=[‘r’,’g’,’b’]

a)

p=pd.Series(C,index=[‘r’,’g’,’b’])

b)

p=pd.Series(list=C,index=[‘r’,’g’,’b’])

c)

p=pd.Series(C])

d)

p=pd.Series(values=C,index=[‘r’,’g’,’b’])

20.

Aman wants to create the series with the following list and index values. He asked his friends for help and received muliple answers from friends. But one of the answers is incorrect, you have to identify the incorrect answer.

List=[‘Laptop’,’Pendrive’,’Harddisk’]

index values=[‘L’,’P’,’H’]

a)

import pandas as pd

L=[‘Laptop’,’Pendrive’,’Harddisk’]

p=pd.Series(list=L,index=[‘L’,’P’,’H’])

print (p)

b)

import pandas as pd

L=[‘Laptop’,’Pendrive’,’Harddisk’]

p=pd.Series(data=L,index=[‘L’,’P’,’H’])

print (p)

c)

import pandas as pd

L=[‘Laptop’,’Pendrive’,’Harddisk’]

p=pd.Series(L,index=[‘L’,’P’,’H’])

print (p)

d)

import pandas as pd

L=[‘Laptop’,’Pendrive’,’Harddisk’]

p=pd.Series(L,[‘L’,’P’,’H’])

print (p)

21.

Write code to display the sum of M1 and M2

M1

1 67

2 90

3 34

4 56

5 77

M2

1 78

2 95

3 67

4 23

5 45

a)

print (sum(M1,M2))

b)

print(M1+M2)

c)

print(M1.add(M2))

d)

print(M1.sum(M2))

22.

Set the series name “Marks1” of M1 series

M1

1 67

2 90

3 34

4 56

5 77

M2

1 78

2 95

3 67

4 23

5 45

a)

M1.seriesname=”Marks1”

b)

M1.name=”Marks1”

c)

M1.newname=”Marks1”

d)

M1.setname=”Marks1”

23.

A Series S is given below:

101 Harsh

102 Arun

103 Ankur

104 Harpahul

105 Divya

106 Jeet

With reference to the above question, write the answer.

Choose the command that will give the following output

102 Arun

103 Ankur

104 Harpahul

a)

print(S.loc[2:4])

b)

print(S.iloc[1:4])

c)

print(S[1:3])

d)

print(S[102,103,104])

24.

A Series S is given below:

101 Harsh

102 Arun

103 Ankur

104 Harpahul

105 Divya

106 Jeet

With reference to the above question, write the answer.

Write the command which will display the rows having name=”Ankur”

a)

print(S==”Ankur”)

b)

print(S[S.”Ankur”])

c)

print(S[S==”Ankur”])

d)

print(S=’Ankur”)

25.

Select the correct statement

a)

import panda as pd

b)

import pandas as pd

c)

import pd as pandas

d)

import pd as panda