Computer Science 111 - Homework 1

Due Wednesday, January 15


Name:

For the following exercises, assume the Java declaration:

int m=4, n=5, p=6, q=7;

Complete the computations using the Java operations, giving the result as your answer. Note that your answers will be integers or "true" or "false".

  1. m + p - q

  2. m + p % q

  3. n * p % m

  4. n * p / m

  5. n * p / m * m

  6. m + p <= n + q

  7. (m * n / p) * p == m * n

  8. m < p || n > q

  9. m < p && n > q

  10. !(m < p && n > q)