Courseiva

200-901 Software Development and Design Practice Question

A developer is implementing exception handling in Python for a function that makes an HTTP request. Which THREE exception types should be caught to handle common network and HTTP errors? (Choose three.)

⚠ Common exam trap

Cisco often tests the distinction between exceptions that represent recoverable runtime errors (ConnectionError, Timeout, HTTPError) versus exceptions that indicate programming bugs (InvalidURL) or edge-case behavior (TooManyRedirects), leading candidates to over-select or under-select the correct set.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

requests.exceptions.ConnectionError

Option A, requests.exceptions.ConnectionError, is correct because it is raised when the HTTP request cannot establish a connection to the server, such as DNS resolution failures, refused connections, or other network-level problems that a developer must handle. Option C, requests.exceptions.Timeout, is correct because it is raised when a request exceeds the specified timeout period, covering both connect and read timeouts, which are common in unreliable network conditions. Option D, requests.exceptions.HTTPError, is correct because it is raised by Response.raise_for_status() when the server returns an unsuccessful HTTP status code (4xx or 5xx), representing common HTTP-level errors. Option B, requests.exceptions.InvalidURL, is not among the marked answers because it typically indicates a malformed URL supplied by the developer rather than a common runtime network or HTTP error. Option E, requests.exceptions.TooManyRedirects, is also not marked because excessive redirects are a less common edge case compared to connection, timeout, and HTTP status failures.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    requests.exceptions.ConnectionError

    Why this is correct

    ConnectionError is raised when the request cannot reach the server at all, such as DNS failure or refused connection. Catching it handles the transport-level failures the stem's HTTP request function will encounter before any response is received.

  • ✗

    requests.exceptions.InvalidURL

    Why it's wrong here

    This is also a possible exception, but not as common as the three listed; however, the question asks for common network and HTTP errors, and InvalidURL is more of a client error. The three selected are the most typical ones to handle.

  • ✓

    requests.exceptions.Timeout

    Why this is correct

    Timeout is raised when the server does not respond within the specified period, covering slow or unresponsive endpoints. It is distinct from connection refusal and HTTP status errors, so catching it handles stalled network conditions during the request.

  • ✓

    requests.exceptions.HTTPError

    Why this is correct

    `requests.exceptions.HTTPError` is raised by `raise_for_status()` when the server returns a 4xx or 5xx status, satisfying the stem's HTTP error requirement. Catching it lets the function distinguish a reachable server rejecting the request from transport-level failures, so the developer can handle bad responses separately.

  • ✗

    requests.exceptions.TooManyRedirects

    Why it's wrong here

    TooManyRedirects fires only when a redirect chain exceeds the configured limit, so it misses connection failures, timeouts and HTTP error statuses. It tempts because redirect loops do occur against misconfigured endpoints, making it worth catching in scripts that follow redirects, but it is not one of the common network and HTTP errors the question targets.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.