Class 12 Informatics Practices Data Handling using Python Pandas-I MCQs Set 3


By Anjeev Kr Singh – Computer Science Educator
Published on : November 8, 2021 | Updated on : December 12, 2021

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

Answer: c. NumPy Array

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

Answer: a. same size

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

Answer: b. ValueError

44. Can you create a Series object using Dictionary ?

a. Yes

b. No

Answer: a. Yes

45. A value from dictionary can be accessed easily by using _______.

a. key

b. index

c. value

d. None of these

Answer: a. key

46. Dictionary _______ can be used to construct an index for a Series.

a. Values

b. Keys

c. Index

d. None of these

Answer: b. Keys

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’]

Answer: c. [‘India’, ‘Japan’, ‘Bihar’]

48. What is the output of statement- print(S1[‘India’])

a. New Delhi

b. Japan

c. India

d. Error – KeyError will raise.

Answer: c. [‘India’, ‘Japan’, ‘Bihar’]

49. What is the output of statement- print(S1)

a.

b.

c.

d. None of these

Answer: a.

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

Answer: a. 0, 1, 2, 3 , 4

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

Answer: a. 0, 1, 2, 3 , 4

52. What is the data type of series1.

a. int8

b. int16

c. int32

d. int64

Answer: 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

Answer: a. ‘p’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’

54. _________ is use to indicate missing or null values in pandas.

a. NULL

b. EMPTY

c. NaN

d. None

Answer: c. NaN

55. NaN is _______ data type value..

a. Integer

b. Float

c. Boolena

d. String

Answer: b. Float

56. NaN is an attribute of _______ library.

a. pandas

b. matplotlib

c. numpy

d. None

Answer: c. numpy

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 ] )

Answer: 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

Answer: b. ValueError – Length of values must be equal to length of index

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

Answer: c. No Error

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

Answer: a.

a   200
v   200
d   200
dtype: int64


More MCQ’s are coming soon
Keep Visiting www.mycstutorial.in
Important for Term 1 Examination


Class 12 Informatics Practices – Data Handling using Pandas – I Multiple Choice Questions



Class 12 Informatics Practices Societal Impacts Important Multiple Choice Questions




About the Author

Anjeev Kr Singh

Anjeev Kr Singh

Computer Science Educator, Author, and HOD. Guiding CBSE students in CS, IP, IT, WA & AI via mycstutorial.in. Creator of Question Bank for Class 10 & 12 students.

You cannot copy content of this page

Scroll to Top