Booleans Flashcards

1
Q

equal to

A

==

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

not equal to

A

!=

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

what do booleans do

A

compare two things

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

what will booleans be assigned

A

true or false

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

booleans are used with

A

if statements

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

how to invert a boolean

A

!

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

if a is true and b is false what will a&&b give

A

false (a and b)

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

if a is true and b is true what will a&&b give

A

true (a and b )

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

what sign is used for and

A

&&

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

what sign is used for or

A

||

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

if a is true and b is false what will a||b give

A

true

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

if a is rue and b is true whta will a||b give

A

true

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

if a is false and b is false what will a||b give

A

false

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

if a is true what will !a give

A

false

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

boolean ! associativity (which direction is it read in)

A

right to left

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

boolean && associativity

A

left to right

17
Q

boolean || associativity

A

left to right

18
Q

what is the precedence of the three (!, || and &&)

A
  1. !
  2. &&
  3. ||
19
Q

where do the boolean operators fir into the overall precedene

A

between equality and conditional

20
Q

what order will the following operations occur in?

boolean cannotDrive = (age>17) || (!hasLicence) ;

A
  1. <
  2. !
  3. ||
  4. =
21
Q

what order will the following operations occur

boolean canDrive = (age>17) && (hasFullLicence || hasProvisionalLicence);

A
  1. >
  2. ||
  3. &&
  4. =

Brackets override precedence

22
Q

what would be the precedence here?

boolean canDrive = (age>17) && hasFullLicence || hasProvisionalLicence;

is that what we want?

A
  1. >
  2. &&
  3. ||
  4. =

No