CompTIA PenTest+ PT0-003 (V3) Practice Question

A Python enumeration script loops through a list of target IP addresses and calls socket.connect_ex() to test whether TCP port 22 is open. The integer variable open_port_count tracks how many targets have been confirmed with the port open. Which one-line statement should be executed immediately after a successful connection to ensure open_port_count is updated correctly while preserving its integer type?

  • open_port_count = open_port_count & 1

  • open_port_count -= 1

  • open_port_count += 1

  • open_port_count = str(open_port_count) + "1"

CompTIA PenTest+ PT0-003 (V3)
Reconnaissance and Enumeration
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

SAVE $51
$425.00 $374.00
SAVE $57
CompTIA PenTest+ Voucher with Retake
v3 / PT0-003
Includes Retake
$474.00 $417.00
Bash, the Crucial Exams Chat Bot
AI Bot