PT0-002 · Question #293
PT0-002 Question #293: Real Exam Question with Answer & Explanation
The correct answer is C: The sys module was not imported.. {"question_number": 1, "correct_answer": "C", "explanation": "In Python, 'sys' is a standard library module that must be explicitly imported before use. The variable 'argv' is an attribute of the 'sys' module (accessed as sys.argv), not a standalone module or variable. If the scr
Question
A penetration tester created the following script to use in an engagement: However, the tester is receiving the following error when trying to run the script: Which of the following is the reason for the error?
Options
- AThe sys variable was not defined.
- BThe argv variable was not defined.
- CThe sys module was not imported.
- DThe argv module was not imported.
Explanation
{"question_number": 1, "correct_answer": "C", "explanation": "In Python, 'sys' is a standard library module that must be explicitly imported before use. The variable 'argv' is an attribute of the 'sys' module (accessed as sys.argv), not a standalone module or variable. If the script uses 'sys.argv' without first including 'import sys' at the top, Python raises a NameError: name 'sys' is not defined. The fix is simply to add 'import sys' to the script. Option D is incorrect because 'argv' is not a module - it is an attribute within the sys module.", "generated_by": "claude-sonnet", "llm_judge_score": 5}
Topics
Community Discussion
No community discussion yet for this question.