# Logic and Conditionals Quiz

## Quiz: Practicing Conditionals with Vowels

### Objectives

You will answer a series of multiple choice questions to help you practice the following:

1. Flow control and the use of `if`, `elsif`, and `else` statements.
2. Flow control and the use of `case` statements.
3. Using comparative operators.

The questions in this quiz are predicated on the idea of building methods that can determine if a letter is a vowel or a consonant. For the purposes of this quiz, vowels will be `"a"`, `"e"`, `"i"`, `"o"`, and `"u"` (sorry, but you're not in the club, `"y"`).

???

## Conditional Vowels

?: Checking for vowels with `if`, `elsif`, and `else`

We're building a method, `vowels_with_if_elsif` that will take in a letter and return `true` if that letter is a vowel and `false` if that letter is a consonant.

```
def vowels_with_if_elsif(letter)
  < fill me in!! >
end
```

Which of the following is the correct implementation of `if`, `elsif`, and `else`?

(X)

```
if letter == "a"
  true
elsif letter == "e"
  true
elsif letter == "i"
  true
elsif letter == "o"
  true
elsif letter == "u"
  true
else
  false
end
```

( )

```
if letter = "a"
  true
elsif letter = "e"
  true
elsif letter = "i"
  true
elsif letter = "o"
  true
elsif letter = "u"
  true
else
  false
end
```

?: What would the following statement return?

```
letter = "b"

if letter == "a" || letter == "e" || letter ==  "i" || letter == "o" || letter == "u"
  "vowel"
else
  "not a vowel"
end
```

( )vowel (X)not a vowel

?: Checking for vowels with `case`

The method `vowels_with_case` takes in a letter as an argument and uses a `case` statement to determine if that letter is a vowel.

```
def vowels_with_case(letter)
  case letter
  < fill me in! > "a"
    true
  < fill me in! > "e"
    true
  < fill me in! > "i"
    true
  < fill me in! > "o"
    true
  < fill me in! > "u"
    true
  else
    false
  end
end
```

Which keyword correctly replaces `< fill me in! >` ?

( )`if` ( )`elsif` (X)`when` ( )`while`

?: Which of the following methods would correctly return `true` when given the letter `"o"` as an argument?

(X)

```
def vowels_with_if_single_line(letter)
  true if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u"
end
```

( )

```
def vowels_with_if_single_line(letter)
  true if letter == "a" && letter == "e" && letter == "i" && letter == "o" && letter == "u"
end
```

( )

```
def vowels_with_if_single_line(letter)
  true if letter == "a" || if letter == "e" || if letter == "i" || if letter == "o" || if letter == "u"
end
```

???

View [Quiz: Practicing Conditionals with Vowels](https://learn.co/lessons/conditional-quiz-vowels) on Learn.co and start learning to code for free.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://certil-remy.gitbook.io/learn/ruby/untitled-1-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
