引导式测验 · 简单 等级

如何使用 AI 测验调试代码

练习阅读堆栈跟踪,构建最小的可重现示例,并向 AI 询问可测试的假设,而不是盲目重写代码。

问题 1 的 8

该指南建议不要要求人工智能重写整个文件,而是要求什么?

预览每个问题8 问题

当您参加测验时,就会出现答案和解释。

  1. 该指南建议不要要求人工智能重写整个文件,而是要求什么?
    • A longer version of the same code
    • The most likely causes and how to check each one
    • A translation of the code into another language
    • More comments throughout the file
  2. 在 Python 回溯中,您在哪里可以找到异常类型和消息?
    • On the very first line
    • In the middle of the trace
    • On the final line, because the most recent call is printed last
    • It is not shown in the traceback
  3. 什么是最小可重现示例?
    • The smallest code and data that still shows the problem
    • The entire project compressed into one file
    • A screenshot of the error
    • A list of all installed library versions
  4. 哪个 bug 描述为 AI 提供了最有用的信息?
    • It doesn't work
    • Please fix my code
    • My code is broken again
    • I expected 10 rows, I get 0, and there is no error
  5. 为什么在应用人工智能建议的修复之前提交或隐藏你的代码?
    • It makes the AI's answers more accurate
    • So you can revert if the suggestion makes things worse
    • It automatically deletes old bugs
    • It uploads your code to the AI
  6. Why is the line named in an error message not always where the bug is?
    • Error line numbers are random
    • Compilers often count lines incorrectly
    • The bug is often earlier, where the bad value was created, not where it was used
    • Bugs are always inside third-party libraries
  7. After applying a fix, what should you do to confirm it?
    • Close the chat and move on
    • Ask a different AI whether it looks right
    • Assume it works if no error appears
    • Rerun the original failing case plus some normal cases
  8. What does the guide suggest doing with your reproduction once the bug is fixed?
    • Turn it into an automated test
    • Delete it to keep the project clean
    • Post it publicly as a tutorial
    • Comment it out for later