Chapter 2:Working with Data, Creating Modules, and Designing
High-Quality Programs
TRUE/FALSE
1. At any moment in time, a variable
can hold more than one value.
2. The ability of variables to change
in value is what makes computers and programming worthwhile.
3. In many programming languages, if
you declare a variable and do not initialize it, the variable contains an
unknown value until it is assigned a value.
4. Programmers generally write programs
as one long series of steps.
5. Most modern programming languages
require that program statements be placed in specific columns.
MULTIPLE CHOICE
1. When you write programs, you work
with data in three different forms: ____.
a. values;
variables, or named values; and unnamed values
b. variables;
named constants; and named memory
c. variables;
literals, or unnamed constants; and named constants
d. variations;
transliterals, or unnamed constants; and named values
2. In most programming languages,
before you can use any variable, you must include a ____ for it.
a. declaration c. header
b. definition d. proclamation
3. The process of naming program
variables and assigning a type to them is called ____ variables.
a. initializing c. identifying
b. declaring d. Proclaiming
4. A variable’s unknown value is
commonly called ____.
a. initial c. deterministically
random
b. default d. garbage
5. You can also refer to a variable
name as a ____.
a. mnemonic c. cue
b. pneumonic d. prompt
6. When the variable starts with a
lowercase letter and any subsequent word begins with an uppercase letter, this
is called ____.
a. Hungarian
notation c. camel casing
b. Pascal d. Turing
notation
7. When the first letter of a variable
name is uppercase, as in HourlyWage, the format is known as ____ casing.
a. Hungarian
notation c. camel casing
b. Pascal d. Turing
notation
8. A specific numeric value is often
called a ____.
a. named
constant c. arithmetic constant
b. defined
constant d. numeric constant
9. Fractional numeric variables that
contain a decimal point are known as ____ variables.
a. partial c. integer
b. string d. floating-point
10. A(n) ____ is similar to a variable,
except it can be assigned a value only once.
a. unnamed
constant c. named constant
b. literal d. constant
11. The ____ dictate the order in which
operations in the same statement are carried out.
a. rules of
precedence c. operation rules
b. statement
rules d. rules of arithmetic
12. The process of breaking down a large
program into modules is called ____.
a. decomposition c. unification
b. modularization d. orientation
13. ____ is the process of paying
attention to important properties while ignoring nonessential details.
a. Abstraction c. Abbreviation
b. Modularization d. Decomposition
14. Programmers say the statements that
are contained in a module have been ____.
a. embedded c. encapsulated
b. decomposed d. modularized
15. Programmers say that variables and
constants declared within a module are ____ only within that module.
a. abstracted c. in
scope
b. out of
scope d. in reference
16. ____ variables and constants are known
to the entire program.
a. Local c. Heap
b. Transient d. Global
17. When a program has several modules
calling other modules, programmers often use a program ____, which operates
similarly to an organizational chart, to show the overall picture of how
modules are related to one another.
a. hierarchy
chart c. flow
chart
b. tree
chart d. data diagram
18. An ____ is most often represented by a
three-sided box that is connected to the step it references by a dashed line.
a. abstraction
symbol c. abbreviation symbol
b. annotation
symbol d. enumeration symbol
19. Programmers refer to programs that
contain meaningful names as ____.
a. undocumented c. formally documented
b. procedurally
documented d. self-documenting
20. ____ is where a variable’s data type
or other information is stored as part of the name.
a. Hungarian
notation c. Turing notation
b. Pascal
notation d. Camel case
21. A ____ variable is not used for input
or output, but instead is just a working variable that you use during a
program’s execution.
a. programming c. temporary
b. throw
away d. calculating
COMPLETION
1. Declaring a starting value is known
as ____________________ the variable.
2. Each programming language has a few
reserved ____________________ that are not allowed as variable names because
they are part of the language’s syntax.
3. Whole number numeric variables are
known as ____________________ numeric variables.
4. ___________________ tasks include
any steps you must perform at the beginning of a program to get ready for the
rest of the program.
5. Program ___________________ are
written explanations that are not part of the program logic but that serve as
documentation for readers of the program.
MATCHING
Match each item with a statement below.
a. Reliability f. Prompt
b. Declaration g. Variables
c. Echoing
input h. Data dictionary
d. String
variable i. Numeric variable
e. Identifier
1. Named memory locations whose
contents can vary or differ over time
2. A statement that provides a data
type and an identifier for a variable
3. A variable’s name
4. Can hold digits and have
mathematical operations performed on it
5. Can hold text, such as letters of
the alphabet, and other special characters, such as punctuation marks
6. The feature of programs that assures
you a module has been tested and proven to function correctly
7. A list of every variable name used
in a program, along with its type, size, and description
8. A message that is displayed on a
monitor to ask the user for a response and perhaps explain how that response
should be formatted
9. The act of repeating input back to a
user either in a subsequent prompt or in output
SHORT ANSWER
1. What does an item’s data type
describe?
2. List three reasons for modularizing
a large program.
3. What items should you include when
you create a module?
4. Explain the purpose of detail loop
tasks.
5. What are end-of-job tasks?
6. List three design features that you
can use while creating programs to make them easier to write and maintain.
7. Explain the purpose of annotation
symbols.
8. Discuss why it is important to use
meaningful names for identifiers.
9. Explain the purpose of temporary
variables.
10. Discuss why it is important to
maintain good programming habits.





