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

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

51
2
0
Maggie Samson
Creado por Maggie Samson hace alrededor de 5 años
Cerrar

GEOM 73 - Python Quiz 6

Pregunta 1 de 10

1

The three general types of errors in a Python script are: (check three)

Selecciona una o más de las siguientes respuestas posibles:

  • exceptions

  • syntax errors

  • typos

  • geoprocessing waning messages

  • logic errors

  • traceback

Explicación

Pregunta 2 de 10

1

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)

Selecciona una o más de las siguientes respuestas posibles:

  • Geoprocessing error

  • Syntax error

  • Logic error

  • Exceptions

Explicación

Pregunta 3 de 10

1

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?

Selecciona una de las siguientes respuestas posibles:

  • Indentation

  • Variable naming errors

  • General syntax errors

  • Capitalization

  • Logic errors

Explicación

Pregunta 4 de 10

1

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.

Selecciona una de las siguientes respuestas posibles:

  • ExecuteError

  • ToolError

  • ArcPyError

  • GeoprocessingError

Explicación

Pregunta 5 de 10

1

Which programming structure is used to handle exceptions in a Python script?

Selecciona una de las siguientes respuestas posibles:

  • for-while

  • try-except

  • try-else

  • if-else

Explicación

Pregunta 6 de 10

1

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)

Selecciona una o más de las siguientes respuestas posibles:

  • ListFields

  • name

  • str

  • workspace

  • import

  • print

  • field

  • length

  • arcpy

  • env

Explicación

Pregunta 7 de 10

1

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?

Selecciona una de las siguientes respuestas posibles:

  • 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

Explicación

Pregunta 8 de 10

1

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?

Selecciona una de las siguientes respuestas posibles:

  • import os
    print os.getcwd()

  • import os
    print os.path

  • import sys
    print sys.path

  • import sys
    print sys.path[0]

Explicación

Pregunta 9 de 10

1

Classes are like blueprints for how to create objects. Each object created from a class is called a(n) ___ of the class.

Selecciona una de las siguientes respuestas posibles:

  • function

  • element

  • copy

  • instance

  • property

Explicación

Pregunta 10 de 10

1

What is the general syntax to create your own custom function in a script?

Selecciona una de las siguientes respuestas posibles:

  • def <functionname>.<arguments>

  • create <functionname>(<arguments>)

  • create <functionname>.<arguments>

  • def <functionname>(<arguments>)

Explicación