Programming 1 Chapter 2 Study guide
After the execution of the following statement, the variable price will reference the value ________. price = int(68.549) A.68 B.68.6 C.68.55 D.69
A.68
What symbol is used to mark the beginning and end of a string? A.a quote mark (") B.a slash (/) C.a comma (,) D.an asterisk (*)
A.a quote mark (")
The ________ built-in function is used to read a number that has been typed on the keyboard. A.input() B.keyboard() C.read() D.get()
A.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. A.input() B.output() C.str_input() D.eval_input()
A.input()
What is the output of the following print statement?print('The path is D:\\sample\\test.') A.The path is D:\\sample\\test. B.The path is D:\sample\test. C.'The path is D:\\sample\\test.' D.The path is D\\sample\\test.
B.The path is D:\sample\test.
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? A.flowchart B.pseudocode C.algorithm D.source code
B.pseudocode
What is the output of the following command, given that value1 = 2.0 and value2 = 12?print(value1 * value2) A.2.0 * 12 B.value1 * value2 C.24.0 D.24
C.24.0
The line continuation character is A.% B.# C.\ D.&
C.\
A(n) ________ is a diagram that graphically depicts the steps that take place in a program? A.algorithm B.source code C.flowchart D.pseudocode
C.flowchart
Which of the following will display 20%? A.print(format(0.2, '%')) <enter> B.print(format(0.2 * 100, '.0%')) <enter> C.print(format(0.2, '.0%')) <enter> D.print(format(20, '.0%')) <enter>
C.print(format(0.2, '.0%')) <enter>
Which mathematical operator is used to raise 5 to the second power in Python? A.^ B.~ C./ D.**
D.**
What is the output of the following print statement? print 'I\'m ready to begin' A.Im ready to begin B.I\'m ready to begin C.'I\'m ready to begin' D.I'm ready to begin
D.I'm ready to begin
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. A.stop B.newLine C.separator D.end
D.end
After the execution of the following statement, the variable sold will reference the numeric literal value as (n) ________ data type.sold = 256.752 A.str B.currency C.int D.float
D.float
According to the behavior of integer division, when an integer is divided by an integer, the result will be a float. True or False
False
In Python, math expressions are always evaluated from left to right, no matter what the operators are. True or False
False
Python formats all floating-point numbers to two decimal places when outputting with the print statement. True or False
False
Since a named constant is just a variable, it can change any time during a program's execution. True or False
False
A flowchart is a tool used by programmers to design programs. True or False
True
Comments in Python begin with the # character. True or False
True
Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produced. True or False
True
In Python, print statements written on separate lines do not necessarily output on separate lines. True or False
True
Python allows programmers to break a statement into multiple lines. True or False
True
The \t escape character causes the output to skip over to the next horizontal tab. True or False
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 or False
True