0% found this document useful (0 votes)
4 views3 pages

Beginner Python Practice Paper

This document is a beginner-level Python practice paper focusing on NumPy, Pandas, and SciPy, consisting of 20 questions divided into multiple choice, short answer, coding, and output-based sections. It tests knowledge on creating arrays, reading CSV files, statistical operations, and manipulating DataFrames. The total time allotted for the paper is 1 hour.

Uploaded by

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

Beginner Python Practice Paper

This document is a beginner-level Python practice paper focusing on NumPy, Pandas, and SciPy, consisting of 20 questions divided into multiple choice, short answer, coding, and output-based sections. It tests knowledge on creating arrays, reading CSV files, statistical operations, and manipulating DataFrames. The total time allotted for the paper is 1 hour.

Uploaded by

pihusingh262010
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

===============================

PYTHON PRACTICE PAPER (BEGINNER)


===============================
Topics: NumPy, Pandas, SciPy
Time: 1 Hour | Total Questions: 20

-------------------------------
SECTION A: MULTIPLE CHOICE QUESTIONS (1 mark each)
-------------------------------

1. What does [Link]([1, 2, 3]) do in NumPy?


a) Creates a DataFrame
b) Creates a list
c) Creates a NumPy array
d) None of the above

2. Which function is used to read a CSV file in Pandas?


a) pd.load_csv()
b) pd.open_csv()
c) pd.read_csv()
d) [Link]()

3. What is the output of [Link]((2, 3))?


a) 2x3 matrix filled with 1s
b) 2x3 matrix filled with 0s
c) Error
d) None

4. Which module in SciPy is used for statistical operations?


a) [Link]
b) [Link]
c) [Link]
d) [Link]

5. What does [Link]() return in Pandas?


a) First 10 rows
b) Last 5 rows
c) First 5 rows
d) Column names only

-------------------------------
SECTION B: SHORT ANSWER QUESTIONS (2 marks each)
-------------------------------
6. Write the code to create a NumPy array from a list [10, 20, 30, 40].

7. How do you check the shape and data type of a NumPy array?

8. What is the use of describe() function in Pandas?

9. Write code to calculate the mean of a NumPy array.

10. What is the difference between loc[] and iloc[] in Pandas?

-------------------------------
SECTION C: CODING QUESTIONS (5 marks each)
-------------------------------

11. Create a Pandas DataFrame using the following data and display it:
data = {
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'City': ['New York', 'Paris', 'London']
}

12. Create a 3x3 NumPy array filled with random numbers between 0 and 1.

13. Using SciPy, find the mode and median of the following data:
data = [1, 2, 2, 3, 4, 4, 4, 5]

14. Load a CSV file named '[Link]' and display only the column 'Marks'.

15. Write Python code using Pandas to filter rows from a DataFrame where the 'Age' column is
greater than 30.

-------------------------------
SECTION D: OUTPUT-BASED QUESTIONS (3 marks each)
-------------------------------

16. What is the output of:


```python
import numpy as np
a = [Link]([1, 2, 3])
print(a * 2)
```

17. What will this code return?


```python
import pandas as pd
df = [Link]({'A': [1, 2], 'B': [3, 4]})
print(df.T)
```

18. What is the output of:


```python
from scipy import stats
print([Link]([1, 1, 2, 3, 3, 3, 4]))
```

19. Predict the output:


```python
import numpy as np
arr = [Link](6).reshape(2, 3)
print(arr[1, 2])
```

20. What will this print?


```python
import pandas as pd
df = [Link]({'x': [10, 20, 30]})
print(df['x'].mean())
```

-------------------------------
End of Paper
-------------------------------

You might also like