Enumerations Flashcards

1
Q

Enumeration (or enum) is a user defined data type in C.

A

True

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

The keyword ‘enum’ is used to declare new enumeration types in C

A

True

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

enum day {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};

Given the enumeration definition above, what is the value of Sunday?

A

0

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

enum day {sunday = 1, monday, tuesday = 5, wednesday, thursday = 10, friday, saturday};

Given the enumeration definition above, what is the value of saturday?

A

12

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

Two enum names cannot have same value

A

False

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

enum state {working, failed};

enum result {failed, passed};

If the above enumerations are in the same scope, this source code would compile with no errors.

A

False

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