Skip to main content

Transfer reassessment

About 20 minutes. Take this after reviewing anything you missed on the diagnostic. The ideas are the same, but the contexts, conditions and procedures are new, so you can't just recall the earlier answers. Nothing here is recorded.

  1. Question 1 of 5A weather station logs winter temperatures. What does CountBelow([-3, 0, 4, -1], 0) return?

    Select one answer.

    Pseudocode
    PROCEDURE CountBelow(temps, limit){  count ← 0  FOR EACH t IN temps  {    IF (t < limit)    {      count ← count + 1    }  }  RETURN count}
  2. Question 2 of 5A cold week was recorded as [-6, -2, -9]. What does Warmest return?

    Select one answer.

    Pseudocode
    PROCEDURE Warmest(temps){  warmest ← 0  FOR EACH t IN temps  {    IF (t > warmest)    {      warmest ← t    }  }  RETURN warmest}
  3. Question 3 of 5A running club counts days with at least 30 minutes of running. What does CountLongRuns([45, 10, 30]) return?

    Select one answer.

    Pseudocode
    PROCEDURE CountLongRuns(minutes){  total ← 0  FOR EACH m IN minutes  {    IF (m ≥ 30)    {      total ← total + 1    }    RETURN total  }  RETURN total}
  4. Question 4 of 5Which two test cases would show that CountLongRuns is wrong (its result differs from a correct complete traversal)? Choose two.

    Select exactly two answers (0 of 2 selected).

  5. Question 5 of 5Which statement about HasNegative is true?

    Select one answer.

    Pseudocode
    PROCEDURE HasNegative(temps){  FOR EACH t IN temps  {    IF (t < 0)    {      RETURN true    }  }  RETURN false}

Your practice so far

Check an answer to see its rationale.