exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 398 discussion

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

During a security assessment, a penetration tester decides to implement a simple TCP port scanner to check the open ports from 1000 to 2000. Which of the following Python scripts would achieve 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
IamBlackFire
5 months, 4 weeks ago
Selected Answer: A
A is correct and C is incorrect due SOCK_DGRAM = UDP (not TCP)
upvoted 4 times
IamBlackFire
5 months, 4 weeks ago
Why does range not include the end value? You might be wondering why range doesn’t include the end value. It all comes down to an important principle called zero-based indexing. Computers start counting at zero, while humans start counting at 1. When a computer needs to number 3 elements, it starts with element 0, then 1, and then 2. It’s the same with indexing. When accessing elements in a Python list, the first element resides at position 0. We would access it like this: my_list[0].
upvoted 2 times
...
...
SecEngi
6 months ago
Selected Answer: D
A stops in 2001, not in 2000, so D
upvoted 1 times
JohnViking
2 weeks, 3 days ago
No! Simply try it for i in range(10, 20): print(f'number is {i}')
upvoted 1 times
...
fecffa8
5 months, 1 week ago
in correct. Python uses zero-based indexing.
upvoted 2 times
kinny4000
2 months, 1 week ago
The range function starts with the first number listed and ends with the last number listed minus 1. (1000 - 2000 would actually list all numbers from and including 1000 - 1999, missing the final port 2000)
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