PCA (Prometheus Certified Associate) sample exam question with answer 217

Question:
Let http_requests_total be a counter metric representing the number of HTTP requests a server has handled. Further, let it be labeled by status_code representing the HTTP status code of handled requests (200, 300, 400, etc).
Which of the following queries yields the current total number of NON-server errors (500-599) specified by the metric?

  1. sum(http_requests_total{status_code!~"5xx"})
  2. sum(http_requests_total{status_code!~"5\\d{2}"})
  3. http_requests_total{status_code!="5xx"}
  4. sum(http_requests_total{status_code!=`5\d\d`})
Answer:
B - is the correct answer
A, C - is incorrect as x is not a valid regular expression to match a digit
D - the label selector is not using the appropriate syntax for selecting labels that do not match the given regular expression (!~)