exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 380 discussion

Actual exam question from CompTIA's PT0-002
Question #: 380
Topic #: 1
[All PT0-002 Questions]

During a penetration test, a security consultant needs to automate the hash calculation of each password in a text file and store the results in memory. Which of the following Python snippets should the tester use to accomplish this task?

  • A.
  • B.
  • C.
  • D.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
BlackSkullz
5 months, 3 weeks ago
Selected Answer: A
None of these would really work, as the hashlib.sh256 function expects a byte-like object in the input rather a string. But going off of the perceived intentions of the snippets, A. is the only one that aims to hash each individual line by defining the variable 'password' that's within the 'lines' variable B. calls for hashing 'line' which isn't defined anywhere else in the code C. and D. seem to hash the entire 'lines' variable, which isn't what the tester wants
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago