引導式測驗 · 中等 等級

如何使用 AI 測驗編寫程式碼文檔

檢查如何提示 AI 提供程式碼文件、根據實施驗證範例並保持生成的解釋準確。

問題 1 的 8

助理為驗證文件路徑的函數起草文件字串。開發者首先應該驗證什麼?

預覽每個問題8 問題

當您參加測驗時,就會出現答案和解釋。

  1. 助理為驗證文件路徑的函數起草文件字串。開發者首先應該驗證什麼?
    • 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. 自述文件說要運行人工智慧產生的設定命令。什麼是強驗證步驟?
    • 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. 哪個內嵌註解最有用?
    • 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. 產生的 API 範例匯入儲存庫中未使用的合理套件名稱。應該發生什麼事?
    • 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. 為什麼開發人員應該避免將機密發送給未經批准的編碼助理?
    • 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