Class 12 Informatics Practices
Multiple Choice Questions
Data Handling Using Pandas – I MCQs
Data Handling Using Python Pandas – 1 (Set 3)
Topics Covered : Series [Set – 3]
41. In the given code , a series is created from ______ values.
>>> import numpy as np
>>> import pandas as pd
>>> list1 = np.array([1, 2, 3, 4] )
>>> ser1 = pd.Series(list1)
a. Scalar Value
b. List
c. NumPy Array
d. Dictionary
42. When index labels are passed with the array, then the length of the index and array must be of the __________.
a. same size
b. same value
c. same type
d. None of these
43. Identify the error generated by following code :-
>>> ser1 = pd.Series ( [1, 2, 3, 4, 5, 6], index = [5.5, 7.6, 9.8, 1.3] )
a. KeyError
b. ValueError
c. TypeError
d. LengthError
44. Can you create a Series object using Dictionary ?
a. Yes
b. No
45. A value from dictionary can be accessed easily by using _______.
a. key
b. index
c. value
d. None of these
46. Dictionary _______ can be used to construct an index for a Series.
a. Values
b. Keys
c. Index
d. None of these
Direction: On the basis of given code, answer the Question Number 47 to 49.

47. What is the index of series S1.
a. [0,1,2,3]
b. [‘a’, ‘b’, ‘c’, ‘d’]
c. [‘India’, ‘Japan’, ‘Bihar’]
d. [‘New Delhi’, ‘Tokyo’, ‘Patna’]
48. What is the output of statement- print(S1[‘India’])
a. New Delhi
b. Japan
c. India
d. Error – KeyError will raise.
49. What is the output of statement- print(S1)
a.

b.

c.

d. None of these
Direction: On the basis of given code, answer the Question Number 50 to 52.
import pandas as pd
series1 = pandas.Series(range(5)
print(series1)
50. What is the index values of series1.
a. 0, 1, 2, 3, 4
b. 1, 2, 3, 4, 5
c. a, b, c, d, e
d. None of these
51. What is the values of series1.
a. 0, 1, 2, 3, 4
b. 1, 2, 3, 4, 5
c. a, b, c, d, e
d. None of these
52. What is the data type of series1.
a. int8
b. int16
c. int32
d. int64
53. >>> import pandas as pd
>>> series1 = pd.Series( range(1,18,3), index = {x for x in ‘python’} )
Write the index value of series1.
a. ‘p’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’
b. 0, 1, 2, 3, 4, 5
c. 1, 2, 3, 4, 5, 6
d. Error
54. _________ is use to indicate missing or null values in pandas.
a. NULL
b. EMPTY
c. NaN
d. None
55. NaN is _______ data type value..
a. Integer
b. Float
c. Boolena
d. String
56. NaN is an attribute of _______ library.
a. pandas
b. matplotlib
c. numpy
d. None
57. Write a statement to create a series with given value [1.5, 5.6, Missing Value, 9.0]. (Assume pandas is imported as pd and numpy is imported as np).
a. series1 = pd.Series( 1.5, 5.6, ‘np.NaN’, 9.0)
b. series = pd.Series([ 1.5, 5.6, ‘np.NaN’, 9.0 ] )
c. series = pd.Series([ 1.5, 5.6, NaN, 9.0 ] )
d. series = pd.Series([ 1.5, 5.6, np.NaN, 9.0 ] )
58. Identify the error in the given statement: (assume pandas is imported as pd)
>>> series1 = pd.Series( [2, 5, 6, 8], index = [‘a’, ‘v’, ‘d’] )
a. KeyError – Length of values must be equal to length of index
b. ValueError – Length of values must be equal to length of index
c. No Error
d. None of these
59. Identify the error in the given statement: (assume pandas is imported as pd)
>>> series1 = pd.Series( 200, index = [‘a’, ‘v’, ‘d’] )
a. KeyError – Length of values must be equal to length of index
b. ValueError – Length of values must be equal to length of index
c. No Error
d. None of these
60. What is the output of given code: (assume pandas is imported as pd)
>>> series1 = pd.Series( 200, index = [‘a’, ‘v’, ‘d’] )
>>> print(series1)
a. a 200 v 200 d 200 dtype: int64
b. a 200 v NaN d NaN dtype: int64
c. a 200 dtype: int64
d. None of these