CISP Ch. 2
The newline escape character is ________.
'\n'
What will be displayed by the following program? my_value = 99 my_value = 0 print(my_value)
0(reassigned)
What will the statement print(format(65.4321, '.2f')) display?
65.43
What will the statement print(format(987654.129, ',.2f')) display?
987,654.13
Which Python statement best defines a named constant for a 10 percent discount? PERCENTAGE = 10% discount percent = 10 DISCOUNT_PERCENTAGE = 0.1 dp = 0.100
DISCOUNT_PERCENTAGE = 0.1
Comments are intended for any person reading a program's code, not the computer.(T/F)
True
Named constants help to prevent the typographical errors that are common when using magic numbers.(t/f)
True
Named constants make programs more self-explanatory.(t/f)
True
A set of well-defined logical steps that must be taken to perform a task is called a(n) _________.
algorithm
What will the following code display? val = 99 print('The value is', 'val') a.The value is '99' b.The value is 99 c.The value is 'val' d.The value is val
d (val is typed out as a string since it has quotes)
If you do not want the print function to start a new line of output when it finishes displaying its output, you can pass the special argument ________ to the function.
end = ' '
The results of a(n) ________ are sent out of a program as output.
executing process
Named constants make widespread changes more difficult to make in a program.(t/f)
false
The following assignment statement is valid: 72 = amount (T/f)
false (has to be formatted variable=expression)
The variable name 'Sales' is considered to be the same as 'sales' in Python. (T/F)
false (naming variables is case sensitive)
After the statements below execute, what is the Python data type of the values referenced by each variable? value1 = 45.9 value2 = 7.0
float
A diagram that graphically depicts the steps that take place in a program is called a _______________.
flowchart
Given two already defined variables, i and j, write a statement that swaps their associated values.
i,j = j,i (does it at the same time)
After the statements below execute, what is the Python data type of the values referenced by each variable? value1 = 99 value2 = 7
int
In a flowchart, _________ are terminal symbols.
ovals
In a flowchart, _________ are either output or input.
parallelogrmas
Any person, group, or organization that is asking you to write a program is known as a _________.
programmer's customer
What is an informal language that is used to create "mock-ups" of programs?
pseudocode
What is an illegal variable name in Python? theSalesFigureForFiscalYear r&d july_2019 x
r&d (variable names can only use letters, digits, or underscores)
In a flowchart, _________ are processing symbols.
rectangles
You can change the character that is automatically displayed between multiple items that are passed to the print function by passing the ________ argument with the desired character.
sep=
A single function that the program must perform in order to satisfy a customer is known as a _____________.
software requirement
After the statements below execute, what is the Python data type of the value referenced by the variable? value1 = 'abc'
str
truncating
throwing away the number's fractional part
The + operator, when used with two strings, joins them together as one string.(t/f)
true
To fill a turtle shape with a color, use the ________ command before drawing the shape, then use the ________ command after the shape is drawn.
turtle.begin_fill() ; turtle.end_fill()
Which command will move a turtle forward?
turtle.forward
What command would you use to display a turtle's current heading?
turtle.heading()
To move a turtle to a new location without drawing a line, first use the _________ command to raise the turtle's pen.
turtle.penup()
What command would you use to display the coordinates of the turtle's current position?
turtle.pos()
Which command will turn a turtle right by 45 degrees?
turtle.right(45)
Which of the following commands will make the animation speed faster?
turtle.speed(10)
What command would you use to display text in the turtle's graphics window?
turtle.write()
What component of a program references a value in the computer's memory?
variable
Any data that the program receives while it is running is known as _________.
Input