/**/ Python & MySQL: Objective Type Questions (Class 12) 2024-25

Friday, August 30, 2024

Objective Type Questions (Class 12) 2024-25

Objective Type Questions 

Session : (2024-25)

Class - XII

1.      Python Pandas was developed in ______.

a.      2008

b.      2009

c.       2010

d.      2012

2.      head() is used to return first ______ rows.

a.      n-1

b.      n+1

c.       n2

d.      n

3.      Which function is used to sort the series values using values?

a.      sort()

b.      values()

c.       sort_values()

d.      values_sort()

4.      The columns of DataFrame cab be

a.      Heterogeneous

b.      Homogeneous

c.       Both a and b

d.      None of these

5.      loc takes two single operators separated by____

a.      dot(.)

b.      semicolon(;)

c.       colon(:)

d.      comma(,)

6.      Which function is used to delete a row from DataFrame?

a.      del()

b.      drop()

c.       delete()

d.      dropcol()

7.      In Boolean indexing ______ can be used to filter the data.

a.      boolean vectors

b.      Boolean column

c.       Boolean mapper

d.      Boolean label

8.      The full form of CSV is

a.      Comma Separate Value

b.      Comma Separated Values

c.       Common Separated Values

d.      None of the above

9.      Which of the following is/are library function(s) used to load data from CSV file into

a.      read_csv()

b.      to_csv()

c.       both a and b

d.      None of these

10.  The name “Pandas” is derived from the term

a.      Panel Data

b.      Panel Series

c.       Python Document

d.      Panel Data Frame

11.  Method or function to add a new row in a dataframe is

a.      .loc()

b.      .iloc()

c.       join()

d.      add()

12.  Which of the following import statement is not correct?

a.      import pandas as class12

b.      import pandas as 1pd

c.       import pandas as pd1

d.      import pandas as pd

13.  While accessing the column from the dataframe, we can specify the column name. In case column does not exist, which type of error it will raise?

a.      Key Error

b.      Syntax Error

c.       Name Error

d.      Runtime Error

14.  Function to display the first n rows in the DataFrame is

a.      tail(n)

b.      head(n)

c.       top(n)

d.      first(n)

15.  Which function will be used to read data from a CSV file into Pandas dataframe?

a.      readcsv()

b.      to_csv()

c.       read_csv()

d.      csv_read

16.  Which of the following is not an attribute of Pandas dataframe?

a.      length

b.      T

c.       size

d.      shape

17.  What will be the output of the given code?

import pandas as pd

s = pd.Series([1, 2, 3, 4, 5], index = [‘akram’, ‘brijesh’, ‘charu’, ‘deepika’, ‘era’])

print(s[‘charu’])

 

a.      1

b.      2

c.       3

d.      4

18.  What is a correct syntax to return the values of first tow of a Pandas DataFrame? Assuming the name of the DataFrame is dfRent.

a.      dfRent[0]

b.      dfRent.loc[1]

c.       dfRent.loc[0]

d.      dfRent.iloc[0]

19.  Write the output of the given code.

import pandas as pd

S1 = pd.Series([5, 6, 7, 8, 10], index = [‘v’, ‘w’, ‘x’, ‘y’, ‘z’])

p =[2, 6, 1, 4, 6]

S2 = pd.Series(p, index = [‘z’, ‘y’, ‘a’, ‘w’, ‘v’])

Print(S1-S2)

20.  Which command will be used to delete 3 and 5 rows of the dataframe. Assuming the dataframe name as DF.

a.      DF.drop([2, 4], axis = 0)

b.      Df.drop([2, 4], axis = 1)

c.       DF.drop([3, 5], axis = 1)

d.      Df.drop([3, 5])

Answers:

1. 2008    2. n    3. sort_values()    4. Heterogeneous    5. comma(,)

6. drop()       7. boolean vectors    8. Comma Separated Values    

9. Both (a) and (b)        10. Panel Data        11. .loc()    

12. import pandas as 1pd        13. Key Error        14. head(n)

15. read_csv()        16. length        17. 3        18. dfRent.loc[0]

19.                                20. DF.drop([2, 4], axis = 0)







No comments:

Post a Comment

Please do not any spam in the comment box.

CLASS XI HALF YEARLY QP WTH MS 2024

  Half Yearly Examination: 2024-25 Informatics Practices (065) Class- XI       Time Allowed: 3hrs                                     ...