Test 7: File and data formatting (week 7) - multiple choice

1 the following options for file describing the error is:

A, the file is a collection of programs and abstract    

B, the data file is a collection of abstract and

C, file can contain any content    

In the auxiliary memory data sequence D, the file is stored

Analysis: 
function or class is a collection of programs and abstract, not a file.

2 unified step Python uses for file operations:

A, open - read - write    

B, open - read - write - Close   

C, the operation - to read - write    

D, open - Operation - Close

Analysis: 
Open - Operation - Close a unified step, wherein the closing may be omitted.

3, for Python files, the following description is correct:

A, when a text file is opened in read mode a byte stream in accordance with    

B, depending on the type of file, open a text only mode or in binary

C, the same file can be opened either in text, binary mode can also be used to open 

D, when the file is opened in binary mode, according to the read character string

Analysis: 
file is there, open only binary or text to understand its different programs.

4, the following options are not a Python file read operation is:

A、readtext()   

B、read()   

C、readlines()    

D、readline()

Analysis: 
no readtext () method

5, About dimension data organization, describe which option is wrong?

A, two-dimensional data organized in a form corresponding to the matrix mathematics    

B, using a linear one-dimensional data is organized, corresponds to a mathematical concept of a set of arrays and the like

C, high-dimensional data is composed of key-value pairs of data types, object-organized   

Dimension D is present, data organization, for dictionary type data representing a one-dimensional and two-dimensional

Analysis: 
Dictionary used to represent high-dimensional data, generally do not have to represent a two-dimensional data.

6, description of the CSV file, which describes the options is wrong?

A, each row of the CSV file is one-dimensional data may be used in the type of list represented Python    

B, the entire CSV file is a two-dimensional data

C, CSV file format is a versatile, relatively simple format, it is applied to the transfer of data between the program table    

D, CSV file represents a character through a variety of coding

Analysis: 
In general, CSV files are text files, encoded by the same characters.

7, Python file on the '+' open mode, which describes which option is correct?

A, and r / w / a x used together, / increase simultaneously read and write functions based on the function of the original    

B, read-only mode    

C, additional write mode    

D, covering write mode

Analysis:
 '+' essence open mode is that it can impart simultaneous read and write access to the file.

8 given list ls = [1, 2, 3, "1", "2 "," 3 "], whose elements contain two kinds of data types, data organization which option is the list of dimensions of ls?

A, one-dimensional data    

B, multidimensional data    

C, high-dimensional data    

D, two-dimensional data

Analysis: 
list element if both the list, it may represent two-dimensional data, for example: [[ 1,2], [3,4], [5,6 ]]. 
If the list is not all the elements of the list, it indicates that one-dimensional data.

9 closed on file close () method, which describe the options is correct?

A, after the file processing, you must use close () method to close the file     

B, after the file processing can not close () method to close the file, will be turned off by default when the program exits

C, document processing follows a strict "open - Operation - off" mode    

D, if the file is opened read-only, only in this case can not close () method to close the file

Analysis: 
After opening the file using close () closes the file is a good habit. If you do not call the close (), when the current program is completely run Python exits, the file references are released, that is when the program exits, equivalent to calling the close ().

10, two-dimensional list ls = [[1,2,3], [4,5 6], [7,8,9]], which option can get where element 5?

A ls [1] [1]       

B、ls[4]       

C、ls[-2][-1]       

D、ls[-1][-1]

Analysis: 
This is a two-dimensional slice of use.

 

Guess you like

Origin www.cnblogs.com/qiuniao/p/11997390.html