GEOM 73 - Python Quiz 10

Beschreibung

Geography Quiz am GEOM 73 - Python Quiz 10, erstellt von Maggie Samson am 14/04/2019.
Maggie Samson
Quiz von Maggie Samson, aktualisiert more than 1 year ago
Maggie Samson
Erstellt von Maggie Samson vor etwa 5 Jahre
49
1

Zusammenfassung der Ressource

Frage 1

Frage
What does CSV stand for?
Antworten
  • Comma Separated Values
  • Cell Separated Values
  • Comma Separation Values
  • Cell Separation Values

Frage 2

Frage
The csv module is a standard Python library and no separate installation is needed.
Antworten
  • True
  • False

Frage 3

Frage
Consider the following code: import csv csvfile = open('test.csv', "rb") reader = csv.reader(cvsfile) What does the csv.reader function accomplish?
Antworten
  • 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.

Frage 4

Frage
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?
Antworten
  • 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

Frage 5

Frage
Which module is used for writing data and formatting information to older Excel files, i.e. .xls files before Excel 2010?
Antworten
  • xlrd
  • openpyxl
  • xlsxwriter
  • xlwt

Frage 6

Frage
The openpyxl module can be used to work with both .xls as well as .xlsx files.
Antworten
  • True
  • False

Frage 7

Frage
How would you determine the number of rows and columns with data values in an Excel file using the xlrd module?
Antworten
  • 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

Frage 8

Frage
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?
Antworten
  • 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()

Frage 9

Frage
Which of the following is not a cell type for Excel data in the xlrd module?
Antworten
  • Text
  • Integer
  • Date
  • Boolean
  • Blank
  • Error

Frage 10

Frage
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?
Antworten
  • print book.sheetnames
  • for sheet in book: print book.sheet.name
  • for sheet in book.sheets(): print sheet.name
  • print book.sheet.name()
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Geography Quiz
PatrickNoonan
Geography Coastal Zones Flashcards
Zakiya Tabassum
Using GoConqr to study geography
Sarah Egan
All the Countries of the World and their Capital Cities
PatrickNoonan
Tectonic Hazards flashcards
katiehumphrey
Volcanoes
1jdjdjd1
River Processes and Landforms
1jdjdjd1
GCSE Geography - Causes of Climate Change
Beth Coiley
The Rock Cycle
eimearkelly3
Plate Tectonics
eimearkelly3
Characteristics and Climate of a hot desert
Adam Collinge