Practice question · Select all that apply
Select every practice that the lesson recommends when modelling a problem.
Hints
- One option is the named pitfall, not a recommendation.
- The lesson says diving straight into code leads to tangled, buggy code.
Show the answer
- A. State the assumptions and constraints explicitly
- B. Identify the data and its type before coding
- C. Sketch the algorithm in pseudocode first
- D. Decide what can vary and what must hold
Why
Naming the data, sketching pseudocode, stating constraints, and deciding what may vary are all recommended. Writing real code before modelling is the pitfall the lesson names, it almost always produces tangled, buggy code.
Practise Simple Modelling with Code
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Simple Modelling with Code
- Modelling a phone book as a dictionary rather than a list of pairs changes almost nothing about what the…
- Choosing a fitting data representation is half the battle. Sort each quantity by the type that best models it.
- Order the steps of modelling a problem before writing real code.
- Storing money as a floating-point number is a well-known mistake. What actually goes wrong?