Chapter 2 Input, Processing, and Output Flashcards
A ___ error does not prevent the program from running, but causes it to produce incorrect results.
a. syntax
b. hardware
c. logic
d. fatal
logic
Chapter 2 (page 32)
A logic error is a mistake that does not prevent the program from running, but causes it to produce incorrect results. (Mathematical mistakes are common causes of logic errors.)
A ___ is a single function that the program must perform in order to satisfy the customer.
a. task
b. software requirement
c. prerequisite
d. predicate
software requirement
Chapter 2 (page 33)
A software requirement is simply a single task that the programmer must perform in order to satisfy the customer. Once the customer agrees that the list of requirements is complete, the programmer can move to the next phase.
A(n) ___ is a set of well-defined logical steps that must be taken to perform a task.
a. logarithm
b. plan of action
c. logic schedule
d. algorithm
algorithm
Chapter 2 (page 33)
An algorithm is a set of well-defined logical steps that must be taken to perform a task. Steps in algorithm are sequentially ordered, step 1 should be performed before step 2, and so on.
An informal language that has no syntax rules and is not meant to be compiled or executed is called ___.
a. faux code
b. pseudocode
c. Python
d. a flowchart
pseudocode
Chapter 2 (page 34)
Word “pseudo” means fake, so pseudocode is fake code. It is an informal language that has no syntax rules and is not meant to be compiled or executed. Programmers use pseudocode to create models, or “mock-ups” of programs.
A ___ is a diagram that graphically depicts the steps that take place in a program.
a. flowchart
b. step chart
c. code graph
d. program graph
flowchart
Chapter 2 (page 34)
A flowchart is a diagram that graphically depicts the steps that take place in a program.
A ___ is a sequence of characters.
a. char sequence
b. character collection
c. string
d. text block
string
Chapter 2 (page 37)
In programming terms, a sequence of characters that is used as data is called string. When a string appears in the actual code of a program, it is called a string literal. In Python code, string literals must be enclosed in quote marks.
A ___ is a name that references a value in the computer’s memory.
A. variable
b. register
c. RAM slot
d. byte
variable
Chapter 2 (page 40)
A variable is a name that represents a value in the computer’s memory. For example, a program that calculates the sales tax on a purchase might use the variable name ‘tax’ to represent that value in memory.
When a variable represents a value in the computer’s memory, we say that the variable ‘references’ the value.
A ___ is any hypothetical person using a program and providing input for it.
a. designer
b. user
c. guinea pig
d. test subject
Chapter 2 (page )
A string literal in Python must be enclosed in ___.
a. parentheses
b. single-quotes
c. double-quotes
d. either single-quotes or double-quotes
either single quotes or double quotes
Chapter 2 (page 37)
In Python, you can enclose string literals in a set of single-quote marks ( ‘ ) or a set of double-quote marks ( “ )
Short notes placed in different parts of a program explaining how those parts of the program work are called ___.
a. comments
b. reference manuals
c. tutorials
d. external documentation
comments
Chapter 2 (page 39)
Comments are short notes placed in different parts of a program, explaining how those parts of the program work. Although comments are a critical part of a program, they are ignored by the Python interpreter. Comments are intended for any person reading a program’s code, not the computer.
A(n) ___ makes a variable reference a value in the computer’s memory.
a. variable declaration
b. assignment statement
c. math expression
d. string literal
assignment statement
Chapter 2 (page 40)
You use an assignment statement to create a variable and make it reference a piece of data. Here is an example of an assignment statement:
age = 25
An assignment statement is written in the following general format:
variable = expression
This symbol marks the beginning of a comment in Python.
a. &
b. *
c. **
d. #
#
Chapter 2 (page 39)
In Python, you begin a comment with the # character. When the Python interpreter sees a # character, it ignores everything from that character to the end of the line.
Which of the following statements will cause an error?
a. x = 17
b. 17 = x
c. x = 99999
d. x = ‘ 17 ‘
17 = x
Chapter 2 (page 42)
In an assignment statement, the variable that is receiving the assignment must appear on the left side of the operator. An error occurs if the item on the left side of the = operator is not a variable
In the expression 12 + 7, the values on the right and left of the + symbol are called ___.
a. operands
b. operators
c. arguments
d. math expressions
Chapter 2 (page)
This operator performs integer division.
a. / /
b. %
c. **
d. /
/ /
Chapter 2 (page 54)
/ / Integer Division
Divides one number by another and gives the result as a whole number.
5 // 2 = 2
/ Division
Divides one number by another and gives the result as a floating-point number.
5 / 2 = 2.5
This is an operator that raises a number to a power.
a. %
b. *
c. **
d. /
- *
Chapter 2 (page 54)
** Exponent
Raises a number to a power.
This operator performs division, but instead of returning the quotient it returns the remainder.
a. %
b. *
c. **
d. /
%
Chapter 2 (page 54)
% Remainder
Divides one number by another and gives the remainder.