created: 05/17/1998; revised: 10/04/03, 03/01/06

on the Single-branch if

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.

1. Evaluate the following expression:

```
1 + 2 == 3
```

 A.    true B.    false C.    unpredictable

2. Evaluate the following expression:

```
25 < 5 * 5
```

 A.    true B.    false C.    unpredictable

3. Evaluate the following expression:

```
8 + 1 >= 3 * 3
```

 A.    true B.    false C.    unpredictable

4. What does the following code fragment write to the monitor?

```int height = 10;
if ( height <= 12 )
System.out.print("Low bridge: ");
System.out.println("proceed with caution.");
```

 A.    Nothing is written. B.    Low bridge: C.    proceed with caution. D.    Low bridge: proceed with caution.

5. What does the following code fragment write to the monitor?

```int height = 13;
if ( height <= 12 )
System.out.print("Low bridge: ");
System.out.println("proceed with caution.");
```

 A.    Nothing is written. B.    Low bridge: C.    proceed with caution. D.    Low bridge: proceed with caution.

6. What does the following code fragment write to the monitor?

```int depth =  8 ;
if ( depth >= 8 )
{
System.out.print("Danger: ");
System.out.print("deep water. ");
}
System.out.println("No swimming allowed.");
```

 A.    Danger: B.    Danger: deep water. C.    Danger: deep water. No swimming allowed. D.    deep water. No swimming allowed.

7. Evaluate the following expression:

```10.0 + 0.10 < 11.0
```

 A.    true B.    false C.    unknown

8. Evaluate the following expression:

```10.0 + 0.10 > 10.0
```

 A.    true B.    false C.    unknown

9. Evaluate the following expression:

```10.0 + 1.0/10.0 < 1.10
```

 A.    true B.    false C.    unknown

10. Fill in the blank so people under 21 years are offered Grape Soda.

```if ( age  _________ 21 )