Exam workshop: plan, answer and review
Plan a multipart answer
The report question below is worth six practice points for a complete algorithm. Before coding, list its identifiers and types. Separate storing entries from selecting entries, even if your implementation processes them in one loop. A record is appropriate because a code and a measured value have different types.
Marking checklist
Review each feature: record definition; correctly bounded array; reading every requested entry; inclusive threshold; output in input order; correctly initialised count and final output. A teacher may award partial marks for these features even when a runnable solution fails a case. Our local check awards the complete-algorithm points only when all cases pass.
Attempt, then compare
Try the algorithm without hints. Trace a value below the threshold, one exactly on it, and one above it. After checking, use the authored hints and worked answer to compare decisions. Explain why Code is a STRING and why Count is initialised outside the loop. When ready, attempt assessment A and assessment B without support.
Read N (1 to 4), then Target, then N code/value pairs. Define TYPE Entry with Code : STRING and Value : INTEGER, and store an array of records. Output codes whose Value is at least Target, in input order, then the matching count.
לחץ על הרץ כדי לראות את התוצא כאן.
For Target = 10 and values 9, 10, 15, give Count after each iteration. Count starts at 0 and increases for values at least Target.
Explain your choice of data structure and loop. Identify one boundary case and predict its result. For a subroutine, explain what is returned or changed in the caller.
Saved for this sitting on this browser. Review this yourself or with your teacher; these explanations are not automatically marked.
Review your explanation against these criteria
- My types and data structure match the data and the question.
- I justified the loop and checked its first and last iterations.
- Initial values and rejected operations preserve the intended state.
- My test includes input, purpose and expected result.
- I distinguished returning a value from printing and changing caller state.