Questions
What is the first major step of the HtDF recipe?
Multiple choice
What should a good purpose statement do?
Multiple choice
Why is a stub useful before the real function body is written?
Multiple choice
With a correct stub and meaningful tests for an unfinished function, what is the usual desirable result?
Multiple choice
What should guide the choice of test expectations?
Multiple choice
What is the purpose of a function template in early HtDF?
Multiple choice
Which is the better signature when a function always produces a non-negative whole number?
Multiple choice
What does it mean that the HtDF recipe is not a waterfall process?
Multiple choice
A function tall? has a test only for a tall image. What important problem remains?
Multiple choice
If a test fails after the body is implemented, what should you check before changing correct-looking code?
Multiple choice
The specification says a rating is poor when it is less than 4.0. What should happen at exactly 4.0?
Multiple choice
Why are verbose expectations such as (* 2 4.2) sometimes useful?
Multiple choice
What does the Racket naming convention tall? communicate?
Multiple choice
Which test set best examines a boundary at 25 where values below 25 and values at/above 25 behave differently?
Multiple choice
Why is changing a correct implementation just to satisfy an incorrect test dangerous?
Multiple choice
Why is a stub written before the examples/tests in the HtDF recipe, and what should normally happen when meaningful tests are run against an unfinished stub?
Short answer
Write a signature, purpose statement, and stub for a function named double that consumes a Number and produces twice that Number. The stub should produce a valid Number but should not implement the real calculation yet.
Short answer
Write a Racket function named passing? that consumes a Number score and produces true when the score is at least 60 and false otherwise.
Short answer
A function named cheap? should produce true when a price is strictly less than 100. Write three check-expect tests that test the boundary: one value below 100, exactly 100, and one value above 100.
Short answer
The purpose of area is to produce the area of a square whose side length is n. The function is (define (area n) (* n n)), but a test says (check-expect (area 3) 3) and fails. What should you change, and why?
Short answer