0% found this document useful (0 votes)
17 views2 pages

Solution - Class Test July-1

1

Uploaded by

singhpranjal819
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Solution - Class Test July-1

1

Uploaded by

singhpranjal819
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Informatics Practices (065)

Class –XII
[Solution of July 2024 class Test]
1. What is the primary data structure of the Pandas library? a) Array b) Series
c) DataFrame d) List
Answer: c) DataFrame

2. Which function is used to create a DataFrame in Pandas? a) pd.Series() b) pd.DataFrame()


c) pd.array() d) pd.list()
Answer: b) pd.DataFrame()

3. How do you select the 'age' column from a DataFrame df? a) df.age b) df[‘age’]
c) df[[‘age’]] d) All of the above
Answer: d) All of the above

4. Which method is used to read a CSV file into a Pandas DataFrame? a) pd.read_csv() b) pd.load_csv()
c) pd.open_csv() d) pd.import_csv()
Answer: a) pd.read_csv()

5. What does the head() method do in Pandas? a) Shows the first 5 rows of a DataFrame b) Shows the last 5
rows of a DataFrame
c) Shows the structure of a DataFrame d) Shows the summary of a DataFrame
Answer: a) Shows the first 5 rows of a DataFrame

6. Which of the following is used to get the dimensions (rows, columns) of a DataFrame? a) df.shape b)
df.size
c) df.count d) df.length
Answer: a) df.shape

7. What will s = pd.Series([1, 2, 3], index=['a', 'b', 'c']) return? a) A Series with default integer index b) A
Series with indices 'a', 'b', 'c'
c) An error d) A Series with reversed values
Answer: b) A Series with indices 'a', 'b', 'c'

8. How can you access the first element of a Pandas Series s? a) s[1] b) s[-1]
c) s[0] d) s.first()
Answer: c) s[0]

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


s = pd.Series([1, 2, 3, 4, 5])
print(s + 2)
a) 0 1 2 3 4 b) 1 3 5 7 9
c) 3 4 5 6 7 d) None of the above
Answer: c) 3 4 5 6 7

10. How do you add two Pandas Series s1 and s2 element-wise? a) s1 + s2 b) s1.add(s2)
c) pd.concat([s1, s2]) d) Both a and b
Answer: d) Both a and b

1) Which method is used to display the last 5 rows of a DataFrame?


Answer: tail()
2) How do you create a Series from a list in pandas?
Answer: Use pd.Series(list_name).

3) How can you check the data types of each column in a DataFrame?
Answer: Use df.dtypes.

4) How do you select a single index from a DataFrame?


Answer: Use df.loc[index_name] or df.iloc[index_position].

5) What is the difference between loc and iloc in Pandas?


Answer: loc uses labels; iloc uses integer positions.

You might also like