Chapter 3 Flashcards

1
Q

What is spaghetti code?

A

Logically snarled program statements that are often complicated, difficult to read, and maintain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three basic structures in programming?

A
  • Sequence structure
  • Selection structure
  • Loop structure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does a sequence structure do?

A

Performs actions or tasks in order without branching or skipping any task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a selection structure?

A

Also known as decision structure, it asks a question and takes one of two actions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False: A selection structure can only have one alternative.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a dual-alternative if structure?

A

Contains two alternatives using an if-then-else structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a single-alternative if structure?

A

An if structure that does not require an else clause, leading to a null case.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of a loop structure?

A

Repeats actions while a condition remains true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is another term for the loop body?

A

Repetition or iteration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the most common form of loop?

A

The while…do or while loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In a loop structure, how is the condition tested?

A

The condition is tested first.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is stacking structures?

A

Attaching structures end-to-end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the end-structure statement indicate?

A

The end of a structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is nesting structures?

A

Placing one structure within another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a block in programming?

A

A group of statements that execute as a single unit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the characteristics of structured programs?

A
  • 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
17
Q

What is a priming input?

A

Reads the first input data record and is outside the loop that reads the rest of the records.

18
Q

What is the purpose of a priming input in structuring a program?

A

Helps keep the program structured.

19
Q

What are the reasons for using structure in programming?

A
  • Clarity
  • Professionalism
  • Efficiency
  • Maintenance
  • Modularity
20
Q

Fill in the blank: A structured program is easier for _______ to read.

A

other programmers