Maggie Samson
Test por , creado hace más de 1 año

Geography Test sobre GEOM 73 - Python Quiz 10, creado por Maggie Samson el 14/04/2019.

49
1
0
Maggie Samson
Creado por Maggie Samson hace alrededor de 5 años
Cerrar

GEOM 73 - Python Quiz 10

Pregunta 1 de 10

1

What does CSV stand for?

Selecciona una de las siguientes respuestas posibles:

  • Comma Separated Values

  • Cell Separated Values

  • Comma Separation Values

  • Cell Separation Values

Explicación

Pregunta 2 de 10

1

The csv module is a standard Python library and no separate installation is needed.

Selecciona uno de los siguientes:

  • VERDADERO
  • FALSO

Explicación

Pregunta 3 de 10

1

Consider the following code:

import csv
csvfile = open('test.csv', "rb")
reader = csv.reader(cvsfile)

What does the csv.reader function accomplish?

Selecciona una de las siguientes respuestas posibles:

  • Each row read from the csv file is returned as a single string.

  • Each row read from the csv file is returned as a list of cell objects, each with their own data type.

  • All the rows from the csv file combined are returned as a single list of strings.

  • Each row read from the csv file is returned as a list of strings.

Explicación

Pregunta 4 de 10

1

Let's say a CSV file contains a header row, i.e. the first row contains the names of the fields. How would you make sure to skip the header when reading the actual data values?

Selecciona una de las siguientes respuestas posibles:

  • Set the header property to True

  • Read the CSV file row by row, but skip any row that start with text instead of a numerical value

  • Read the CSV file row by row, but start at the 2nd row

  • Use the header function of the csv module

Explicación

Pregunta 5 de 10

1

Which module is used for writing data and formatting information to older Excel files, i.e. .xls files before Excel 2010?

Selecciona una de las siguientes respuestas posibles:

  • xlrd

  • openpyxl

  • xlsxwriter

  • xlwt

Explicación

Pregunta 6 de 10

1

The openpyxl module can be used to work with both .xls as well as .xlsx files.

Selecciona uno de los siguientes:

  • VERDADERO
  • FALSO

Explicación

Pregunta 7 de 10

1

How would you determine the number of rows and columns with data values in an Excel file using the xlrd module?

Selecciona una de las siguientes respuestas posibles:

  • use the nrows and ncols properties of the Sheet object

  • read data values until you encounter a row or column with only empty string values

  • read the number of rows and columns from the header file

  • use the row_values and col_values functions

Explicación

Pregunta 8 de 10

1

Consider the following code:

import xlrd
book = xlrd.open_workbook("C:/Temp/Myfile.xlsx")
sheet = book.sheet_by_index(0)

How would you print all data values in the worksheet, one by one?

Selecciona una de las siguientes respuestas posibles:

  • for i in range(sheet.nrows):
    print sheet.row_values(i)

  • for i in range(sheet.nrows):
    print sheet.row(i)

  • print sheet.row()

  • print sheet.row_values()

Explicación

Pregunta 9 de 10

1

Which of the following is not a cell type for Excel data in the xlrd module?

Selecciona una de las siguientes respuestas posibles:

  • Text

  • Integer

  • Date

  • Boolean

  • Blank

  • Error

Explicación

Pregunta 10 de 10

1

Consider an Excel file with multiple worksheets and the following code:

import xlrd
book = xlrd.open_workbook("C:/Project/Data.xls")

How would you print the name of each worksheet?

Selecciona una de las siguientes respuestas posibles:

  • print book.sheetnames

  • for sheet in book:
    print book.sheet.name

  • for sheet in book.sheets():
    print sheet.name

  • print book.sheet.name()

Explicación