PART 1 PANDAS SERIES QUESTION FOR CLASS XII BOARD EXAM

PYTHON – PANDAS SERIES (MCQs)

Q1. Which of the following is used to create a Pandas Series?

A. pd.series()
B. pd.Series()
C. pd.createSeries()
D. pd.makeSeries()

Answer: B (pd.Series())


Q2. A Pandas Series is a:

A. 2-dimensional array
B. 3-dimensional array
C. 1-dimensional labeled array
D. Unlabeled array

Answer: C (1-dimensional labeled array)


Q3. Which library must be imported to use Pandas Series?

A. numpy
B. pandas
C. matplotlib
D. seaborn

Answer: B (pandas)


Q4. What will be the output of the following code?

import pandas as pd s = pd.Series([10, 20, 30]) print(s[1])

A. 10
B. 20
C. 30
D. Error

Answer: B (20)


Q5. What are the default index values of a Pandas Series?

A. 1, 2, 3
B. a, b, c
C. 0, 1, 2
D. None

Answer: C (0, 1, 2)


Q6. Which of the following can be used as data for a Pandas Series?

A. List
B. Dictionary
C. NumPy array
D. All of the above

Answer: D (All of the above)


Q7. How do you create a Series with custom index?

A. pd.Series(data, index=labels)
B. pd.Series(data, labels)
C. pd.Series(index, data)
D. pd.Series(labels=data)

Answer: A


Q8. What will be the output of the following code?

s = pd.Series({'A':10, 'B':20, 'C':30}) print(s['B'])

A. 10
B. 20
C. 30
D. Error

Answer: B (20)


Q9. Which attribute is used to get values of a Series?

A. values()
B. value
C. values
D. getValues()

Answer: C (values)


Q10. Which attribute is used to get index of a Series?

A. indexes
B. index
C. idx
D. keys

Answer: B (index)


Q11. What happens if you access an index that does not exist in a Series?

A. Returns 0
B. Returns None
C. Raises KeyError
D. Ignores

Answer: C (KeyError)


Q12. Which function is used to display first few elements of a Series?

A. start()
B. begin()
C. head()
D. top()

Answer: C (head())


Q13. Which parameter is used to assign a name to a Pandas Series?

A. label
B. title
C. name
D. id

Answer: C (name)


Q14. What will be the output?

import pandas as pd s = pd.Series([5, 10, 15], index=['a','b','c']) print(s['c'])

A. 5
B. 10
C. 15
D. Error

Answer: C (15)


Q15. Which of the following creates an empty Series?

A. pd.Series()
B. pd.Series([])
C. Both A and B
D. None of these

Answer: C (Both A and B)


Q16. What is the default data type of a Series created with integers?

A. int32
B. int64
C. float32
D. object

Answer: B (int64)


Q17. Which attribute returns both index and values together?

A. items()
B. pairs()
C. elements()
D. combine()

Answer: A (items())


Q18. What will be the output?

s = pd.Series([1, 2, 3]) print(s.sum())

A. 3
B. 5
C. 6
D. Error

Answer: C (6)


Q19. Which method is used to check missing values in a Series?

A. isnull()
B. checknull()
C. missing()
D. null()

Answer: A (isnull())


Q20. Which of the following replaces missing values in a Series?

A. fill()
B. replace()
C. fillna()
D. dropna()

Answer: C (fillna())


🖥️ OUTPUT-BASED QUESTIONS

Q21. What will be the output?

s = pd.Series([10, 20, 30, 40]) print(s.head(2))

Answer:

0 10 1 20 dtype: int64

Q22. What will be the output?

s = pd.Series([2, 4, 6]) print(s*2)

Answer:

0 4 1 8 2 12 dtype: int64

Q23. What will be the output?

s = pd.Series([10, 20, None]) print(s.isnull())

Answer:

0 False 1 False 2 True dtype: bool

Q24. What will be the output?

s = pd.Series([5, 10, 15]) print(s.mean())

A. 10
B. 15
C. 30
D. Error

Answer: A (10)


Q25. What does dropna() do in a Pandas Series?

A. Deletes the Series
B. Removes missing values
C. Replaces missing values
D. Sorts data

Answer: B (Removes missing values)


Q26. Pandas Series stores data in the form of:

A. Rows
B. Columns
C. Values with index
D. Tables
Ans: C

Q27. Which statement is true about Pandas Series?

A. Mutable
B. Immutable
C. Fixed size
D. Two dimensional
Ans: A

Q28. What is returned by s.dtype?

A. Values
B. Index
C. Data type
D. Shape
Ans: C

Q29. Which function converts a Series to a list?

A. tolist()
B. list()
C. to_list()
D. Both A and C
Ans: D

Q30. Which index type is default in Series?

A. String
B. Float
C. Integer
D. Boolean
Ans: C


Q31. Which operator is used for element-wise addition?

A. +
B. add()
C. sum()
D. Both A and B
Ans: D

Q32. What does len(s) return?

A. Sum of values
B. Size of Series
C. Index
D. Data type
Ans: B

Q33. Which method sorts Series values?

A. sort()
B. sort_values()
C. order()
D. arrange()
Ans: B

Q34. Which method sorts Series by index?

A. sort_index()
B. sort_values()
C. index_sort()
D. reindex()
Ans: A

Q35. What does s.shape return?

A. Index
B. Values
C. Tuple of size
D. Data type
Ans: C


Q36. Which function removes NaN values?

A. fillna()
B. isna()
C. dropna()
D. removena()
Ans: C

Q37. What is NaN?

A. Zero
B. Null value
C. Error
D. String
Ans: B

Q38. Which function counts non-NaN values?

A. count()
B. size()
C. len()
D. sum()
Ans: A

Q39. What does s.size return?

A. Number of non-null values
B. Total elements
C. Index
D. Data type
Ans: B

Q40. Which function returns maximum value?

A. top()
B. max()
C. highest()
D. upper()
Ans: B


Q41. Which function returns minimum value?

A. min()
B. low()
C. bottom()
D. least()
Ans: A

Q42. Which method gives cumulative sum?

A. sum()
B. cumsum()
C. accumulate()
D. total()
Ans: B

Q43. Which function checks unique values?

A. unique()
B. nunique()
C. distinct()
D. different()
Ans: A

Q44. Which returns number of unique values?

A. unique()
B. count()
C. nunique()
D. size()
Ans: C

Q45. Which attribute displays Series name?

A. title
B. label
C. name
D. id
Ans: C


Q46. Which method returns last elements?

A. tail()
B. end()
C. last()
D. finish()
Ans: A

Q47. Which method replaces values?

A. fillna()
B. replace()
C. swap()
D. change()
Ans: B

Q48. What does s.index return?

A. Values
B. Data type
C. Index labels
D. Size
Ans: C

Q49. Boolean indexing is used for:

A. Sorting
B. Filtering data
C. Merging
D. Indexing only
Ans: B

Q50. Which creates Series from dictionary?

A. pd.Series(dict)
B. pd.series(dict)
C. pd.make(dict)
D. pd.data(dict)
Ans: A


Q51. Which method converts Series to NumPy array?

A. array()
B. values
C. to_numpy()
D. Both B and C
Ans: D

Q52. Which function returns first valid index?

A. first()
B. idxmax()
C. first_valid_index()
D. head()
Ans: C

Q53. Which function returns index of max value?

A. max()
B. idxmax()
C. argmax()
D. locmax()
Ans: B

Q54. Which function returns index of min value?

A. idxmin()
B. min()
C. argmin()
D. locmin()
Ans: A

Q55. Which function checks duplicate values?

A. duplicate()
B. duplicated()
C. repeat()
D. copy()
Ans: B


Q56. Which removes duplicate values?

A. drop_duplicates()
B. remove()
C. delete()
D. unique()
Ans: A

Q57. Arithmetic operations in Series are:

A. Scalar only
B. Vectorized
C. Not allowed
D. Manual
Ans: B

Q58. Which function applies custom function?

A. apply()
B. map()
C. transform()
D. Both A and B
Ans: D

Q59. Which returns Boolean Series?

A. isnull()
B. notnull()
C. Both A and B
D. None
Ans: C

Q60. Which creates copy of Series?

A. duplicate()
B. copy()
C. clone()
D. replicate()
Ans: B


Q61. Which method reassigns index?

A. reset_index()
B. set_index()
C. reindex()
D. change_index()
Ans: C

Q62. Which function aligns data?

A. align()
B. merge()
C. join()
D. combine()
Ans: A

Q63. Which method counts frequency?

A. count()
B. value_counts()
C. freq()
D. size()
Ans: B

Q64. Which method rounds values?

A. round()
B. approx()
C. fix()
D. floor()
Ans: A

Q65. Which returns Boolean if empty?

A. empty()
B. isempty()
C. empty
D. null()
Ans: C


Q66. Which attribute returns memory usage?

A. memory()
B. memory_usage()
C. space()
D. size()
Ans: B

Q67. Which method changes data type?

A. dtype()
B. convert()
C. astype()
D. type()
Ans: C

Q68. Which method clips values?

A. clip()
B. cut()
C. limit()
D. trim()
Ans: A

Q69. Which function returns correlation?

A. corr()
B. cov()
C. relate()
D. compare()
Ans: A

Q70. Which function returns covariance?

A. corr()
B. cov()
C. var()
D. std()
Ans: B


Q71. Which function returns variance?

A. var()
B. std()
C. mean()
D. spread()
Ans: A

Q72. Which function returns standard deviation?

A. sd()
B. std()
C. spread()
D. deviation()
Ans: B

Q73. Which method slices Series?

A. loc[]
B. iloc[]
C. Both A and B
D. slice()
Ans: C

Q74. Which uses label-based indexing?

A. iloc
B. loc
C. at
D. Both B and C
Ans: D

Q75. Which uses integer-based indexing?

A. loc
B. iloc
C. iat
D. Both B and C
Ans: D


Q76. Which returns True/False for membership?

A. in
B. isin()
C. has()
D. contains()
Ans: B

Q77. Which function bins data?

A. cut()
B. qcut()
C. Both A and B
D. bin()
Ans: C

Q78. Which shifts values?

A. shift()
B. move()
C. slide()
D. roll()
Ans: A

Q79. Which method repeats values?

A. repeat()
B. replicate()
C. duplicate()
D. again()
Ans: A

Q80. Which returns absolute values?

A. abs()
B. absolute()
C. mod()
D. positive()
Ans: A


Q81. Which returns logical AND?

A. &
B. and
C. &&
D. logical_and()
Ans: A

Q82. Which returns logical OR?

A. |
B. or
C. ||
D. logical_or()
Ans: A

Q83. Which method checks monotonic increase?

A. is_monotonic_increasing
B. is_sorted()
C. increasing()
D. order()
Ans: A

Q84. Which method checks monotonic decrease?

A. is_decreasing()
B. is_monotonic_decreasing
C. descending()
D. order()
Ans: B

Q85. Which returns cumulative product?

A. product()
B. cumprod()
C. multiply()
D. total()
Ans: B


Q86. Which returns cumulative minimum?

A. cummin()
B. min()
C. lowest()
D. floor()
Ans: A

Q87. Which returns cumulative maximum?

A. cummax()
B. max()
C. highest()
D. ceil()
Ans: A

Q88. Which rounds down values?

A. round()
B. floor()
C. ceil()
D. fix()
Ans: B

Q89. Which rounds up values?

A. round()
B. floor()
C. ceil()
D. fix()
Ans: C

Q90. Which checks equality element-wise?

A. ==
B. equals()
C. compare()
D. Both A and B
Ans: D


Q91. Which method checks Series equality?

A. ==
B. equals()
C. same()
D. compare()
Ans: B

Q92. Which returns deep copy?

A. copy()
B. clone()
C. duplicate()
D. replicate()
Ans: A

Q93. Which method converts index to list?

A. index.tolist()
B. index.list()
C. list(index)
D. Both A and C
Ans: D

Q94. Which returns memory usage in bytes?

A. memory()
B. memory_usage(deep=True)
C. size()
D. bytes()
Ans: B

Q95. Which method replaces values conditionally?

A. where()
B. mask()
C. Both A and B
D. replace()
Ans: C


Q96. Which keeps values where condition is True?

A. mask()
B. where()
C. filter()
D. apply()
Ans: B

Q97. Which replaces values where condition is True?

A. where()
B. mask()
C. filter()
D. clip()
Ans: B

Q98. Which method aligns two Series?

A. align()
B. merge()
C. join()
D. append()
Ans: A

Q99. Which method concatenates Series?

A. append()
B. concat()
C. Both A and B
D. merge()
Ans: C

Q100. Pandas Series is built on:

A. List
B. Tuple
C. NumPy array
D. Dictionary
Ans: C

Post a Comment

Please do note create link post in comment section

Previous Post Next Post