Unit 2 Reviewing the Basic Quiz

From Void-Byte
Jump to navigation Jump to search

1. Which of the following lists of operators is ordered by decreasing precedence?

-, //, **
+, *, **
*, /, %
**, *, +

2. What is used to begin an end-of-line comment?

/ symbol
% symbol
# symbol
* symbol

3. Which function returns a list of the named resources (functions and variables) in its argument?

resources
dir
list
names

4. What does a programmer do during the analysis phase of software development?

Decides what the program will do and determines its user interface
Codes the program in a particular programming language
Tests the program to verify its correctness
Writes the algorithms for solving a problem

5. What must you use to create a multi-line string?

Embedded newline characters
A single pair of double quotation marks
A single pair of three consecutive double quotation marks
A single pair of single quotation marks

6. The expression round(23.67) evaluates to which of the following values?

23.7
23
23.5
24

7. The expression 2 ** 3 ** 2 evaluates to which of the following values?

256
64
512
8

8. What must a programmer use to test a program?

All possible sets of legitimate inputs
A single set of legitimate inputs
All possible sets of inputs
A reasonable set of legitimate inputs

9. Which statement imports the functions sqrt and log from the math module?

sqrt, log: math.import
import sqrt(), log() from math() module
from math import sqrt, log
mport sqrt.math, log.math

10. Assume that the variable name has the value 33. What is the value of name after the assignment name = name * 2 executes?

35
33
66
30