Topic 5 - Selection Statements Flashcards

1
Q

Besides return statements and expression statements, what are the other types of statements?

A

1) selection statements
2) iteration statements
3) jump statements

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

What is the precedence of relational operators relative to arithmetic operators?

A

Lower.

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

What is the relational operators and equality operators association?

A

Left-associative.

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

What is the precedence of equality operators relative to relational operators?

A

Lower.

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

The logical operators treat any nonzero operand as ___

and any zero operand as ____?

A

True

False.

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

What is conditional expression syntax?

A

expre1 ? expr2 : exp3 which means:

if expr, then e ,xpr2, else expr3

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

Does C89 have a proper boolean type?

A

No, had to declare an int variable and assign it either 0 or 1

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

What is the boolean type in C99?

A

_Bool type
_Bool flag;
It is an integer type that can only take values 0 and 1

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

What happens when you attempt to store a non-zero value into a _Bool variable?

A

Causes the variable to be assigned 1

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

What does C99 header do?

A

Defines a macro, bool, that stands for _Bool:
bool flag; same as:
_Bool flag;

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

The switch statement must be followed by a:

A

an integer, no floating point numbers or strings.

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

What happens when the default case is missing and the controlling expression’s value doesn’t match any case label?

A

the control passes to the next statement after the switch.

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

What happens when “Break” isn’t included in a case label body?

A

Control flows to next case label.

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