COMP 110 Test2– Complete Questions with 100%
Correct Answers | Verified
Every individual character in a str has a corresponding int value.
True or False - ✔✔True
How many digits are there in hexidecimal ("hex") numbers?
Choice 1 of 4:2Choice 2 of 4:8Choice 3 of 4:10Choice 4 of 4:16 - ✔✔16
The largest hex digit is F. What is its value in the decimal system?
Choice 1 of 5:6Choice 2 of 5:9Choice 3 of 5:14Choice 4 of 5:15Choice 5 of 5:16 -
✔✔15
The following string uses an escape sequence that causes it to span multiple lines when
printed?
"Hello\nworld\n!!!"
True or False - ✔✔True
Your computer knows when you write an infinite loop in your program and will not run
your program if it sees it is doing pointless, endless work on your behalf.
True or False - ✔✔False
Function calls are expressions that evaluate to a specific data type.
True or False - ✔✔True
In a memory diagram, if I encounter the line y: list[int] = x, where x is an already defined
list[int], what should I write next to y on the stack?
, Choice 1 of 3:The id of the object on the heap x is a reference toChoice 2 of 3:A copy of
all of the elements of xChoice 3 of 3:An id to a new object on the heap that is a copy of x
- ✔✔Choice 1 of 3: The id of the object on the heap x is a reference to
Which syntax will import the function named powerful from the module named helpers
contained in the package named lessons?
Choice 1 of 3:import powerful from lessons.helpersChoice 2 of 3:from lessons.helpers
import powerfulChoice 3 of 3:from powerful import lessons.helpers - ✔✔from
lessons.helpers import powerful
For the following examples, you'll be importing the following module named a
contained in the package named b:
def double(x: int) -> int: return x * 2 def double_display(y: int): print(y * 2)
double_display(2) if __name__ == "__main__": print(double(3))
Say we defined the module module named c contained in the package named b in the
following way:
from b.a import double, double_display print(double(1)) double_display(4)
What is the output after running python -m b.c?
Choice 1 of 5:2, 8 (With commas representing a new line.)Choice 2 of 5:2, 4, 8 (With
commas representing a new line.)Choice 3 of 5:4, 2, 8 (With commas representing a
new line.)Choice 4 of 5:NoneChoice 5 of 5:Error - ✔✔4, 2, 8
You can directly and efficiently lookup a key by its value in a dictionary.
True or False - ✔✔False
Dictionary objects are stored in which part of memory?
Choice 1 of 2:stackChoice 2 of 2:heap - ✔✔heap
Correct Answers | Verified
Every individual character in a str has a corresponding int value.
True or False - ✔✔True
How many digits are there in hexidecimal ("hex") numbers?
Choice 1 of 4:2Choice 2 of 4:8Choice 3 of 4:10Choice 4 of 4:16 - ✔✔16
The largest hex digit is F. What is its value in the decimal system?
Choice 1 of 5:6Choice 2 of 5:9Choice 3 of 5:14Choice 4 of 5:15Choice 5 of 5:16 -
✔✔15
The following string uses an escape sequence that causes it to span multiple lines when
printed?
"Hello\nworld\n!!!"
True or False - ✔✔True
Your computer knows when you write an infinite loop in your program and will not run
your program if it sees it is doing pointless, endless work on your behalf.
True or False - ✔✔False
Function calls are expressions that evaluate to a specific data type.
True or False - ✔✔True
In a memory diagram, if I encounter the line y: list[int] = x, where x is an already defined
list[int], what should I write next to y on the stack?
, Choice 1 of 3:The id of the object on the heap x is a reference toChoice 2 of 3:A copy of
all of the elements of xChoice 3 of 3:An id to a new object on the heap that is a copy of x
- ✔✔Choice 1 of 3: The id of the object on the heap x is a reference to
Which syntax will import the function named powerful from the module named helpers
contained in the package named lessons?
Choice 1 of 3:import powerful from lessons.helpersChoice 2 of 3:from lessons.helpers
import powerfulChoice 3 of 3:from powerful import lessons.helpers - ✔✔from
lessons.helpers import powerful
For the following examples, you'll be importing the following module named a
contained in the package named b:
def double(x: int) -> int: return x * 2 def double_display(y: int): print(y * 2)
double_display(2) if __name__ == "__main__": print(double(3))
Say we defined the module module named c contained in the package named b in the
following way:
from b.a import double, double_display print(double(1)) double_display(4)
What is the output after running python -m b.c?
Choice 1 of 5:2, 8 (With commas representing a new line.)Choice 2 of 5:2, 4, 8 (With
commas representing a new line.)Choice 3 of 5:4, 2, 8 (With commas representing a
new line.)Choice 4 of 5:NoneChoice 5 of 5:Error - ✔✔4, 2, 8
You can directly and efficiently lookup a key by its value in a dictionary.
True or False - ✔✔False
Dictionary objects are stored in which part of memory?
Choice 1 of 2:stackChoice 2 of 2:heap - ✔✔heap