✕ Close

Week 13 · 13.5 · Fri, Oct 30 · Do Now

Do Now

Work every question in your notebook. Do it on your Chromebook with your ID.

  1. Trace row

    Trace these lines. What do the boxes hold after line 3?

    n ← 17
    b ← n rem 3 ≠ 2
    c ← n ≥ 17
    1. n = 17, b = false, c = true
    2. n = 17, b = true, c = true
    3. n = 17, b = false, c = false
    4. n = 17, b = 2, c = true
  2. Predict

    What is shown? The first line shown is first.

    y ← 10
    show y > 4 and y < 10
    show y > 4 or y < 10
    1. false, then true
    2. true, then true
    3. false, then false
    4. true, then false
  3. Error analysis

    A student traced these lines and wrote that pass holds true. The right answer is false. What mistake did the student make?

    score ← 70
    pass ← score > 70 and score ≤ 100
    1. The student read > as ≥, but 70 is not greater than 70.
    2. The student read ≤ as <.
    3. The student used the wrong value of score.
    4. The student forgot that 70 ≤ 100 is false.
  4. Write the rule

    Which question is true exactly when n is even?

    1. n rem 2 = 0
    2. n rem 2 ≠ 0
    3. n ÷ 2 = 0
    4. n rem 2 = 2
  5. Output

    Trace these lines. Write exactly what is shown, one line for each show.

    n ← 36
    even ← n rem 2 = 0
    small ← n < 50
    show even and small
    show not small