Python Exam 3-Questions With 100%
Verified Answers.
A while loop written as while True - ✔✔Might be an infinite loop depending on what the
loop body contains
What would be the final value of total for the following program?
total = 0
for i in range(10):
for j in range(10):
total = total + 1 - ✔✔100
the term for an operator that may not evaluate one of its sub-expressions is called -
✔✔short-circuit
T or F Computers can generate truly random numbers - ✔✔false
T or F Top-down design is also called stepwise refinement - ✔✔true
T or F in top-down design, the main algorithm is written in terms of functions that don't exist
yet - ✔✔True
Which of the following statements is true about computer
simulation -They model real world exactly
-Once the sim is written, the input values can be tweaked to see how it affects the results
, -All computer sims are easy to write
-All of the above
-None of the above - ✔✔-Once the sim is written, the input values can be tweaked to see
how it affects the results
Which of the following statements could be true about the following python code?
from random import randrange
for i in range (10):
print(randrange(10))
-It might output the numbers 0-9 in that order
-It might output 0-9 in some order
-It might output 0 ten times
-all of the above
-none of the above - ✔✔all of the above
A simulation that uses probabilistic events is called - ✔✔Monte Carlo
The initial version of a system used in spiral development is called a - ✔✔prototype
Which of the following is not a step in pure top-down
design -repeat the process on smaller problems
-Detail the algorithm in terms of its interfaces with smaller problems
-Construct a simplified prototype of the system
-Express the algorithm in terms of smaller problems - ✔✔Construct a simplified prototype
of the system
What is unit testing - ✔✔testing separate parts/units of the program separately
Verified Answers.
A while loop written as while True - ✔✔Might be an infinite loop depending on what the
loop body contains
What would be the final value of total for the following program?
total = 0
for i in range(10):
for j in range(10):
total = total + 1 - ✔✔100
the term for an operator that may not evaluate one of its sub-expressions is called -
✔✔short-circuit
T or F Computers can generate truly random numbers - ✔✔false
T or F Top-down design is also called stepwise refinement - ✔✔true
T or F in top-down design, the main algorithm is written in terms of functions that don't exist
yet - ✔✔True
Which of the following statements is true about computer
simulation -They model real world exactly
-Once the sim is written, the input values can be tweaked to see how it affects the results
, -All computer sims are easy to write
-All of the above
-None of the above - ✔✔-Once the sim is written, the input values can be tweaked to see
how it affects the results
Which of the following statements could be true about the following python code?
from random import randrange
for i in range (10):
print(randrange(10))
-It might output the numbers 0-9 in that order
-It might output 0-9 in some order
-It might output 0 ten times
-all of the above
-none of the above - ✔✔all of the above
A simulation that uses probabilistic events is called - ✔✔Monte Carlo
The initial version of a system used in spiral development is called a - ✔✔prototype
Which of the following is not a step in pure top-down
design -repeat the process on smaller problems
-Detail the algorithm in terms of its interfaces with smaller problems
-Construct a simplified prototype of the system
-Express the algorithm in terms of smaller problems - ✔✔Construct a simplified prototype
of the system
What is unit testing - ✔✔testing separate parts/units of the program separately