Topic 2 Flashcards

1
Q

The following expression is an example of what type of logic

spam = True

A

Boolean logic

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

What will the following integer and string expression evaluate to?

42 == ‘42’

A

False

Values for strings and integers will never be the same.

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

What will the following float and integer expression evaluate to?

42.0 == 42

A

True

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

What happens when the condition of an IF statement is True?

A

The next indented line will be executed by the program.

If the condition was false, the program would skip the next line.

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

What happens when the condition of an IF statement is False?

A

The program will move to the else statement and execute the code in that block.

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

If a user does not enter a value for a string and leaves it blank, would that evaluate to either True or False

A

False

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