100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Examen

COMP 110: Qz02 Exam Questions With Correct Answers A+

Puntuación
-
Vendido
-
Páginas
7
Grado
A+
Subido en
04-01-2025
Escrito en
2024/2025

COMP 110: Qz02 Exam Questions With Correct Answers A+ Which syntax will import the module named helpers from the package named lessons? - Answerfrom lessons import helpers When an import statement imports another module for the first time, what happens at a high level? - AnswerThe entire imported module is evaluated Suppose a module named foo is imported from a packaged named bar. In the scope (frame) where foo is imported, foo is bound to the globals frame of the module foo after the entire module evaluates. - AnswerTrue In what scenario is __name__ not assigned "__main__"? - AnswerWhen a python module is being imported into another module. In what scenario is __name__ assigned "__main__"? - AnswerWhen a python module is being run as a program such as python -m ts Which syntax will import the function named powerful from the module named helpers contained in the package named lessons? - Answerfrom rs import powerful Which syntax will alias the helpers module imported from the lessons package with a local name of hp? - Answerfrom lessons import helpers as hp You can access global variables in other modules via importing the module or the variable directly - Answerfalse The word "unit" in "unit testing" refers to: - AnswerA unit of functionality One benefit of unit testing is that once you have written your test functions it is less cumbersome to rerun multiple tests than testing manually in the REPL. - AnswerTrue One benefit of unit testing is that when a test fails the output is more helpful in showing you where exactly a test case is failing. - AnswerTrue The assert keyword should be followed by a boolean expression. This expression should evaluate to True if the unit of functionality you are testing is working correctly, as expected. - AnswerTrue When using pytest, a popular unit testing framework, what convention must the file name of the file containing your test functions follow? - AnswerEnds with _ ©Jason MacConnell 2025 ALL RIGHTS RESERVED. When using pytest, what convention must the names of the test functions inside the test file follow in order to be discovered as test cases? - Answerbegins with test_ Suppose your test subject(s) (the function(s) you are working on) are contained in a directory named lessons and a file named . Imagine the function you are working on is named example_function. How would you import the function into your tests file? - Answerfrom cts import example_function Suppose your test functions are contained in a directory named lessons and a file named subjects_. How would you run pytest from the terminal? - Answerpython -m pytest lessons/subjects_ You should write many individual tests that probe specific, individual use and edge cases rather than very few complex tests that probe many use/edge cases at the same time. - AnswerTrue The same variable name cannot have different meanings in different contexts within a single Python program. - Answerfalse In an environment diagram, a function call frame is its own context for the names of parameters and variables defined within the function. - AnswerTrue What would be the printed result of evaluating the following Python code listing? x: int = 0 def f() -> None: x: int = 1 f() print (x) - Answer0 In an environment diagram for the example above, the function call to f results in a new frame. That call's evaluation would result in the frame having a variable named x defined in it whose value is 1. - AnswerTrue The following subquestions regard the code listing below: x: int = 1 def f(y: int) -> int: return x + y

Mostrar más Leer menos
Institución
Comp 110
Grado
Comp 110









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Comp 110
Grado
Comp 110

Información del documento

Subido en
4 de enero de 2025
Número de páginas
7
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

©Jason MacConnell 2025 ALL RIGHTS RESERVED.




COMP 110: Qz02 Exam Questions With
Correct Answers A+


Which syntax will import the module named helpers from the package named lessons? -
Answer✔from lessons import helpers
When an import statement imports another module for the first time, what happens at a high
level? - Answer✔The entire imported module is evaluated
Suppose a module named foo is imported from a packaged named bar. In the scope (frame)
where foo is imported, foo is bound to the globals frame of the module foo after the entire
module evaluates. - Answer✔True
In what scenario is __name__ not assigned "__main__"? - Answer✔When a python module is
being imported into another module.
In what scenario is __name__ assigned "__main__"? - Answer✔When a python module is being
run as a program such as python -m lessons.imports
Which syntax will import the function named powerful from the module named helpers
contained in the package named lessons? - Answer✔from lessons.helpers import powerful
Which syntax will alias the helpers module imported from the lessons package with a local name
of hp? - Answer✔from lessons import helpers as hp
You can access global variables in other modules via importing the module or the variable
directly - Answer✔false

The word "unit" in "unit testing" refers to: - Answer✔A unit of functionality
One benefit of unit testing is that once you have written your test functions it is less cumbersome
to rerun multiple tests than testing manually in the REPL. - Answer✔True
One benefit of unit testing is that when a test fails the output is more helpful in showing you
where exactly a test case is failing. - Answer✔True
The assert keyword should be followed by a boolean expression. This expression should evaluate
to True if the unit of functionality you are testing is working correctly, as expected. -
Answer✔True
When using pytest, a popular unit testing framework, what convention must the file name of the
file containing your test functions follow? - Answer✔Ends with _test.py

, ©Jason MacConnell 2025 ALL RIGHTS RESERVED.

When using pytest, what convention must the names of the test functions inside the test file
follow in order to be discovered as test cases? - Answer✔begins with test_
Suppose your test subject(s) (the function(s) you are working on) are contained in a directory
named lessons and a file named subjects.py. Imagine the function you are working on is named
example_function. How would you import the function into your tests file? - Answer✔from
lessons.subjects import example_function
Suppose your test functions are contained in a directory named lessons and a file named
subjects_test.py. How would you run pytest from the terminal? - Answer✔python -m pytest
lessons/subjects_test.py
You should write many individual tests that probe specific, individual use and edge cases rather
than very few complex tests that probe many use/edge cases at the same time. - Answer✔True
The same variable name cannot have different meanings in different contexts within a single
Python program. - Answer✔false
In an environment diagram, a function call frame is its own context for the names of parameters
and variables defined within the function. - Answer✔True
What would be the printed result of evaluating the following Python code listing?


x: int = 0


def f() -> None:
x: int = 1


f()
print (x) - Answer✔0
In an environment diagram for the example above, the function call to f results in a new frame.
That call's evaluation would result in the frame having a variable named x defined in it whose
value is 1. - Answer✔True
The following subquestions regard the code listing below:


x: int = 1


def f(y: int) -> int:
return x + y
$10.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Thumbnail
Package deal
Comp 110 Exam Package Deal A+
-
9 2025
$ 93.91 Más información

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
StarGuide Liberty University
Ver perfil
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
16
Miembro desde
1 año
Número de seguidores
0
Documentos
2591
Última venta
1 semana hace
FIRST CLASS GALORE

Accurate Exam Study Materials.Verified And Updated By Professionals.

4.3

4 reseñas

5
1
4
3
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes