Chapter 2 Flashcards
List 5 phases of developing a program
design the code, write the code, correct syntax errors, test program, correct logic error
a logic error is…
A logic error is a mistake that does not prevent the program from running, but causes it to produce incorrect results.
the person, group or organization that is asking you to write a program.
customer
a single task that the program must perform in order to satisfy the customer.
software requirement
a set of well-defined logical steps that must be taken to perform a task.
algorithm
fake code; informal language that has no syntax rules and is not meant to be complied or executed.
pseudocode
any data the program receives while it is running.
input
a piece of prewritten code that performs an operation.
function
the data you want displayed on screen.
argument
a sequence of characters that is used as data.
string
a name that represents a value stored in the computer’s memory
variable
data types
int (integer)
float(decimal)
str:
string
int:
integer
number with decimal
float
A(n) __________ makes a variable reference a value in the computer’s memory.
assignment statement
comment in python
#
integer division
//
raises number to a power
**
In the expression 12 + 7, the values on the right and left of the + symbol are called
operands because the symbol is the operator
This operator performs division, but instead of returning the quotient it returns the remainder
%
- A magic number is ________________.
an unexplained value that appears in a program’s code
A _ is a name that represents a value that does not change during the program’s execution.
variable signature
Programmers must be careful not to make syntax errors when writing pseudocode programs true/false
false
In a math expression, multiplication and division take place before addition and subtraction.
Order of operations tells you to perform multiplication and division first, working from left to right, before doing addition and subtraction.
Variable names can have spaces in them.
false
In Python, the first character of a variable name cannot be a number true/false
true
If you print a variable that has not been assigned a value, the number 0 will be displayed
false
According to the behavior of integer division, when an integer is divided by an integer, the result will be a float.
false
n Python, math expressions are always evaluated from left to right, no matter what the operators are. true/false
false
Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produced.
true
In Python, print statements written on separate lines do not necessarily output on separate lines.
true
All programs are normally stored in ROM and are loaded into RAM as needed for processing.
false
The CPU understands instructions written in a binary machine language.
true
The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level language.
false
IDLE is an alternative method to using a text editor to write, execute, and test a Python program.
true
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()
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, ‘%’))
print(format(0.2, ‘.0%’))
Where does a computer store a program and the data that the program is working with while the program is running?
main memory
When applying the .3f formatting specifier to the number 76.15854, what will be the result?
76.159
Python uses __________ to categorize values in memory
data types
num = 99
num = 5 print (‘num’)
5