===============================
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
-------------------------------