Homework 3
What symbol is used to mark the beginning and end of a string? a quote mark (") a slash (/) a comma (,) an asterisk (*)
a quote mark (")
A flowchart is a tool used by programmers to design programs.
true
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
What is the output of the following print statement? print 'I\'m ready to begin' I\'m ready to begin I'm ready to begin Im ready to begin '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 path is D:\\sample\\test.' The path is D:\\sample\\test. The path is D:\sample\test.
The path is D:\sample\test. '\\' prints \ \\ is the integer divider
The line continuation character is a % \ & #
\
A string literal in Python must be enclosed in parentheses single-quotes double-quotes either single-quotes or double-quotes
either single-quotes or double-quotes
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. stop newLine separator end
end end = ''
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
In your Python program, you can use reserved words as variable names.
false
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
The Python interpreter ignores the underscore character, so walk_home and walk home would be treated as the same identifier.
false
After the execution of the following statement, the variable sold will reference the numeric literal value as (n) ________ data type. sold = 256.752 str currency int float
float
A(n) ________ is a diagram that graphically depicts the steps that take place in a program? pseudocode algorithm flowchart source code
flowchart
The ________ built-in function is used to read a number that has been typed on the keyboard. input() read() get() keyboard()
input()
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. eval_input() output() input() str_input()
input()
Which of the following will display 20%? print(format(0.2, '%')) <enter> print(format(0.2, '.0%')) <enter> print(format(0.2 * 100, '.0%')) <enter> print(format(20, '.0%')) <enter>
print(format(0.2, '.0%')) <enter>
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? flowchart pseudocode algorithm source code
pseudocode
A variables in Python must begin with a letter or underscore and include only letters, numbers, and the underscore; no punctuation characters or spaces are allowed.
true
Comments in Python begin with the # character.
true
Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produced.
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 the addition (+) operator is used with two strings, it performs string concatenation.
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