100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

COMP 110 Quiz 02 Exam Questions With Correct Answers A+

Beoordeling
-
Verkocht
-
Pagina's
8
Cijfer
A+
Geüpload op
04-01-2025
Geschreven in
2024/2025

COMP 110 Quiz 02 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 True or False? 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__ assigned "__main__"? - AnswerWhen a Python module is being run as a program such as python -m ts In what scenario is __name__ not assigned "__main__"? - AnswerWhen a Python module is being imported into another module 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 True of False? You can access global variables in other modules via importing the module or the variable directly. - AnswerTrue The word "unit" in "unit testing" refers to: - Answera unit of functionality True of False? 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 True or False? 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 ©Jason MacConnell 2025 ALL RIGHTS RESERVED. True or False? 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 _ 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? - AnswerBegin 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_ True of False? 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 True or False? The same variable name cannot have different meanings in different contexts within a single Python program. - AnswerFalse True or False? 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 fo

Meer zien Lees minder
Instelling
Comp 110
Vak
Comp 110









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Comp 110
Vak
Comp 110

Documentinformatie

Geüpload op
4 januari 2025
Aantal pagina's
8
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

©Jason MacConnell 2025 ALL RIGHTS RESERVED.




COMP 110 Quiz 02 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
True or False?
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__ assigned "__main__"? - Answer✔When a Python module is being
run as a program such as python -m lessons.imports
In what scenario is __name__ not assigned "__main__"? - Answer✔When a Python module is
being imported into another module
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
True of False?
You can access global variables in other modules via importing the module or the variable
directly. - Answer✔True

The word "unit" in "unit testing" refers to: - Answer✔a unit of functionality
True of False?
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
True or False?
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

, ©Jason MacConnell 2025 ALL RIGHTS RESERVED.

True or False?
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
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✔Begin 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
True of False?
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
True or False?
The same variable name cannot have different meanings in different contexts within a single
Python program. - Answer✔False
True or 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()
€9,69
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
StarGuide Liberty University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
16
Lid sinds
1 jaar
Aantal volgers
0
Documenten
2591
Laatst verkocht
1 week geleden
FIRST CLASS GALORE

Accurate Exam Study Materials.Verified And Updated By Professionals.

4,3

4 beoordelingen

5
1
4
3
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen