Repitition Structures Flashcards

1
Q

What is a repetition structure? aka?

A

Repetition structure controls a statement or a group of statements to execute repeatedly. A.k.a loop

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

Cons of not using repetition structure?

A

long program
time consuming
hard to change

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

What are the two types of repetition structures?

A

condition controlled

count controlled

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

What is condition controlled?

A

uses true/false condition to loop for a specific amount of time

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

What is count controlled loop?

A

loops for a specific amount of times

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

Condition controlled used using?

A

while

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

Count controlled using what?

A

for

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

Syntax for while

A

while y<2:

statement

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

The while loop is what type of loop

A

pretest

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

Infinite loops

A

continues to repeat until the program is interrupted.

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

What is a sentinel?

A

A special value that marks the end of a sequence of values.

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

Why should you take care to choose a distinctive values as a sentinel?

A

So that it won’t be mistaken as a regular value in the sequence.

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

What is input validation?

A

It is the process of inspecting data that has been input to the program to make sure it is valid before it is used in the computation.

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

An input validation loop is also known as ?

A

error handler or error trap

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

What is priming read? What is its purpose?

A

the first input before loop.

to get the first input that will be tested by the validation loop

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

What is a nested loop?

A

A loop inside another loop

17
Q

iteration

A

Each repetition inside the loop