Multiple choice

The declaration enum cities { bethlehem, jericho, nazareth = 1, jerusalem } assign(s) the value 1 to

  1. bethlehem

  2. nazareth

  3. bethlehem and nazareth

  4. jericho and nazareth

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In an enum, values increment by 1 from the previous member. Bethlehem is 0, jericho is 1, nazareth is explicitly set to 1, and jerusalem becomes 2. Thus, both jericho and nazareth have the value 1.