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

Question:
Let cert_expiry be a gauge metric whose value is a Unix timestamp (epoch time) representing the time a given certificate will expire.
Which of the following queries gives the time in hours until certificate expiration?

  1. cert_expiry - time("h")
  2. cert_expiry - time()
  3. cert_expiry / 3600 - time.now.hours()
  4. (cert_expiry - time()) / 3600
Answer:
D - is the correct answer
A - is incorrect as the time function does not accept any arguments
B - is incorrect as this query will yield the time in seconds until certificate expiration, not the time in hours. To convert the result to hours, it is necessary to divide the result of this query expression by 3600 (3,600 seconds in an hour)
C - is incorrect as there is no such PromQL function time.now.hours