Chapter 3 Flashcards
What is spaghetti code?
Logically snarled program statements that are often complicated, difficult to read, and maintain.
What are the three basic structures in programming?
- Sequence structure
- Selection structure
- Loop structure
What does a sequence structure do?
Performs actions or tasks in order without branching or skipping any task.
What is a selection structure?
Also known as decision structure, it asks a question and takes one of two actions.
True or False: A selection structure can only have one alternative.
False
What is a dual-alternative if structure?
Contains two alternatives using an if-then-else structure.
What is a single-alternative if structure?
An if structure that does not require an else clause, leading to a null case.
What is the purpose of a loop structure?
Repeats actions while a condition remains true.
What is another term for the loop body?
Repetition or iteration.
What is the most common form of loop?
The while…do or while loop.
In a loop structure, how is the condition tested?
The condition is tested first.
What is stacking structures?
Attaching structures end-to-end.
What does the end-structure statement indicate?
The end of a structure.
What is nesting structures?
Placing one structure within another.
What is a block in programming?
A group of statements that execute as a single unit.
What are the characteristics of structured programs?
- Include only combinations of the three basic structures
- Each structure has a single entry point and a single exit point
- Structures can only be stacked or connected at their entry or exit points
- Any structure can be nested within another structure
What is a priming input?
Reads the first input data record and is outside the loop that reads the rest of the records.
What is the purpose of a priming input in structuring a program?
Helps keep the program structured.
What are the reasons for using structure in programming?
- Clarity
- Professionalism
- Efficiency
- Maintenance
- Modularity
Fill in the blank: A structured program is easier for _______ to read.
other programmers