Readable Code — Unit test Answers

5 verified answers1 views
21
Free Preview

Readable code

A
is written in large font.
B
is written neatly in straight columns.
C
is easy to understand and useful to other programmers working with the code.
D
is password protected so that only authorized programmers can access it.
22
Free Preview

What does the program print out as a result of the given snippet of code?supplies = ["pencil", "notebook", "backpack", "calculator", "pen"]print(len(supplies))

A
5
B
8
C
[‘backpack’, ‘calculator’, ‘notebook’, ‘pen’, ‘pencil’]
D
[‘pencil’, ‘notebook’, ‘backpack’, ‘calculator’, ‘pen’]
23

Find the error in the statement below.if height_variable > 59; print("You can ride this roller coaster.")

A
The opening parenthesis should be at the beginning of the second line.
B
The second line should not be indented.
C
The semi-colon should be a colon.
D
The > should be a <.
24

Why is the len ( ) function useful when using a loop to iterate through a stack?

A
The len ( ) function will print the elements of the stack.
B
The len ( ) function will run with each iteration, printing the element number each time.
C
The len ( ) function will tell the program the number of elements in the stack.
D
The len ( ) function will remove the duplicate elements in the stack.
25

Which is true of diagnosing and troubleshooting?

A
Diagnosing attempts to identify the source of a problem, while troubleshooting looks for the nature of the problem.
B
Diagnosing is used to fix problems with hardware, while troubleshooting is used to fix problems in program code.
C
Diagnosing looks for the nature of the problem, while troubleshooting attempts to identify the source of the problem.
D
Diagnosing is used to fix problems in program code, while troubleshooting is used to fix problems with hardware.

Did you find these answers helpful?

Readable Code — Unit test Answers —…