Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Analytics using Python - Quiz 1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.
How to create a numpy array?
a)
numpy.array([1, 2, 3, 4, 5])
b)
[1, 2, 3, 4, 5]
c)
array([1, 2, 3, 4, 5])
d)
numpy.array{(1, 2, 3, 4, 5)}
2.
What will be the output of np.arange(10,201,10)?
a)
[ 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200]
b)
[10 100 200]
c)
[10 10 10 10 10 10 10 10 10 10]
d)
error
3.
How to create an array of zero’s of size 3?
a)
np.zeros(3)
b)
np.array(zeros(3))
c)
array.zeros(3)
d)
np.array.zeros(3)
4.

What will be the output of the following code:

A1 = np.array(['Juan','Matt','Tom'])

print (A1[0])

print (A1[-2])

print (A1[-0])

a)

Juan Matt Juan

b)

Juan Tom Tom

c)

Error

d)

Tom Matt Juan

5.

What is the output of the following code:

students = np.array([['Alice','Beth','Cathy','Dorothy'] , [65,78,90,81],[71,82,79,92]])

students[...,1]

a)

array(['Beth', '78', '82'], dtype='<U21')

b)

['Alice','Beth','Cathy','Dorothy']

c)

[65,78,90,81],  [71,82,79,92]

d)

error

6.

What will be the output of the code:

heights = [165,170,168,183,172,169]

weights = [61,76,56,81,62,60]

student_bio = np.array([heights,weights])

student_bio.shape

a)

(6, 2)

b)

(2, 6)

c)

array(2, 6)

d)

np.array(6, 2)

7.

What is the output of the code:

a = np.array([7, 8, 9, 10, 11, 12])

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

np.copyto(j,a)

print (j)

a)

B: [ 1 2 3 4 5 6 ]

b)

error

c)

[ 7  8  9 10 11 12 ]

8.
How to get a one dimensional array of random int numbers of size 6? A: np.random.randint(10, size=6)
a)
np.random(10, 6)
b)
np.randint(10, size=6)
c)
np.random(randint(10, size=6))
d)
np.random.randint(10, size=6)
9.

What will be the output of the code:

arr = np.array([[20,25,30,35], [40,50,60,70],[45,48,51,54]])

arr.flatten()

a)

45,48,51,54,40,50,60,70,20,25,30,35

b)

20,25,30,35,40,50,60,70,45,48,51,54

c)

20,25,30,35,45,48,51,54,40,50,60,70

d)

20,40,45,25,50,48,30,60,51,35,70,54

10.
What is a correct syntax to print the number 8 from the array below: arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])
a)

print(arr[-1,-2])

b)

print(arr[2,3])

c)

print(arr[1,2])

d)

print(arr[0,0])