Chapter 2 Flashcards
What is a variable?
Named memory locations whose contents can vary or differ over time.
What is a declaration in programming?
A statement that provides a data type and an identifier for a variable.
What is an identifier in programming?
A variable’s name.
Define a named constant.
Similar to a variable but can be assigned a value only once.
What are the standard arithmetic operators?
- Addition (+), * Subtraction (-), * Multiplication (*), * Division (/)
What is type-safety?
Prevents assigning values of an incorrect data type.
What does a hierarchy chart represent?
Shows the overall picture of how modules are related to one another.
What is modularization?
Breaking down a large program into modules.
What is the purpose of program comments?
Written explanations of programming statements, not part of the program logic.
What is the role of temporary variables?
Work variables used during a program’s execution to hold intermediate results.
What does the term ‘magic number’ refer to?
An unnamed constant.
What are the advantages of modularization?
- Easier task division among programmers, * Reusability of modules, * Reliability of tested modules.
Fill in the blank: A prompt is a message displayed on a monitor to ask the user for a _______.
response.
True or False: Global variables are declared at the program level.
True.
What does the assignment operator do?
Sets a variable to a value.
What is garbage in programming?
A variable’s unknown value.
What is the purpose of using clear prompts in a program?
To ask the user for input clearly.
What is the difference between global and local variables?
Global variables are usable in all modules, while local variables are usable only within the module.
What is the significance of using meaningful names for variables?
They are self-documenting and make the code easier to read.
What is the role of flowcharts in programming?
Visual representation of the program’s logic and structure.
Fill in the blank: A hierarchy chart is a _______ tool that helps in planning the overall relationship of program modules.
planning.
What is the order of operations also known as?
Rules of precedence.
What is a remainder operator?
Also called the modulo operator, it provides the remainder of a division operation.
What should be avoided when naming variables?
- Using digits, * Reserved keywords, * Abbreviations.