## Section 6.2 Fill in the Blank

Another type of question allows you as the instructor to ask for a value. You can test for the value using regular expressions. Leading and trailing whitespace in an answer will automatically be ignored. For example:

### Checkpoint 6.2.1.

Q-1: How many bowling pins are used when bowling? You can put spaces before or after the number without affecting the correctness of the answer. You can provide the answer in decimal (10), hexadecimal (0xA), binary (0b1010), or using scientific notation (1e1).

```
.. fillintheblank:: fill1512
How many bowling pins are used when bowling?
You can put spaces before or after the number without affecting
the correctness of the answer.
You can provide the answer in decimal (10), hexadecimal (0xA),
binary (0b1010), or using scientific notation (1e1).
- :10: Correct.
:0x10: Incorrect. (Note that solutions can be provided in any base as well).
:.*: Incorrect.
```

You can have multiple blank areas to fill in.

### Checkpoint 6.2.2.

Q-2: Fill in the following: `age =`

; to declare age to be an integer and set its value to 5.

```
.. fillintheblank:: fillDecVar1
Fill in the following: |blank| ``age =`` |blank|; to declare age to be an
integer and set its value to 5.
- :int: Correct. You typically use whole numbers for ages after age 1.
:.*: Remember that Java uses just the first 3 letters of integer
- :5: Correct. You can initialize to a value.
:.*: Use 5 in the second blank
```

Case-insensitive answers are supported:

### Checkpoint 6.2.3.

Q-3: What is the opposite of yes?

```
.. fillintheblank:: fitb_casei
:casei:
What is the opposite of yes?
- :no: Correct.
:.*: The correct answer is no, No, nO, or NO.
```

Numeric answers may provide a tolerance, to accept a range of correct answers.

### Checkpoint 6.2.4.

Q-4: What is 1/3 as a decimal value? Provide at least three significant figures^{â€‰1â€‰}.

```
.. fillintheblank:: fitb_tolerance
What is 1/3 as a decimal value? Provide at least three `significant figures <https://en.wikipedia.org/wiki/Significant_figures>`_.
- :0.333 0.0005: Correct. Any value in the range of 0.333Â±0.0005 is correct.
:.*: Incorrect. Did you provide three `significant figures`_?
```

`https://en.wikipedia.org/wiki/Significant_figures`

`https://en.wikipedia.org/wiki/Significant_figures`