wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ML 2

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of the following code?

x = [1, 2, 3]

y = x

y.append(4)

print(x)

a)

[1, 2, 3]

b)

[1, 2, 3, 4]

c)

[4]

d)

Error

2.

What is the correct way to create a NumPy array from a list?

a)

np.array([1, 2, 3])

b)

np.list([1, 2, 3])

c)

np.make_array([1, 2, 3])

d)

np.arraylist([1, 2, 3])

3.

Which of the following is used to read a CSV file in Pandas?

a)

pd.read_table()

b)

pd.read_excel()

c)

pd.read_csv()

d)

pd.open_csv()

4.

What will be the shape of the following NumPy array?

arr = np.array([[1,2,3],[4,5,6]])

a)

(3,2)

b)

(2,3)

c)

(1,6)

d)

(6,)

5.

Which of the following plots is best suited to display the distribution of a numerical variable?

a)

Line plot

b)

Bar Chart

c)

Histogram

d)

Pie Chart

6.

Which of the following statements about Python lists and tuples is TRUE?

a)

Tuples are mutable, lists are immutable

b)

Lists are faster than tuples

c)

Tuples are immutable, lists are mutable

d)

Tuples can be modified after creation

7.

What is the correct syntax to plot a line graph using Matplotlib?

a)

plot(x, y)

b)

plt.line(x, y)

c)

plt.plot(x, y)

d)

graph.plot(x, y)

8.

Which of these methods reshapes a NumPy array?

a)

resize()

b)

reshape()

c)

restructure()

d)

form()

9.

Which keyword is used to define a function in Python?

a)

function

b)

func

c)

def

d)

define

10.

What does the range(5) function return?

a)

[1, 2, 3, 4, 5]

b)

[0, 1, 2, 3, 4]

c)

[0, 1, 2, 3, 4, 5]

d)

[1, 2, 3, 4]