Lecture 3 Flashcards

1
Q

Bool

A

Variable type. Can be true (1) or false (0). Stored in one bit.

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

Boolean operations

A

And (&&), or (||), not (!)

Always enclose boolean expressions in parentheses so there isn’t any odd behavior due to order of operations. Boolean order of operations is not, and, or.

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

Not (boolean operation)

A

Flips the bool (false becomes true, true becomes false). ! Is the not operator and comes before whatever it is flipping.

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

And (boolean operation)

A

If two conditions are met, it returns true. && is the and operator. Using only one & is known as bitwise, which is not the same thing.

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

Or (Boolean operator)

A

Is true if either condition is met. || is the or operator.

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

Logical Operations

A

The computer reads not first, then and, then or.

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

Comparison Operators

A

Greater than (>), greater than or equal to (>=), less than (<), less than or equal to (<=), equal (==), not equal (!=).

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

If statement

A

If statements executes the code that follows if the conditional is met.

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

Else statement

A

Executed the code that follows if the conditional is not met.

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

Else if statment

A

Executes the code that follows if the statement that follows else if is met and the preceding if statements are not met.

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

Conditional

A

Statement that evaluates to true or false. Helps with decision making in code.

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

Curly braces

A

Best if they follow any if/then/else statment

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

Indentation

A

Helps with organization. Commands are typically indented.

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