Python final review question bank (below) - "Python"

At the end of the term, Xiao Yalan, go for it! ! !


1. (Single-choice question) Which of the following statements about the file opening mode is wrong (C).

A. r means to open the file as read-only

B. w stands for opening the file in write-only mode

C. a means to open the file in binary form

D. When + is used in the mode, the file can be read and written 

2. (Single-choice question) Among the following options, the one that opens the file in append mode is ( D )
A. a

B. ab+

C. a+

D. All of the above

3. (Single-choice question) Which of the following options can read arbitrary bytes from the file? ( A )
A. read()

B. readline()

C. readlines()

D. All of the above

4. (Single-choice question) Among the following options, the one that does not belong to binary files is (A).
A. Text file
B. png file
C. mp3 file
D. mp4 file

5. (Single-choice question) Execute the following statement:
f = open('iheimA.txt', 'w')
The location of the opened file should be ( D ).
A. Under the root directory of drive C.
B. Under the root directory of drive
D. C. Under the Python installation directory
D. Under the same directory as the source file


6. (Single-choice question) The method of calculating the number of elements in numpy ( B )
A. np.sqrt()
B. np.size()
C. np.identity()
D. np.count()

7. (Single-choice question) Create a matrix with all 0s in Numpy using ( A )
A. zeros
B. ones
C. empty
D. arange

8. (Single-choice question) Converting vectors into matrices in numpy uses ( A )
A. reshape
B. reval
C. arange
D. random

9. (Single-choice question) There is an array n = np.arange(24).reshape(2,-1,2,2), what is the return result of n.shape? ( A )
A. (2,3,2 ,2)
B. (2,2,2,2)
C. (2,4,2,2)
D. (2,6,2,2)

10. (Single-choice question) In the numpy package, the function used to calculate the median is: ( B )
A. numpy.mean
B. numpy.median
C. numpy.var
D. numpy.std


11. (Single-choice question) In the numpy package, the method of finding the maximum value is: ( A )
A. amax
B. maxnum
C. max
D. big

12. (Single-choice question) In numpy, the value generated by the random function is between ( C )
A. [0,1]
B. (0,1)
C. [0,1)
D. (0,1]

13. (Single-choice question) What is the meaning of pyplot in the following statement? ( A )
import matplotlib.pyplot as plt
A. sub-library of matplotlib
B. sub-function of matplotlib
C. class of matplotlib
D. method of matplotlib

14. (Single-choice question) Which function can be used to add a horizontal axis label to the coordinate system? ( A )
A. plt.xlabel("label")
B. plt.label(x,"label")
C. plt.label( y,"label")
D. plt.ylabel("label")

15. (Single-choice question) Which function can be used to add a title to the entire coordinate system? ( C )
A. plt.text( )
B. plt.annotate( )
C. plt.title( )
D. plt.label( )


16. (Single-choice question) What is the function of the plt.text0 function? ( C )
A. Add a caption to the coordinate axis
B. Add text at any position
C. Add a text label to the coordinate axis
D. Add a title to the coordinate system

17. (Single-choice question) Which of the following descriptions of the matplotlib library is incorrect? ( D )
A. matplotlib.pyplot is a "shortcut" for drawing
B. The matplotlib library is designed and implemented based on the numpy library
C. matplotlib It is a Python third-party data display library
D. The data graph displayed by the matplotlib library cannot be output as a file

18. (Single-choice question) plt.xlabel('×coordinate axis',fontproperties='simHei',fontsize=20) ( B ) A.
Set the size of the coordinate axis label
B. Set the font of the coordinate axis label to display correctly Chinese
C. Set the color of the axis label
D. Set the style of the axis label

19. (Single-choice question) Which of the following functions creates the canvas in the pyplot submodule? ( A )
A. figure() 
B. legend()
C. subplots()
D. random()

20. (Single-choice question) Which of the following is the function for drawing a line graph? ( B )
A. pyplot.scatter()
B. pyplot.plot()
C. pyplot.grid()
D. pyplot.show()


21. (Single-choice question) The following difference between plt.show() and plt.imshow() is correct: ( B ) A. The functions of
the two are exactly the same.
B. imshow() receives an image and just draws it The image, and write the image to the disk where you want to place it. When all the operations of the imshow() function are completed, the show() function will be called to display the image.
C. show() receives an image, just draws the image, and writes the image to the disk you want to place.
When all the operations of the show() function are completed, the image will be displayed by calling the imshow() function.
D. The imshow() function includes show()

22. (Single-choice question) What font does simhei refer to ( D )
A. Song typeface
B. Microsoft Yahei
C. Italic typeface
D. Black typeface

23. (Single-choice question) Which function is used to display the legend in the pyplot module? ( A )
A. plt.legend()
B. plt.show()
C. plt.title()
D. plt.plot()

24. (Single-choice question) The following (A) is the file opening mode in Python. 
A. ab+
B. rt
C. wt
D. nb

25. (Single-choice question) Convert matrix to vector in numpy ( B )

A. Areshape

B. resize

C.orange

D. random


26. (Single-choice question) In the numpy package, the function to calculate the standard deviation is: ( D )
A. numpy.mean
B. numpy.median
C. numpy.var
D. numpy.std

27. (Single-choice question) In numpy, the array used to generate all the elements on the main diagonal is 1, and the other elements are all 0: ( A )
A. ones
B. zeros
C. diag
D. eye

28. (Single-choice question) In numpy, the function to generate a random number subject to uniform distribution is: ( B )
A. random
B. rand
C. randn
D. randint

29. (Single-choice question) In numpy, the function to generate a random number subject to a normal distribution is: ( C )
A. random
B. rand
C. randn
D. randint

30. (Single-choice question) In numpy, the random number function that generates a given upper and lower limit range is: ( D )
A. random
B. rand
C. randn
D. randint


31. (Fill in the blank) In numpy, the (   zeros   ) function can be used to create an array of 0s, and the (  ones ) function can be used to create an array of all 1s.

32. (Fill in the blank) In numpy, there are two main ways to sort arrays: direct sorting and ( indirect sorting   )

33. (Fill in the blank) Direct sorting in numpy often uses the ( sort  ) method in the array  

34. (Fill in the blank) In numpy, the (   unique    ) function can be used to find out the unique value in the array and return the sorted results, so as to realize the function of removing duplicate data

35. (Fill in the blank) In numpy, you can use tile and (  repeat  ) to realize the operation of repeating data several times.


36 (True or false) The sort function is the most common sorting method and has a return value. ( B )
A.
Right B. Wrong

37. (True or false) When using the numpy library, you need to use import to import. ( A )
A. Right
B. Wrong

38. (True or false) To detect missing data, the notnull method is generally used. ( A )
A. Right
B. Wrong

39. (True or false) The itemsize of an array object, the returned value is determined by the size of the array. ( B )
A.
Right B. Wrong

40. (True or false) ufunc supports all four arithmetic operations, and its operation object is an array. ( A )
A. Right
B. Wrong


41. (Fill in the blank) The file is opened using the __open__ method .

42. (Fill in the blank) Using the __ with __ statement can realize the automatic call of the close() method.

43. (Fill in the blank) In Python, __ None __ represents an empty type. (English initial letter capitalized)

44. (Fill in the blank) The keys in a dictionary are __unique__ .

45. (Fill in the blank) The Boolean type is a special type of __integer__ .


46. ​​(Fill in the blank) Only when the if conditional expression is __true__ will the statement satisfying the condition be executed.

47. (Multiple choice) Which of the following commands to create subgraphs is correct ( ABD ).
A. plt.subplot(5,2,2)

B.plt.subplot(4,1,2)

C.plt.subplot(1011)

D. plt.subplot(10,1,1)

48. (Multiple choice)
If there is a two-dimensional list ls=[[9,8],[7,6],[5,4],[3,2],[1,0]], then the number 4 can be obtained The options are ( ABCD ).

A. ls[2][1]
B. ls[2][-1]
C. ls[-3][1]
D. ls[-3][-1]

49. (Multiple choice) Among the following descriptions about Python branches, the correct one is (BCD).
A.Python branch structure is implemented using the reserved words if, elif and else, each if must be followed by elif or else 

B. The if-else structure can be nested 

C. The if statement will judge the logical expression after the if, and when the expression is true, execute the statement block following the if 

D. Indentation is the grammatical part of the Python branch statement, and incorrect indentation will affect the branch function

50. (True or false) Between an open and a close operation, each time the write() method is called, the program appends a line of data to the file and returns the number of bytes written to the file this time. ( A )
A. Right
B. Wrong


51. (True or false) When using a file, if you do not use the close method to close the file, once the program crashes, the data in the file may not be saved. ( A )
A. Right
B. Wrong

52. (True or false) For any open files, remember to use the close method to close the files. ( A )
A. Right
B. Wrong

53. (True or False) Use readline() to read one line of data at a time. Assuming that 5 lines of data are read this time, when the file is opened next time, the readline() method will read the sixth line of data. ( B )
A.
Right B. Wrong

54. (True or false) CSV can be used as a storage form of one-dimensional data or as a storage form of two-dimensional data. ( A )
A. Right
B. Wrong

55. (True or false) When drawing graphics for data visualization, you need to define the size of the canvas first. ( A )
A. Right
B. Wrong


56. (True or false) In data visualization, the function that defines the size of the canvas is plot ( B )
A. True
B. False

57. (True or false) In data visualization, the function to define a subplot is subplot( A )
A.
True B. False

58. (True or false) In commonly used data visualization charts, the function of the histogram is hist( A ).
A. True
B. False

59. (True or false) Drawing pie charts is often used to express the probability distribution of data. ( B )
A.
Right B. Wrong

60. (Single-choice question)
The simplest Series is composed of (A) data

A. an array

B. Two arrays

C. Three arrays

D. Four arrays


61. (Single-choice question) What modules do we need to import when using pandas. ( A )
A. import pandas as pd

B. import sys

C.import matplotlib

D. import pymysql

62. (Single-choice question) Use (B) function to delete a column or a row of elements
A. delete
B. drop
C. clear
D. cut

63. (Single-choice question) The axis parameter in pandas has two values. When it is equal to (B), you can delete the column element
A. 0
B. 1
C. -1
D. Default

64. (Fill in the blank) pandas has two data structures, Series and (DataFrame).

65. (Fill in the blank) To delete a column of elements, you can use the del command or the ( pop ) function


66. (True or false) In pandas, the label index cannot use slices ( A )
A. True
B. False

67. (True or False) In pandas, the row index cannot use slices ( B )
A. True
B. False

68. (True or false) In pandas, if an index value does not exist when re-indexing, the missing index value NaN will be introduced. ( A )
A. Right
B. Wrong

69. (True or false) Hierarchical indexing is an important function of pandas. It can be either a row index or a column index. ( A )
A. Right
B. Wrong

70. (True or false) Series can only obtain single or multiple elements through indexing and slicing operations. ( B )
A.
Right B. Wrong


71. (True or false) DataFrame can only obtain one or more rows of data through indexing and slicing operations. ( B )
A.
Right B. Wrong

72. (True or False) Pandas is built on NumPy arrays. ( A )
A. Right
B. Wrong

73. (Single-choice question) Dirty data refers to (D).
A. Contaminated data
B. Irregular data
C. Data stored in the computer
D. Outliers, missing values

74. (Single-choice question) The (A) function is provided in pandas to identify missing values.
A. isnull
B. notnull
C. null
D. dropna

75. (Single-choice question) Which of the following is not a method of dealing with missing values ​​(C)
A. Delete missing values
​​B. Fill missing values
​​C. Set default values
​​D. Use interpolation


76. (Single-choice question) There are three types of data merging (C), primary key merging and overlapping merging.
A. Duplicate Merge
B. Horizontal Merge 
C. Stacking Merge
D. Vertical Merge

77. (Single-choice question) pandas provides (B) function to complete the function of filling missing values.
A. fill
B. fillna
C. dropna
D. interpolate

78. (Fill in the blank) There are two types of data repetition ( record ) repetition and ( feature ) repetition.

79. (Fill in the blanks) The filling method for dealing with missing values ​​is also called ( replacement method )

80. (True or false) Before data analysis, in addition to data cleaning, sometimes it is necessary to standardize the data. ( A )
A. Right
B. Wrong


81. (True or False) Outliers can be deleted directly. ( B )
A.
Right B. Wrong

82. (False or False) Missing values ​​are usually artificial. ( B )
A.
Right B. Wrong

83. (Single-choice question) Depending on the storage format of the file, it can be divided into two forms: (A) and binary file.
A. Text file
B. Data file
C. csv file
D. Decimal file

84. (Single-choice question) Use Python's built-in function (B) method to open a specified file and create a file object.
A. read
B. open
C. write
D. readline

85. (Single-choice question) The methods of reading files include (C), readline, readlines, etc.
A. open
B. redes
C. read
D. mode


86. (Single-choice question) There are (C) and writeline.
A. open
B. read
C. write
D. close

87. (Single choice) (D) is a lightweight data exchange format, and the Python standard library supports this format.
A. Excel
B. word
C. txt
D. JSON

88. (Single-choice question) The command to modify the data is (C)

A. select

B. insert into

C. update

D. delect

89. (Single-choice question) The command that can delete row or column data is (D)
A. select
B. pop
C. update
D. drop

90. (Single-choice question) The command to insert data is ( B )
A. select
B. insert into 
C. update
D. delete


91. (Single-choice question) The command to delete the data table is (C)
A. select
B. update
C. drop table
D. delete

92. (Single-choice question) The command to import pymysql data is ( C )
A. import database
B. import SQL
C. import pymysql
D. pip install Mysql

93. (True or false) The json.load method can be used to read the json format file. ( A )
A. Right
B. Wrong

 

 

 

 

 

 

 

 

 

 

 

 


 Alright, I'm going to take the Python test tomorrow, so I'll share today's question bank here! ! !

 

Guess you like

Origin blog.csdn.net/weixin_74957752/article/details/130951660
Recommended