Design Decisions Review

Design Decisions Review#

These questions are designed to assess your current understanding of design decisions with conditionals!

Questions 1

Say that I wanted to write some code that, when given a day of the week as a String, it would tell me if it was a weekday or weekend.

What kind of conditional structure should I use?

  1. if

  2. if/else

  3. if/else if

  4. if/else if/else if


Questions 2

Say that I wanted to write some code that, when given an int representing a place in a race (1st, 2nd, 3rd, 4th, etc.), it would a unique message (e.g. "You got first place!" or "You got second place!") only if it was 1st, 2nd, or 3rd place.

What kind of conditional structure should I use?

  1. if

  2. if/else

  3. if/else if

  4. if/else if/else if


Questions 3

Say that I wanted to write some code that, when given an int value, would only print to the console if the value was divisible by 3.

What kind of conditional structure should I use?

  1. if

  2. if/else

  3. if/else if

  4. if/else if/else if