Practice Documentation in CS Thinking
Use these practice problems to test your method after reviewing the concept explanation and worked examples.
Quick Recap
Software documentation is the collection of written descriptions that explain how a system works and how to use it, including inline code comments, user guides, API references, design documents, and README files. Good documentation makes software understandable, usable, and maintainable by both current and future developers.
Documentation is a letter to your future self (and teammates) explaining what the code does and why you made certain decisions.
Showing a random 20 of 50 problems.
Example 1
challengeYour team has open-source consumers of a library. You plan to deprecate a function in months. Design a 4-step documentation rollout to minimize user breakage.
Example 2
challengeA team writes thorough docs once at launch but never updates them; six months later many are wrong. Name the failure and the disciplined fix.
Example 3
mediumWhich comment is more useful: (a) `// loop over users`, (b) `// skip suspended users to avoid sending re-engagement emails to banned accounts`?
Example 4
mediumA function's docstring lists parameters but omits that it returns null on error. What documentation principle is violated?
Example 5
mediumAfter a refactor, the README still shows the old command name. What is the defect and the fix category?
Example 6
easyGood documentation explains code's ___ and how to use it, not just restating syntax.
Example 7
mediumA comment says '// returns true' but the function returns the count of items. What should be done?
Example 8
mediumA new teammate needs to understand WHY a module exists and its overall structure, not call signatures. Which doc fits best?
Example 9
hardArgue both sides: 'Good code is self-documenting and needs no comments.'
Example 10
hardA team writes docs only after shipping. Suggest one process change that ties doc writing to code merging.
Example 11
mediumFor an end user (non-programmer) learning to use the app's features, which doc fits best?
Example 12
hardYou inherit a 5,000-line module with no documentation. Outline a triage approach to document it without rewriting everything.
Example 13
mediumA function has no comments or documentation. Reverse-engineer its purpose from the code: FUNCTION mystery(text): SET result = ''. FOR i = LENGTH(text)-1 TO 0 STEP -1: result = result + text[i]. RETURN result. Write appropriate documentation for it.
Example 14
easyWhich comment is BETTER: (a) 'x = x + 1 // add 1 to x' or (b) 'x = x + 1 // advance to next page'?
Example 15
easyDocumentation primarily serves which audience?
Example 16
mediumFill in the blank: good documentation explains the ____ of the code, not just restates its syntax.
Example 17
hardA documentation site needs to explain 'how do I do X?' for a specific task. What Diataxis category is this?
Example 18
hardAn API's docs list every parameter but never give an example. What is the main risk?
Example 19
mediumA function has comments only for the success case; it can also throw on invalid input. What documentation gap exists?
Example 20
easyInline notes inside source code that explain logic are called what?