Deck 2: Input, Processing, and Output
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
Play
Full screen (f)
Deck 2: Input, Processing, and Output
1
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) eval_input()
D) str_input()
A) input()
B) output()
C) eval_input()
D) str_input()
A
2
In Python,math expressions are always evaluated from left to right,no matter what the operators are.
False
3
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'
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'
C
4
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) algorithm
C) source code
D) pseudocode
A) flowchart
B) algorithm
C) source code
D) pseudocode
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
Computer programs typically perform three steps: input is received,some process is performed on the input,and output is produced.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
Since a named constant is just a variable,it can change any time during a program's execution.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
Comments in Python begin with the # character.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
A(n)__________ is a diagram that graphically depicts the steps that take place in a program?
A) flowchart
B) algorithm
C) source code
D) pseudocode
A) flowchart
B) algorithm
C) source code
D) pseudocode
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
Which mathematical operator is used to raise 5 to the second power in Python?
A) /
B) **
C) ^
D) ~
A) /
B) **
C) ^
D) ~
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
Python allows programmers to break a statement into multiple lines.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
Python formats all floating-point numbers to two decimal places when outputting with the print statement.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
The \t escape character causes the output to skip over to the next horizontal tab.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
According to the behavior of integer division,when an integer is divided by an integer,the result will be a float.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
The line continuation character is a
A) #
B) %
C) &
D) \
A) #
B) %
C) &
D) \
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
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) end
C) separator
D) newLine
A) stop
B) end
C) separator
D) newLine
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
A flowchart is a tool used by programmers to design programs.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
After the execution of the following statement,the variable sold will reference the numeric literal value as (n)__________ data type.
Sold = 256.752
A) int
B) float
C) str
D) currency
Sold = 256.752
A) int
B) float
C) str
D) currency
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
After the execution of the following statement,the variable price will reference the value __________.
Price = int(68.549)
A) 68
B) 69
C) 68.55
D) 68.6
Price = int(68.549)
A) 68
B) 69
C) 68.55
D) 68.6
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
In Python,print statements written on separate lines do not necessarily output on separate lines.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
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.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
What symbol is used to mark the beginning and end of a string?
A) a slash (/)
B) an asterisk (*)
C) a quote mark (")
D) a comma (,)
A) a slash (/)
B) an asterisk (*)
C) a quote mark (")
D) a comma (,)
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
In the expression 12.45 + 3.6,the values to the right and left of the + symbol are the __________.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
A(n)__________ is a single task that the program must perform in order to satisfy the customer.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
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.
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.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
A(n)__________ character is a special character that is preceded with a backslash (\),appearing inside a string literal.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
A __________ is a name that represents a value the cannot be changed during a program's execution.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
Python uses __________ to categorize values in memory.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following will display 20%?
A) print(format(20, '.0%'))
B) print(format(0.2, '.0%'))
C) print(format(0.2 * 100, '.0%'))
D) print(format(0.2, '%'))
A) print(format(20, '.0%'))
B) print(format(0.2, '.0%'))
C) print(format(0.2 * 100, '.0%'))
D) print(format(0.2, '%'))
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
Select all that apply. Which of the following are steps in the program development cycle?
A) design the program
B) write the code and correct syntax errors
C) test the program
D) correct logic errors
A) design the program
B) write the code and correct syntax errors
C) test the program
D) correct logic errors
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
To use Python's turtle graphics,you must include which of the following statements in your program?
A) import turtle_module
B) import turtle_graphics
C) import turtle
D) import Turtle
A) import turtle_module
B) import turtle_graphics
C) import turtle
D) import Turtle
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
What is the output of the following command,given that value1 = 2.0 and value2 = 12?
Print(value1 * value2)
A) 24
B) value1 * value2
C) 24.0
D) 2.0 * 12
Print(value1 * value2)
A) 24
B) value1 * value2
C) 24.0
D) 2.0 * 12
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
A(n)__________ is a name that represents a value stored in the computer's memory.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
The __________ specifier is a special set of characters that specify how a value should be formatted.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
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?
A) It will be easier for another programmer who may need to use this code to understand the purpose of the number wherever it is used in the code.
B) If the tax amount changes to 7.0%, the value will only have to be changed in one place.
C) It allows the end-user to always see the value of the sales tax.
D) 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.
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?
A) It will be easier for another programmer who may need to use this code to understand the purpose of the number wherever it is used in the code.
B) If the tax amount changes to 7.0%, the value will only have to be changed in one place.
C) It allows the end-user to always see the value of the sales tax.
D) 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.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
___________ are notes of explanation that document lines or sections of a program.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
When applying the .3f formatting specifier to the number 76.15854,the result is __________.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
When the + operator is used with two strings,it performs string __________.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
The Python turtle is initially positioned in the __________ of a graphics window and it first appears,by default,to be heading __________.
A) center, up
B) top left corner, east
C) bottom left corner, down
D) center, east
A) center, up
B) top left corner, east
C) bottom left corner, down
D) center, east
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
The __________ built-in function is used to read a number that has been typed on the keyboard.
A) input()
B) read()
C) get()
D) keyboard()
A) input()
B) read()
C) get()
D) keyboard()
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
The % symbol is the remainder operator,also known as the ___________ operator.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck