You are on page 1of 6

Kendriya Vidyalaya Jetpur (Pedhla)

Periodic Test – 1
Subject : IP
Total Marks : 40 Time : 90 minutes

Following Instructions:
1) Question 1 to 40 Are multiple choice objective type questions .
2) Total 40 questions and 1 mark per question

1. #Write the output of following code


import pandas as pd
S1= pd.Series([1,2,3,4])
S2= pd.Series([7,8])
S3= S1 + S2
print (S3.size)
A) 2 C)6
B) 4 D)8

Code: Mr. Sharma is working in a game development industry and he was comparing the
given chart on the basis of the rating of the various games available on the play store

He is trying to write a code to plot the graph. Help Mr. Sharma to fill in the blanks of the
code and get the desired output.

import__________________________ #Statement 1
Games=["Subway Surfer", "Temple Run", "Candy Crush", "Bottle Shot", "Runner Best"]
Rating=[4.2,4.8,5.0,3.8,4.1]
plt.______________(Games, Rating) #Statement 2
plt.xlabel("Games")
plt.______________("Rating") #Statement 3
plt._______________ #Statement 4

2. Choose the right code from the following for statement 1.


A) matplotlib as plt C) pyplot as plt
B) matplotlib.pyplot as plt D) matplotlib.plt as pyplot

3. Identify name of function that should be used in statement 2 to plot above graph
A) line() C) barh()
B) hist() D) bar()

4. Choose the correct option for the statement 3


A) title (“Rating”) C) ytitle (“Rating”)
B) ylabel (“Rating”) D) yaxis (“Rating”)

5. Choose the right function/method from the following for the statement 4.
A) display() C) bar()
B) print() D) show()

6. In case Mr. Sharma wants to change the above plot to the any other shape, which
statement, should he change.
A) Statement 1 C) Statement 2
B) Statement 3 D) Statement 4

7. Write a command to install pandas in python


A) pip install C) install pip
B) pip install pandas D) pandas install pip

8. Series is which type of data ?


A) Homegeneous C) Hetrogeneous
B) Both D) None

9. Which is Hetrogeneous type of data in pandas ?


A) Series C) DataFrame
B) Both D) None

10. What does axis=1 represents in data frame?


A) Row B) Column
B) Both D) None of above

11. In data science for data analysis, which of the python library are more popular ?
A) Pandas C) Django
B) Swift D) OpenCv

12. Pandas Libarary is mainly used for _____ in ______ filed for Python.
A) Critical Thinking, Object Oriented Programing
B) Indexing, Game Development
C) Graphic Designing, Computer Vision
D) Data Analysis, Data science
13. Which of the following is used to get the "number of dimensions" of a Series object ?
A) index C)itemsize
B) size D)ndim

14. Which function is used to print last elements(x) in Series/DataFrame in Pandas ?


A) head() C) rename()
B) tail() D) remove()

15. Size in Series is


A) Mutable C) Both
B) Immutable D) Can’t Say

16. Values of data in DataFrame are


A) Mutable C) Both
B) Immutable D) Can’t Say

17. Series are which type of data in pandas


A) 1D C) 3D
B) 2D D) All of above

18. Which of the following thing can be data in Pandas?


A) a python dict C) an ndarray
B) a scalar value D) all of the mentioned

19. Minimum number of argument we require to pass in pandas series ?


A) 0 C) 2
B) 1 D) 3

20. Which is not types of matplotlib plot from following ?


A) Bar Graph C) Histogram
B) Line Plot D) Series

21. Sorting can be done in dataframe by using


A) By Index C) By Both
B) By Value D) Only one

22. Write a syntax for empty series .


A) pd.Series() C) pd.series(empty)
B) pd.Series(nAn) D) pd.Series(0)

23. Which of following are not part of pandas library ?


A) Series C) pyplot
B) DataFrame D) All are not part of Pandas
Q. Code : Ayush, a student of class-XII in KVS JETPUR, has been assigned a code to
create a pandaseries S1, shown below.
a 100
b 200
c 300
d 400
e 500
[dtype: int64]
With reference to the above answer given questions:

24. Choose the command that will give the following output
b 200
c 300
dtype: int64
A) print(S1[:3]) C) print(S1[1:3])
B) print(S1[0:3]) D) print(S1[2:4])

25. Help him to identify the correct statement that can be used to extract the value with the
index 'c'
A) print(S1[c]) C) print(S1(c))
B) print(‘S1’[c]) D) print(S1[‘c’])

26. Which of the following command will give the following output
b 200
d 400
A) print(S1.iloc[1:4]) C) print(S1.iloc(1:4))
B) print(S1.iloc[2:4]) D) print(S1.iloc[1:4:2])

27. Which of the following command will display the series by adding 10 in eachvalue.
A) print (S1 [+10]) C) print(S1 + 10)
B) print(S1) + 10 D) print(S1) + print (10)

28. Ayush wants to delete the value against index 'd'. Help him to choose the suitable option:
A) S1= S1.drop(d) C) S1= drop(‘d’)
B) S1= S1.drop(‘d’) D) S1= S1.drop[‘d’]

29. Which Syntex is used to save the plot in the code in Matplotlib?
A) plt.savefig() C) plt.savef()
B) plt.fig() D) plt.figsave()

30. ____ provides state machine interface to plotting library in Matplotlib.


A) Pandas C) Series
B) DataFrame D) pyplot
31. Which command is used for combining/merging dataframes in pandas
A) pd.merge() C) pd.combine()
B) pd.delete() D) pd.show()

32. Head Function is used to print last elements(x) in series/dataframes in pandas ?


A) True C) Can’t say
B) False D) Both

33. import pandas as pd


import numpy as np
kvs = [10,11,12]
jtp = pd.Series (kvs)
print(jtp)
#What will be output of prog ?

A) 0 10 C) 1 10
1 11 2 11
2 12 3 12
B) [10,11,12] D) Error

Q. Match the following with reasoning.


i) Pandas p1) Data visualization
ii) Matplotlib p2) Series
p3) Bar Graph
p4) Data Analysis

34. Which Pair will be match Pandas (i) ?


A) p1,p2 C) p1,p3
B) p2, p4 D) p3,p4

35. Which Pair will be match Matplotlib (ii) ?


A) p1,p2 C) p1,p3
B) p2, p4 D) p3,p4

36. Which syntax is used to perform sorting using index


A) sort_values() C) sort()
B) sort_index() D) sort_dataframe()
37. import pandas as pd
import numpy as np
kvs = [‘IP’, ‘ACC’]
jtp = PD1.series (KVS)
print(jtp)
#What will be Output of prog?

A) 0 IP C) ERROR
1 ACC

B) [IP ACC] D) {IP , ACC}

38. import pandas as pd


import numpy as np
kvs = [‘Jetpur’, ‘Junagadh’, ‘Dhoraji’, ‘Rajkot’]
jtp = pd.dataFrame (pd)
print (kvs.jtp)
#Programe is right or will give error ? if it’ll give error how many errors are there ?

A) No Error, Prog will give output C) 2


C) 1 D) 3

39. What does axis=0 represents in data frame?


A) Row C) Column
B) Both D) None of above

40. In Both Series & DataFrame , data values are mutable.


A) True C) None
B) False D) Can’t say

You might also like