Branching/Looping Flashcards

1
Q

Branch

A

Program path taken if an expression’s value is true

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

Nested if-else

A

If-else statement as a branch within another if-else statement

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

Boolean

A

True or False

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

Operator Chaining

A

Evaluates chain of operators left to right until false

a < b < c If a is less then b check if b is less than c

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

Code Block

A

Series of statements that are grouped together defined by indentation level

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

Loop

A

Loop statements (loop body) repeatedly executed while loop’s expression is true. Each execution is an iteration.

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

While Loop

A

Repeatedly executes while loop expression is true. At the end of the loop the expression is evaluated again.
Use when iterations not known before entering

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

Sentinel Value

A

Value when evaluated by loop expression causes the loop to terminate

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

Infinite Loop

A

Will always execute because expression is always true. Often caused by assuming equality will be reached.

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

Loop Variable

A

Counts the number of iterations

i = 1 while i <= N: loop body i = i + 1

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

For Loop

A

Performs some action during each iteration
Use when iterations known before entering loop
Use when accessing elements of a container

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

Break Statement

A

Causes an immediate exit from loop

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

Continue Statement

A

Causes immediate jump to loop header statement

Good way to add conditions to for loops

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

Loop Else

A

Else statement executes if loop terminates without using break statement

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