GEOM 73 - Python Quiz 6

Beschreibung

Geography Quiz am GEOM 73 - Python Quiz 6, 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 mehr als 5 Jahre
51
2

Zusammenfassung der Ressource

Frage 1

Frage
The three general types of errors in a Python script are: (check three)
Antworten
  • exceptions
  • syntax errors
  • typos
  • geoprocessing waning messages
  • logic errors
  • traceback

Frage 2

Frage
Which of the following errors will stop a script from running mid-process, i.e. the script runs, but not all of the code can be executed? (check all that apply)
Antworten
  • Geoprocessing error
  • Syntax error
  • Logic error
  • Exceptions

Frage 3

Frage
Which type of error is the most likely to occur as a result of copying/pasting code from other file types, like Word, PDF or HTML?
Antworten
  • Indentation
  • Variable naming errors
  • General syntax errors
  • Capitalization
  • Logic errors

Frage 4

Frage
When you run a script and a geoprocessing tool fails to run for some reason (e.g. missing data, invalid parameters, not able to write the results, etc.), ArcPy throws a(n) ___exception.
Antworten
  • ExecuteError
  • ToolError
  • ArcPyError
  • GeoprocessingError

Frage 5

Frage
Which programming structure is used to handle exceptions in a Python script?
Antworten
  • for-while
  • try-except
  • try-else
  • if-else

Frage 6

Frage
Consider the following script: import arcpy arcpy.env.workspace = "c:/data" fieldlist = arcpy.ListFields("roads.shp") for field in fieldlist: print field.name + " " + str(field.length) Which of the following is (are) a function? (check all that apply)
Antworten
  • ListFields
  • name
  • str
  • workspace
  • import
  • print
  • field
  • length
  • arcpy
  • env

Frage 7

Frage
Consider the following script: class LicenseError(Exception): pass import arcpy from arcpy import env try: if arcpy.CheckExtension("3D") == "Available": arcpy.CheckOutExtension("3D") else: raise LicenseError env.workspace = "C:/raster" arcpy.Slope_3d("elevation", "slope") except LicenseError: print "3D license is unavailable" except: print arcpy.GetMessages(2) finally: arcpy.CheckInExtension("3D") What does the finally code block accomplish?
Antworten
  • Check in the license, regardless of whether any exceptions were raised
  • Check in the license once the geoprocessing tool has been completed
  • Check in the license, regardless of whether the geoprocessing tool resulted in any errors or not
  • Check in the license if indeed a license was checked out

Frage 8

Frage
You typically import a module into a script in order to use its functions. How can you determine where Python looks by default for all the possible locations of this module?
Antworten
  • import os print os.getcwd()
  • import os print os.path
  • import sys print sys.path
  • import sys print sys.path[0]

Frage 9

Frage
Classes are like blueprints for how to create objects. Each object created from a class is called a(n) ___ of the class.
Antworten
  • function
  • element
  • copy
  • instance
  • property

Frage 10

Frage
What is the general syntax to create your own custom function in a script?
Antworten
  • def <functionname>.<arguments>
  • create <functionname>(<arguments>)
  • create <functionname>.<arguments>
  • def <functionname>(<arguments>)
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