nerdexam
CompTIA

PT0-002 · Question #614

A penetration tester is writing a web scraper to process a list of more than 100.000 URLs: Which of the following script snippets should the tester use for the best performance?

The correct answer is D. Option D. For processing a large number of URLs, the best performance is achieved through asynchronous or parallel processing.

Tools and Code Analysis

Question

A penetration tester is writing a web scraper to process a list of more than 100.000 URLs:

Which of the following script snippets should the tester use for the best performance?

Exhibits

PT0-002 question #614 exhibit 1
PT0-002 question #614 exhibit 2

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D

How the community answered

(20 responses)
  • A
    15% (3)
  • B
    5% (1)
  • C
    25% (5)
  • D
    55% (11)

Why each option

For processing a large number of URLs, the best performance is achieved through asynchronous or parallel processing.

AOption A

Option A likely represents a sequential processing approach, which would be slow for 100,000 URLs as each request waits for the previous one to complete.

BOption B

Option B likely represents a sequential processing approach, which would be slow for 100,000 URLs as each request waits for the previous one to complete.

COption C

Option C likely represents a sequential processing approach, which would be slow for 100,000 URLs as each request waits for the previous one to complete.

DOption DCorrect

For processing a large list of URLs, the best performance is achieved through asynchronous or parallel processing. Option D likely represents a solution that uses concurrent requests, such as a thread pool, asyncio, or similar mechanisms, allowing multiple URLs to be fetched simultaneously rather than sequentially. This significantly reduces the total time required compared to processing each URL one after another.

Concept tested: Web scraping performance, concurrent programming

Source: https://docs.python.org/3/library/asyncio.html

Topics

#Web scraping#Scripting#Performance optimization#Concurrency

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice