CISC 106 – Flashcards
Unlock all answers in this set
Unlock answersquestion
What is a group of statements that exists within a program for the purpose of performing a specific task?
answer
function
question
The first line in the function definition is known as the function
answer
header
question
The ________ design technique can be used to break down an algorithm into functions.
answer
top-down
question
A set of statements that belong together as a group and contribute to the function definition is known as a(n) ________.
answer
block
question
A(n) ________ variable is created inside a function.
answer
local
question
The ________ of a local variable is the function in which the variable is created.
answer
scope
question
A(n) ________ is any piece of data that is passed into a function when the function is called
answer
argument
question
A(n) ________ is a variable that receives an argument that is passed into a function.
answer
parameter
question
A ________ variable is accessible to all the functions in a program file.
answer
global
question
A ________ constant is a global name that references a value that cannot be changed.
answer
global
question
When a function is called by its name, then it is ________.
answer
executed
question
It is recommended that programmers should avoid using ________ variables in a program when possible.
answer
global
question
A variable's ________ is the part of a program in which the variable may be accessed.
answer
scope
question
The Python library functions that are built into the Python ________ can be used by simply calling the function.
answer
interpreter
question
Python comes with ________ functions that have been already prewritten for the programmer.
answer
standard
question
Which of the following statements causes the interpreter to load the contents of the random module into memory?
answer
import.random
question
Which of the following will assign a random number in the range of 1 through 50 to the variable number?
answer
A.number = random.randint(1, 50)
question
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.
answer
return
question
What type of function can be used to determine whether a number is even or odd?
answer
boolean
question
The Python standard library's ________ module contains numerous functions that can be used in mathematical calculations.
answer
math
question
What makes it easier to reuse the same code in more than one program?
answer
modules
question
In a menu-driven program, what statement is used to determine and carry out the user's desired action?
answer
if-elif-else
question
A value-returning function is ________.
answer
.a function that will return a value back to the part of the program that called it
question
True/False: Python function names follow the same rules for naming variables.
answer
true
question
True/False: The function header marks the beginning of the function definition.
answer
true
question
True/False: A function definition specifies what a function does and causes the function to execute.
answer
false
question
True/False: A local variable can be accessed from anywhere in the program.
answer
false
question
True/False: Different functions can have local variables with the same names.
answer
true
question
True/False: Python allows for passing multiple arguments to a function.
answer
true
question
True/False: One of the reasons not to use global variables is that it makes a program hard to debug.
answer
true
question
True/False: A value-returning function is like a simple function except that when it finishes it returns a value back to the called part of the program.
answer
true
question
True/False: Boolean functions are useful for simplifying complex conditions that are tested in decision and repetition structures.
answer
true
question
True/False: Unlike other languages, in Python, the number of values a function can return is limited to one.
answer
false
question
Functions in the standard library are stored in files that are known as ______________
answer
modules
question
A value-returning function has a(n)_________ statement that returns a value back to the part of the program that called it.
answer
return
question
A(n) _________ program displays a list of the operations on the screen and allows the user to select the operation that the program should perform.
answer
menu-driven
question
The approach of ___________makes the program easier to understand, test, and maintain.
answer
modularization
question
What type of error produces incorrect results but does not prevent the program from running?
answer
logic
question
What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed?
answer
pseudocode
question
A(n) ________ is a diagram that graphically depicts the steps that take place in a program.
answer
flowchart
question
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.
answer
input
question
The line continuation character is a(n) ________.
answer
/
question
Which mathematical operator is used to raise five to the second power in Python?
answer
**
question
After the execution of the following statement, the variable sold will reference the numeric literal value as a(n) ________ data type:sold = 256.752
answer
float
question
The ________ built-in function is used to read a number that has been typed on the keyboard.
answer
input()
question
What symbol is used to mark the beginning and end of a string?
answer
quotation
question
True/False: Comments in Python begin with the # character.
answer
true
question
True/False: Python allows programmers to break a statement into multiple lines.
answer
true
question
True/False: Python formats all floating-point numbers to two decimal places when outputting using the print statement.
answer
false
question
True/False: A flowchart is a tool that programmers use to design programs.
answer
true
question
True/False: Computer programs typically perform three steps: Input is received, some process is performed on the input, and output is produced.
answer
true
question
True/False: In Python, print statements written on separate lines do not necessarily output on separate lines.
answer
true
question
True/False: The t escape character causes the output to skip over to the next horizontal tab.
answer
true
question
_________ are notes of explanation that document lines or sections of a program.
answer
comments
question
The % symbol is the remainder operator and it is also known as the _________ operator.
answer
modulus
question
A(n) __________ is a name that represents a value stored in the computer's memory.
answer
variable
question
When the + operator is used with two strings, it performs string __________
answer
concatenation
question
What is the disadvantage of coding in one long sequence structure?
answer
If parts of the duplicated code have to be corrected, the correction has to be made many times.
question
What type of loop structure repeats the code a specific number of times?
answer
count-controlled loop
question
What type of loop structure repeats the code based on the value of the Boolean expression?
answer
condition-controlled loop
question
What is the format for the while clause in Python?
answer
while condition:
question
for num in range (2, 9, 2)
answer
2, 4, 6, 8
question
for num in range (4)
answer
0,1,2,3
question
The variable used to keep the running total is called a(n) ________.
answer
accumulator
question
________ is the process of inspecting data that has been input to a program to make sure it
is valid before it is used in a computation.
answer
input validation
question
What is the structure that causes a statement or a set of statements to execute repeatedly?
answer
repetition
question
When will the following loop terminate? while keep_on_going != 999:
answer
when keep_on_going refers to a value qual to 999
question
In Python, a comma-separated sequence of data items that are enclosed in a set of brackets
is called a ________.
answer
list
question
Which of the following represents an example to calculate the sum of the numbers
(accumulator)?
answer
total += number
question
The while loop is known as a(n) ____ loop because it tests conditions before performing an
iteration
answer
pretest
question
A(n) ____ loop usually occurs when the programmer forgets to write code inside the loop that
makes the test condition false.
answer
infinite
question
In Python, you would use the ________ statement to write a count-controlled loop.
answer
for
question
A(n) ____ total is a sum of numbers that accumulates with each iteration of a loop.
answer
running
question
A(n) ____ is a special value that marks the end of a sequence of items.
answer
sentinel
question
A(n) ____ validation loop is sometimes called an error trap or an error handler
answer
input
question
The ____ function is a built-in function that generates a list of integer values.
answer
range
question
6. A=[True], B=['True']
A==B
results in True
answer
False
question
Once generated, a list cannot be grown
answer
False
question
Once generated, a string is mutable
answer
False