Weeks 2 & 3 Python
What must you use to create a multi-line string? a. A single pair of double quotation marks b. A single pair of single quotation marks c. A single pair of three consecutive double quotation marks d. Embedded newline characters
c. A single pair of three consecutive double quotation marks
What does a programmer do during the analysis phase of software development? a. Codes the program in a particular programming language b. Writes the algorithms for solving a problem c. Decides what the program will do and determines its user interface d. Tests the program to verify its correctness
c. Decides what the program will do and determines its user interface
What must a programmer use to test a program? a. All possible sets of legitimate inputs b. All possible sets of inputs c. A single set of legitimate inputs d. A reasonable set of legitimate inputs
d. A reasonable set of legitimate inputs
What is the purpose of the dir function and the help function?
dir function explains lists the directory of its resources. help function explains the function: help(function)
Write an import statement that imports just the functions sqrt and log from the math module.
from math import sqrt, log
Assume that the variable name has the value 33. What is the value of name after the assignment name = name * 2 executes? a. 35 b. 33 c. 66
c. 66
The expression round(23.67) evaluates to which of the following values? a. 23 b. 23.7 c. 24
c. 24
What is used to begin an end-of-line comment? a. / symbol b. # symbol c. % symbol
b. # symbol
The expression 2 ** 3 ** 2 evaluates to which of the following values? a. 64 b. 512 c. 8
b. 512
Which of the following lists of operators is ordered by decreasing precedence? a. +, *, ** b. *, /, % c. **, *, +
c. **, *, +