CIS Chapter 2
The ________ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.
input( )
Which mathematical operator is used to raise 5 to the second power in Python?
**
What is the output of the following command, given that value1 = 2.0 and value2 = 12? print(value1 * value2)
24.0
After the execution of the following statement, the variable price will reference the value ________. price = int(68.549)
68
Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produced.
?
According to the behavior of integer division, when an integer is divided by an integer, the result will be a float.
False
In Python, math expressions are always evaluated from left to right, no matter what the operators are.
False
What is the output of the following print statement? print 'I\'m ready to begin'
I'm ready to begin
What is the output of the following print statement? print('The path is D:\\sample\\test.')
The path is D: \ sample \ test.
The line continuation character is a
\
What symbol is used to mark the beginning and end of a string?
a quote mark (")
he Python turtle is initially positioned in the ________ of a graphics window and it first appears, by default, to be heading ________.
center, east
________ are notes of explanation that document lines or sections of a program.
comments
Python uses ________ to categorize values in memory
data types
In a print statement, you can set the ________ argument to a space or empty string to stop the output from advancing to a new line
end
A(n) ________ character is a special character that is preceded with a backslash (\), appearing inside a string literal
escape
After the execution of the following statement, the variable sold will reference the numeric literal value as (n) ________ data type. sold = 256.752
float
A(n) ________ is a diagram that graphically depicts the steps that take place in a program?
flowchart
The % symbol is the remainder operator, also known as the ________ operator.
modulus, mod
A ________ is a name that represents a value the cannot be changed during a program's execution.
named constant
In the expression 12.45 + 3.6, the values to the right and left of the + symbol are the ________.
operands
Which of the following will display 20%?
print(format(0.2, '.0%')
What is the informal language, used by programmers use to create models of programs, that has no syntax rules and is not meant to be compiled or executed?
pseudocode
A(n) ________ is a single task that the program must perform in order to satisfy the customer.
software requirement
Select all that apply. Which of the following are steps in the program development cycle?
test the program, design the program, write the code and correct syntax errors, correct logic errors
A(n) ________ is a name that represents a value stored in the computer's memory.
variable
When applying the .3f formatting specifier to the number 76.15854, the result is ________.
76.159
Python formats all floating-point numbers to two decimal places when outputting with the print statement
False
Since a named constant is just a variable, it can change any time during a program's execution.
False
Select all that apply. Assume you are writing a program that calculates a user's total order cost that includes sales tax of 6.5%. Which of the following are advantages of using a named constant to represent the sales tax instead of simply entering 0.065 each time the tax is required in the code?
It avoids the risk that any change to the value of sales tax will be made incorrectly or that an instance of the tax value might be missed as might occur if the number had to be changed in multiple locations.
A flowchart is a tool used by programmers to design programs.
True
Comments in Python begin with the # character.
True
In Python, print statements written on separate lines do not necessarily output on separate lines.
True
Python allows programmers to break a statement into multiple lines.
True
The \t escape character causes the output to skip over to the next horizontal tab.
True
When using the camelCase naming convention, the first word of the variable name is written in lowercase and the first characters of all subsequent words are written in uppercase.
True
When the + operator is used with two strings, it performs string ________.
concatenation
The ________ specifier is a special set of characters that specify how a value should be formatted
formatting
To use Python's turtle graphics, you must include which of the following statements in your program?
import turtle
The ________ built-in function is used to read a number that has been typed on the keyboard.
input( )