1
Python编程从入门到实践
1.15.5.1 一、选择题
一、选择题

1.计算numpy数组中元素个数的方法是( )。

A.np.sqrt() B.np.size() C.np.identity() D.np.abs()

2.numpy库中使用( )函数改变数组形状,但不改变原数组。

A.np.reshape() B.np.resize() C.np.arrange() D.np.random()

3.numpy库中创建数值在0~1之间随机数组的方法是( )。

A.np.zeros() B.np.ones() C.np.arange() D.np.random()

4.数组n=np.arange(24).reshape(2,-1,2,2),n.shape()的返回结果是( )。

A.(2,3,2,2) B.(2,2,2,2) C.(2,4,2,2) D.(2,6,2,2)

5.已知a=np.arange(24).reshape(3,4,2),那么a.sum(axis=0)所得的结果为( )。

A.array([12 16],[44 48],[76 80])

B.array([[1,5,9,13],[17,21,25,29],[33,37,41,45]])

C.array([[24,27],[30,33],[36,39],[42,45]])

D.以上全不对

6.在使用matplotlib.pyplot时,导入语句是( )。

A.import matplotlib.pyplot as plt B.import pandas as pd

C.import sys D.import matplotlib

7.在matplotlib.pyplot库中,绘制饼图使用( )函数。

A.plt.plot() B.plt.pie() C.plt.hist() D.plt.scatter()

8.绘制图形时,经常需要在图形中加入图例,在matplotlib.pyplot库中使用( )函数。

A.plt.xlabel() B.plt.ylabel() C.plt.label() D.plt.legend()