Quiz 00 Practice


Below are optional practice problems for Quiz 0. These problems are intentionally a bit more challenging than what you will see on the quiz.

Solutions for each problem can be found at the bottom of this page.

Questions

Booleans and Conditionals

  1. What values of x and y would cuase the following expression to evaluate to True?

    x % 3 == 2 and y < 10 and x + y == 15 and y % 2 != 0

  2. Write the boolean value each expression evaluates to:
    1. (8 * 3) == (50 % 6 * 12)
    2. not False and True == True
    3. not False or True and False
    4. true and 7 < 3 * 4 / 6
    5. not 4 < 10 or False != True
  3. With the following code snippet, what output will appear on the screen when each of the following values is used for x and y?

    1. When x = 3, y = 5?
    2. When x = 5, y = 3?
    3. When x = -5, y = 1?
    4. When x = 13, y = 8?
    5. When x = 4, y = 3?

Diagramming and Functions

  1. Given the code listing below, produce a memory diagram including the stack, heap, and output.

Solutions

Booleans and Conditionals

  1. x: 8, y: 7
    1. True
    2. True
    3. True
    4. False
    5. "True"
    1. "17"
    2. "2"
    3. "-2"
    4. "3"
    5. "1"

Diagram