Kvíz spojený s průvodcem · Střední úroveň

How to Write Code Documentation with AI Quiz

Check how to prompt AI for code docs, validate examples against implementation, and keep generated explanations accurate.

Související vodicí cestyHow To Write Code Documentation With AI
Otázka 1 z 8

Asistent navrhne dokumentační řetězec pro funkci, která ověřuje cestu k souboru. Co by měl vývojář nejprve ověřit?

Náhled každé otázky8 otázky

Odpovědi a vysvětlení se zobrazují, jak budete v kvízu.

  1. Asistent navrhne dokumentační řetězec pro funkci, která ověřuje cestu k souboru. Co by měl vývojář nejprve ověřit?
    • The described inputs, return value, side effects and edge cases against the code and tests
    • Whether the prose uses the most technical vocabulary
    • Whether the comment is longer than the function
    • Whether the model sounds confident
  2. Soubor README říká, že se má spustit instalační příkaz generovaný AI. Co je silný ověřovací krok?
    • Assume it works because the command is familiar
    • Remove all installation steps
    • Run it in a clean environment and confirm it matches the project scripts and configuration
    • Ask the assistant to repeat the command with more confidence
  3. Který vložený komentář je nejužitečnější?
    • A paraphrase of the next line with no added context
    • A note explaining a non-obvious invariant or reason for the code
    • A claim that the function is secure without evidence
    • A list of unrelated TODOs
  4. Vygenerovaný příklad rozhraní API importuje věrohodný název balíčku, který se v úložišti nepoužívá. Co by se mělo stát?
    • Keep it because the package name looks conventional
    • Change the dependency file to match the example without review
    • Delete the API documentation
    • Check the import against actual dependencies and run the example
  5. Proč by se vývojáři měli vyhýbat odesílání tajemství neschválenému asistentovi kódování?
    • The code or context may be processed under data-handling terms that have not been approved
    • Secrets make comments harder to read
    • The assistant needs every credential to understand a function
    • A README cannot describe a credential safely
  6. A performance paragraph claims an algorithm is O(n), but no analysis or test supports it. What is the responsible edit?
    • Keep it because asymptotic notation sounds precise
    • Ask the model to invent a benchmark
    • Remove or qualify the claim until it is verified
    • Replace it with a security guarantee
  7. A new CLI flag changes behavior. When should its documentation be updated?
    • Only after users report that the README is wrong
    • With the code change and review, including a checked example
    • Never, because flags are discoverable from source
    • After deleting the tests
  8. Why might a code assistant describe an incorrect design reason even when it reads the function?
    • Source code contains every team decision automatically
    • Tests always explain product intent completely
    • Documentation never needs human input
    • The rationale or operational context may not be inferable from source code alone