WorksheetsML 2
Total questions: 10
Worksheet time: 5mins
What is the output of the following code?
x = [1, 2, 3]
y = x
y.append(4)
print(x)
[1, 2, 3]
[1, 2, 3, 4]
[4]
Error
What is the correct way to create a NumPy array from a list?
np.array([1, 2, 3])
np.list([1, 2, 3])
np.make_array([1, 2, 3])
np.arraylist([1, 2, 3])
What will be the shape of the following NumPy array?
arr = np.array([[1,2,3],[4,5,6]])
(3,2)
(2,3)
(1,6)
(6,)
Which of the following plots is best suited to display the distribution of a numerical variable?
Line plot
Bar Chart
Histogram
Pie Chart
Which of the following statements about Python lists and tuples is TRUE?
Tuples are mutable, lists are immutable
Lists are faster than tuples
Tuples are immutable, lists are mutable
Tuples can be modified after creation
What is the correct syntax to plot a line graph using Matplotlib?
plot(x, y)
plt.line(x, y)
plt.plot(x, y)
graph.plot(x, y)
Which of these methods reshapes a NumPy array?
resize()
reshape()
restructure()
form()
Which keyword is used to define a function in Python?
function
func
def
define
What does the range(5) function return?
[1, 2, 3, 4, 5]
[0, 1, 2, 3, 4]
[0, 1, 2, 3, 4, 5]
[1, 2, 3, 4]
