Programming Test 1
In Python the ________ symbol is used as the not-equal-to operator.
!=
Which mathematical operator is used to raise to the second power
**
Which of the following are steps in the program development cycle?
1. Design the program 2.Write the code and correct syntax errors 3. test the program 4. correct logic errors
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
When applying the .3f formatting specifier to the number 76.15854, the result is ________.
76.159
In Python the ________ symbol is used as the equality operator.
==
________ are notes of explanation that document lines or sections of a program.
Comments
Multiple Boolean expressions can be combined by using a logical operator to create ________ expressions.
Compound
A(n) ________ structure is a logical design that controls the order in which a set of statements execute.
Control
In flowcharting, the ________ symbol is used to represent a Boolean expression.
Diamond
The decision structure that has two possible paths of execution is known as
Dual Alternative
A(n) ________ character is a special character that is preceded with a backslash (\), appearing inside a string literal
Escape
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
Python allows you to compare strings, but it is not case sensitive.
False
Python formats all floating-point numbers to two decimal places when outputting with the print statement
False
Short -circuit evaluation is only performed with the not operator.
False
Since a named constant is just a variable, it can change anytime during a programs execution
False
The not operator is a unary operator which must be used in a compound expression.
False
What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y and z > x
False
What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8? not (x < y or z > x) and y < z
False
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 ________ is a diagram that graphically depicts the steps that take place in a program
Flowchart
The ________ specifier is a special set of characters that specify how a value should be formatted. (Hint: formatting)
Formatting
What is the output of the following print statement? (Hint: p. 67) print 'I\'m ready to begin'
I'm ready to begin
A(n) ________ is a single task that the program must perform in order to satisfy the customer
Software requirement
What is the output of the following print statement? (Hint: p. 67) print('The path is D:\\sample\\test.')
The path is D:\\sample\\test.
A flowchart is a tool used by programmers to design programs
True
An action in a single alternative decision structure is performed only when the condition is true.
True
Comments in Python begin with the # character.
True
Computer programs typically perform three steps: input is recieved, some process is performed on the input, and output is produced
True
Decision structures are also known as selection structures.
True
Expressions that are tested by the if statement are called Boolean expressions.
True
In python, print statements written on seperate lines do not necessarily output on separate lines.
True
Nested decision statements are one way to test more than one condition.
True
Python allows programmers to break a statement into multiple lines
True
Python uses the same symbols for the assignment operator as for the equality operator.
True
The Python language is not sensitive to block structuring of code.
True
The if statement causes one or more statements to execute only when a Boolean expression is true.
True
What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y or z > x
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
the /t escape character causes the output to skip over the horizontal tab
True
A Boolean variable can reference one of two values which are
True or False
What symbol is used to mark the beginning and end of a string
a quote mark (")
When using the ________ logical operator, both subexpressions must be true for the compound expression to be true.
and
When using the ________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.
and
A(n) ________ expression is made up of two or more Boolean expressions.
compound
When the + operator is used with two strings, it performs string ________.
concatenation
In a decision structure, the action is ________ executed because it is performed only when a specific condition is true.
conditionally
Python uses ________ to categorize values in memory.
data types
In a pring statement, you can set the ______ argument to a space or empty string to stop the output from advancing to a new line
end
Boolean variables are commonly used as ________ to indicate whether a specific condition exists.
flags
The line continuation character is a
forward slash
The ________ statement is used to create a decision structure.
if
Which of the following is the correct if clause to determine whether choice is anything other than 10?
if choice !=10:
Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?
if y >= 10 or y <= 50:
Python provides a special version of a decision structure known as the ________ statement, which makes the logic of the nested decision structure simpler to write.
if-elif-else
A(n) ________ statement will execute one block of statements if its condition is true or another block if its condition is false.
if-else
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()
The ________ built-in function is used to read a number that has been typed on the keyboard.
input()
The % symbol is the remainder operator, also known as the ________ operator.
modulus, mod
A __________ is a name that represents a value that cannot be changed during a programs execution
named constant
The logical ________ operator reverses the truth of a Boolean expression.
not
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) ________ operator determines whether a specific relationship exists between two values.
relational
A(n) ________ decision structure provides only one alternative path of execution.
single alternative
A(n) ________ is a name that represents a value stored in the computer's memory.
variable
What does the following expression mean? x <= y
x is less than or equal to y