CIS - 202 - Python ch2 - ch5
What symbol is used to mark the beginning and end of a string?
' ' or " " quotations
Which mathematical operator is used to raise 5 to the second power in Python?
**
What are the values that the variable num contains through the iterations of the following for loop?for num in range(4):
0, 1, 2, 3
What are the values that the variable num contains through the iterations of the following for loop?for num in range(2, 9, 2):
2, 4, 6, 8
Which of the following are illegal variable names in Python, and why? 99bottles july2009 theSalesFigureForFiscalYear r&d grade_report
99bottles is illegal because it begins with a number. r&d is illegal because the & character is not allowed.
In Python the __________ symbol is used as the equality operator.
==
What type of loop structure repeats the code based on the value of Boolean expression?
Condition-controlled loop
__________ is the process of inspecting data that has been input into a program in order to ensure that the data is valid before it is used in a computation.
Input validation
What do each of the following symbols mean in a flowchart? Oval, Parallelogram, and Rectangle
Ovals are terminal symbols. Parallelograms are either output or input symbols. Rectangles are processing symbols.
A Boolean variable can reference one of two values which are
True or False
A value-returning function is
a function that returns a value back to the part of the program that called it
A variable used to keep a running total is called a(n)
accumulator
A(n) __________ is any piece of data that is passed into a function when the function is called.
an argument
When using the __________ logical operator, both subexpressions must be true for the compound expression to be true.
and
Which logical operators perform short-circuit evaluation?
and, or
A set of statements that belong together as a group and contribute to the function definition is known as a
block
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 structure
The decision structure that has two possible paths of execution is known as
dual/double alternative
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.
end
Which of the following functions returns the largest integer that is less than or equal to its argument?
floor
A(n) __________ is a diagram that graphically depicts the steps that take place in a program?
flowchart
What type of loop structure repeats the code a specific number of times?
for loop
The line continuation character is a
forward slash /
A __________ constant is a name that references a value that cannot be changed while the program runs.
global
It is recommended that programmers avoid using __________ variables in a program whenever possible.
global
A __________ variable is accessible to all the functions in a program file.
global variable
The first line in a function definition is known as the function
header
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 and y <= 50
Which of the following statements causes the interpreter to load the contents of the random module into memory?
import random
The __________ built-in function is used to read a number that has been typed on the keyboard.
input
In Python the __________ symbol is used as the not-equal-to operator.
!=
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
In the following statement, what is the purpose of the > character in the format specifier? print(f'{number:>12d}')
is an alignment specifier. It specifies that the value should be right aligned.
In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called
list
A __________ variable is created inside a function.
local variable
The Python standard library's __________ module contains numerous functions that can be used in mathematical calculations.
math
When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.
or
A(n) __________ is a variable that receives an argument that is passed into a function.
parameter
The _____________ keyword is ignored by the Python interpreter and can be used as a placeholder for code that will be written later.
pass
The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.
priming read
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) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.
repetition structure
In a value-returning function, the value of the expression that follows the keyword __________ will be sent back to the part of the program that called the function.
return
The __________ of a local variable is the function in which that variable is created.
scope
In Python, the variable in the for clause is referred to as the __________ because it is the target of an assignment at the beginning of each loop iteration.
target variable
Which of the following represents an example to calculate the sum of numbers (that is, an accumulator), given that the number is stored in the variable number and the total is stored in the variable total?
total += number
After these statements execute, what is the Python data type of the values referenced by each variable? value3 = 7.0 value4 = 7 value5 = 'abc'
value3 will reference a float. value4 will reference an int. value5 will reference an str (string).
When will the following loop terminate? while keep_going != 999:
when keep_going refers to a value not equal to 999
What does the following expression mean?x <= y
x is less than or equal to y