Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 10 pages
Exam (elaborations)

COMP 110 Quiz 02– Complete Questions with 100% Correct Answers | Verified

Document preview thumbnail
Preview 2 out of 10 pages

COMP 110 Quiz 02– Complete Questions with 100% Correct Answers | Verified

Content preview

COMP 110 Quiz 02– Complete Questions with
100% Correct Answers | Verified
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. - ✔✔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. - ✔✔True


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. - ✔✔True


When using pytest, a popular unit testing framework, what convention must the file
name of the file containing your test functions follow? - ✔✔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? - ✔✔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? - ✔✔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? - ✔✔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. -
✔✔True


True or False?
The same variable name cannot have different meanings in different contexts within a
single Python program. - ✔✔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. - ✔✔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) - ✔✔0

Document information

Uploaded on
January 4, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
QUINTER
3.6
(71)
Sold
406
Followers
106
Items
39872
Last sold
2 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions