Branches Flashcards

1
Q

What is a branch?

A

A sequence of statements only executed under certain circumstance.

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

What creates two branches?

A

A decision

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

What symbol is used for decisions?

A

Diamonds

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

What is a if-elseif branch?

A

A branch that contains a decision and branch

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

What is it called when a branch itself contains a decision and branches?

A

If-elseif branches

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

What is the difference between if-elseif branches and multiple-if-branches?

A

In if-elseif branches each only one branch can execute
With multiple-if-branches each decision is independent, thus more than one branch can execute

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

What is the difference between a branch and a decision?

A

A branch is a sequence of statements only executed under a certain condition

A decision creates two branches (decisions are diamonds), branches flow from decisions

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

Which operator check whether two operands’ values are different?

A

!=

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

What does a relational operator do?

A

Checks how one operand’s value relates to another.

Like being greater than, or less than.

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

Logical operators include?

A

And, or, not

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

Describe the logical operator (a) and (b).

A

Logical AND: true when both operands are true

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

Describe the logical operator (a) or (b).

A

Logical OR: true when at least one of the two operands is true

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

Describe the logical operator not(a).

A

Logical NOT: true when the one operand is false, and vice-versa

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

If there are no gaps in a series of ranges, is the range implicit or explicit?

A

Implicit

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

Floating point numbers should not be compared using which operator?

A

==

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

A leap year must be divisible by?

A

4

17
Q

If the year is a century year it must be evenly divisible by?

A

400

18
Q

What does the variable max represent?

A

The max value seen so far.

19
Q

What is a while loop?

A

A loop that repeatedly executes the loop body while the loop’s expression evaluates to true.

20
Q

What is a for loop?

A

A loop consisting of a loop variable initialization, a loop expression, and a loop variable update that typically describes iterating for a specific number of times.

21
Q

Finish the following - number of iterations is computable…….

A

Before the loop, like iterating N times.

For

22
Q

Finish the following - Number of iterations is not…….

A

Easily computable before the loop, like iterating until the input is ‘q’.

While