GEOM 73 - Python Quiz 6

Descrição

Geography Quiz sobre GEOM 73 - Python Quiz 6, criado por Maggie Samson em 14-04-2019.
Maggie Samson
Quiz por Maggie Samson, atualizado more than 1 year ago
Maggie Samson
Criado por Maggie Samson mais de 5 anos atrás
58
2

Resumo de Recurso

Questão 1

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

Questão 2

Questão
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)
Responda
  • Geoprocessing error
  • Syntax error
  • Logic error
  • Exceptions

Questão 3

Questão
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?
Responda
  • Indentation
  • Variable naming errors
  • General syntax errors
  • Capitalization
  • Logic errors

Questão 4

Questão
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.
Responda
  • ExecuteError
  • ToolError
  • ArcPyError
  • GeoprocessingError

Questão 5

Questão
Which programming structure is used to handle exceptions in a Python script?
Responda
  • for-while
  • try-except
  • try-else
  • if-else

Questão 6

Questão
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)
Responda
  • ListFields
  • name
  • str
  • workspace
  • import
  • print
  • field
  • length
  • arcpy
  • env

Questão 7

Questão
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?
Responda
  • 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

Questão 8

Questão
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?
Responda
  • import os print os.getcwd()
  • import os print os.path
  • import sys print sys.path
  • import sys print sys.path[0]

Questão 9

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

Questão 10

Questão
What is the general syntax to create your own custom function in a script?
Responda
  • def <functionname>.<arguments>
  • create <functionname>(<arguments>)
  • create <functionname>.<arguments>
  • def <functionname>(<arguments>)

Semelhante

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