## Lab 4: Prelab Questions

### Written Questions:

Question #1: What are the six basic relational operators? __________________________ They can be used to construct simple logical expressions, but the three logical operators ______________ can combine these into compound logical expressions.

Question #2: In computing, logical expressions are also called ____________ expressions.

Question #3: The ______________ mechanism can be used to terminate execution if a specified condition fails.

Question #4: The `if` statement is a ____________ structure and comes in three forms: ____________, ____________, and ____________.

Question #5: A sequence of statements will be treated by the compiler as a single statement if the statements are enclosed in __________.

Question #6: What two kinds of loops are studied in this lab? ___________ and __________ loops.

Question #7: Which of these loops is best for counting? _____________

Question #8: Which of these loops executes repeatedly so long as a boolean expression is true? ______________

### Programming Exercises

Suppose `i` and `j` are both `int`s set to some values.

Code #1: Write a boolean expression that evaluates to `true` if and only if `i` is less than `j`.

Code #2: Using the boolean expression from the preceding question, write an `if` statement that outputs "Too small!" when `i` is less than `j`.

Code #3: Modify the `if` statement of the preceding question so that it also also outputs "Too big!" when `i` is not less than `j`.

Code #4: Assuming that a value has been input for `j`, write a `for` statement that contains the previous `if` statement and repeats it for `i` ranging from 1 to 10.

Code #5: Proceed as in the preceding question, but use a `while` statement instead of a `for` statement.

Lab Exercise