GEOM 73 - Python Quiz 6

Descripción

Geography Test sobre GEOM 73 - Python Quiz 6, creado por Maggie Samson el 14/04/2019.
Maggie Samson
Test por Maggie Samson, actualizado hace más de 1 año
Maggie Samson
Creado por Maggie Samson hace alrededor de 5 años
51
2

Resumen del Recurso

Pregunta 1

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

Pregunta 2

Pregunta
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)
Respuesta
  • Geoprocessing error
  • Syntax error
  • Logic error
  • Exceptions

Pregunta 3

Pregunta
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?
Respuesta
  • Indentation
  • Variable naming errors
  • General syntax errors
  • Capitalization
  • Logic errors

Pregunta 4

Pregunta
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.
Respuesta
  • ExecuteError
  • ToolError
  • ArcPyError
  • GeoprocessingError

Pregunta 5

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

Pregunta 6

Pregunta
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)
Respuesta
  • ListFields
  • name
  • str
  • workspace
  • import
  • print
  • field
  • length
  • arcpy
  • env

Pregunta 7

Pregunta
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?
Respuesta
  • 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

Pregunta 8

Pregunta
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?
Respuesta
  • import os print os.getcwd()
  • import os print os.path
  • import sys print sys.path
  • import sys print sys.path[0]

Pregunta 9

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

Pregunta 10

Pregunta
What is the general syntax to create your own custom function in a script?
Respuesta
  • def <functionname>.<arguments>
  • create <functionname>(<arguments>)
  • create <functionname>.<arguments>
  • def <functionname>(<arguments>)
Mostrar resumen completo Ocultar resumen completo

Similar

Geography Coastal Zones Flashcards
Zakiya Tabassum
GCSE Geography - Causes of Climate Change
Beth Coiley
Geography Quiz
PatrickNoonan
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
The Rock Cycle
eimearkelly3
Plate Tectonics
eimearkelly3
Characteristics and Climate of a hot desert
Adam Collinge