Branches Flashcards

(32 cards)

1
Q

What is a branch?

A

a statement executed under a certain condition.

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

What does a decision do?

A

create two branches.

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

What is another name for a decision and it’s two branches?

A

If-else

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

true or false 5 > 5?

A

False

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

if a series of decision branches appear cascading what is that known as?

A

If-elseif branch

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

If-elseif branchs appear on which branch?

A

The false branch

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

what is the name of == operator?

A

equality operator

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

When does == execute?

A

executes true when left and right sides are equal

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

A brach that has an if-else branch connected to another is known as?

A

Nested Branch

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

Can a nested brached have different varibles than the if-else branch it is connected to?

A

Yes

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

Explain multiple if branches.

A

Each decision is independent and more than one branch execute.

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

When using an equality operator what does == mean?

A

The variables to the left and right of == are equal
Example: 5 == 5

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

When using an equality operator what does != mean?

A

The variables to the left and right of == are not equal
Example: 5 != 1

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

Using equality operators what does >= mean?

A

a is greater than or equal to b

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

Using equality operators what does <= mean?

A

a is less than or equal to b

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

If you see 20..50 what is the expression showing?

A

a range of numbers from 20 all the way to 50.

17
Q

Counting from 0 to 100 using two range expressions if the first is 0..10 what is the second range?

18
Q

logical operators use which words?

19
Q

When does the “and” operator evaluate to true?

A

When (a) and (b) are true

20
Q

When does the “or” operator evaluate to true?

A

When any operand is true (a, b or both)

21
Q

When does the “not” operator evaluate to true?

A

When (a) and (b) are false

22
Q

(7 > 5) and (9 < 20) is this expression true or false?

23
Q

(x > 10) or (y > 20) is this expression true or false?

24
Q

not( (x > 5) and (y < 20) ) is this expression true or false?

25
when would you use logical "and"?
to find the value within a range
26
What is the difference between implicit and explicit ranges?
implicit ranges do not have any gaps in their range, but a explicit range does.
27
What is the order of precedence rule? (list them)
1) parenthesis 2) logical "not" 3) arthetmetic operators (+, -, *, /) 4) rational operators (<=, >=, <, >) 5) equality and inequality operators (== , !=) 6) logical "and" 7) logical "or"
28
should you use the equal operator (==) when comparing float numbers and why?
No. The numbers cannot be represented properly due to 64bit memory constraints.
29
In code a decision uses the word what word to start the statement?
if example: if userAge > 65
30
How do you write a "true" branch under a decision statement?
Start with an indent on the next line.
31
if your if statement has a false statement how is it written in code?
On the line under the true statement starting with else. then typing the false statement under "else" with an indent.
32
When to use an elseif statement?
If a statement doesn't execute as true and elseif statement on the next line is used to dictate what happens if the statement is false.