Courseiva

CCNA Promql Questions

66 questions · Promql · All types, answers revealed

1
MCQhard

If you perform 'A / B' where A and B have different sets of labels, what happens?

A.It automatically ignores the extra labels.
B.It returns an empty result.
C.It returns the result of the division for all series.
D.It returns an error in the UI.
AnswerB

Binary operators match series by their full label sets. When A and B share no identical label combination, no pairing exists, so the vector matching yields nothing and the expression returns an empty result rather than an error.

Why this answer

Binary operations require matching labels unless modifiers are used; otherwise, the result is empty.

2
Multi-Selectmedium

Which THREE of the following functions can be used with counter metrics to calculate rates or increases? (Choose three)

Select 3 answers
A.predict_linear()
B.irate()
C.deriv()
D.rate()
E.increase()
AnswersB, D, E

irate() computes a per-second rate from only the last two samples in the range, making it responsive to sudden spikes and suitable for volatile counter metrics. This satisfies the scenario's requirement to calculate rates or increases from counters, unlike functions needing longer windows.

Why this answer

The three correct functions are irate(), rate(), and increase(). irate() (B) computes the per-second instant rate of increase of a counter over the last two samples, making it suitable for volatile counter metrics. rate() (D) calculates the average per-second rate of increase of a counter over a specified time range, which is the standard way to derive rates from counters. increase() (E) returns the total increase of a counter over a given time range, effectively rate() multiplied by the range duration, and is designed specifically for counter metrics. predict_linear() (A) performs linear regression to extrapolate future values and is not a rate/increase function for counters, while deriv() (C) estimates the per-second derivative using linear regression on gauges, not counters.

Exam trap

The trap is confusing gauge-oriented functions (deriv, predict_linear) with counter-oriented functions; candidates must remember that only rate, irate, and increase are reset-aware counter functions.

3
Multi-Selecthard

Which TWO of the following statements about PromQL label matchers are correct? (Choose TWO)

Select 2 answers
A.The = operator performs an exact string match.
B.The ?= operator performs fuzzy string matching.
C.The =~ operator is used exclusively for numeric comparisons.
D.The == operator is valid inside label selectors for filtering.
E.The !~ operator performs a negative regular expression match.
AnswersA, E

The `=` matcher filters time series where the label value equals the given string exactly, including case sensitivity. This satisfies the stem's requirement for a correct label matcher statement, as PromQL's equality operator performs full-string comparison rather than substring or regex matching.

Why this answer

Option A is correct because in PromQL the '=' label matcher performs an exact string match, selecting time series whose label value is precisely equal to the provided string. Option E is correct because the '!~' operator performs a negative regular expression match, excluding series whose label value matches the given regex. Option B is incorrect because '?=' is not a valid PromQL label matcher operator.

Option C is incorrect because '=~' is a positive regular expression match for label values, not a numeric comparison operator. Option D is incorrect because '==' is not a valid label selector operator in PromQL; equality matching uses '='.

4
MCQmedium

You need to calculate the per-second rate of increase of http_requests_total over a 1-minute window. Why is using a 1-minute range window generally discouraged in production?

A.It is too short relative to typical scrape intervals, leading to high noise and sensitivity to jitter.
B.It disables counter reset detection algorithms.
C.PromQL automatically rejects any range window shorter than 5 minutes.
D.It causes Prometheus to run out of memory due to high sample density.
AnswerA

A one-minute range spans only a few samples at typical 15–60 second scrape intervals, so PromQL's rate() extrapolation amplifies scrape jitter and produces volatile, unreliable per-second values. This directly addresses the stem's constraint: short windows relative to scrape intervals yield noisy, jitter-sensitive results unsuitable for production alerting.

Why this answer

Prometheus scrapes most targets every 15 seconds. A 1-minute window only contains about 4 data points, making the rate calculation highly sensitive to small scraping jitters.

5
MCQmedium

Which function should be used to smooth out short-term fluctuations in a gauge metric by calculating the rolling average over a 10-minute window?

A.rate(node_load1[10m])
B.avg_over_time(node_load1[10m])
C.smooth(node_load1, 10m)
D.avg(node_load1[10m])
AnswerB

avg_over_time computes the mean of all samples within the specified range, so wrapping node_load1 in [10m] yields a rolling ten-minute average that damps short spikes. This directly satisfies the stem's requirement to smooth short-term fluctuations in a gauge.

Why this answer

The avg_over_time() function calculates the average value of all data points in the specified range vector for each time series.

6
MCQhard

You are joining two vectors where the left vector has labels {job="api", instance="host1"} and the right vector has labels {job="api", region="us-east"}. You use the query 'vector_a + ignoring(instance, region) vector_b'. What does the 'ignoring' modifier do?

A.It replaces missing instance and region labels with default values.
B.It removes 'instance' and 'region' from the final output time series.
C.It causes Prometheus to exclude the listed labels ('instance', 'region') from consideration during the equality check between the two vectors.
D.It hides errors caused by missing 'instance' or 'region' labels in the time series.
AnswerC

The ignoring modifier removes the named labels from the matching signature before equality is tested. Excluding instance and region leaves job as the sole common label, so samples pair on job alone despite differing label sets, satisfying the join requirement.

Why this answer

The `ignoring` modifier in PromQL vector matching tells Prometheus to ignore the specified labels when matching time series between the two vectors. In this case, `ignoring(instance, region)` means that the labels `instance` and `region` are not considered when finding matching pairs, so the left vector's `instance` and right vector's `region` are excluded from the equality check. This allows matching based on the remaining labels, such as `job`.

Exam trap

The trap here is confusing `ignoring` with label removal or default substitution; candidates often think it modifies the output rather than just the matching criteria.

How to eliminate wrong answers

Option A is wrong because `ignoring` does not replace missing labels with defaults; it simply excludes them from the matching process. Option B is wrong because `ignoring` does not remove labels from the output; the resulting time series will still carry the labels from the left vector (and possibly the right, depending on the operation). Option D is wrong because `ignoring` does not hide errors; if no match is found, the result is an empty vector, not an error suppression.

7
MCQeasy

What is the primary difference between an instant vector and a range vector in PromQL?

A.An instant vector contains a single sample per time series, while a range vector contains a set of samples over time.
B.An instant vector includes timestamps from the future, while range vectors are strictly historical.
C.An instant vector can only be used with counters, while range vectors can only be used with gauges.
D.A range vector evaluates faster because it caches historical calculations.
AnswerA

An instant vector holds one sample per series at a single evaluation timestamp, whereas a range vector holds every sample within a specified lookback window for each series. This satisfies the stem's distinction, and only range vectors can feed functions such as rate() or increase().

Why this answer

Instant vectors contain a single sample per time series for the given timestamp, whereas range vectors contain a set of data points over a time window.

8
MCQeasy

What is the difference between 'count' and 'count_values'?

A.count_values is faster.
B.count is for gauges; count_values is for counters.
C.count returns the number of series; count_values returns the frequency of values.
D.There is no difference.
AnswerC

`count` aggregates across series, yielding one output series per input group, whereas `count_values` buckets by observed sample value and emits one series per distinct value, exposing its frequency. This satisfies the stem's requirement to distinguish cardinality counting from value-frequency distribution.

Why this answer

count aggregates by number of series, while count_values counts the number of occurrences of each sample value.

9
MCQhard

You are troubleshooting a query and notice that label_replace is being used. What is the primary function of label_replace(v, dst_label, replacement, src_label, regex)?

A.It renames the Prometheus server instance in federated environments.
B.It drops all time series that do not contain the specified source label.
C.It matches a regex against a source label value and writes the result into a destination label.
D.It replaces the metric name with a new string.
AnswerC

label_replace() applies the supplied regex to the source label's value, and on a match writes the replacement string, with capture-group references, into the destination label. It rewrites labels for grouping or joining; it does not alter sample values or timestamps.

Why this answer

The label_replace function matches the regex against the value of src_label, and if it matches, sets dst_label to the replacement string.

10
Multi-Selectmedium

Which THREE of the following are valid set operators in PromQL for combining instant vectors? (Choose THREE)

Select 3 answers
A.intersect
B.union
C.unless
D.and
E.or
AnswersC, D, E

`unless` returns left-hand samples only where no matching right-hand series exists, filtering by label set. It satisfies the stem's requirement for a valid PromQL set operator combining instant vectors, alongside `and` and `or`. Unlike arithmetic binary operators, it operates purely on label matching rather than values.

Why this answer

In PromQL, the set operators available for combining instant vectors are `and`, `or`, and `unless`. Option D (`and`) is correct because it returns the elements of the left-hand vector that also exist in the right-hand vector, matching on labels. Option E (`or`) is correct because it returns all elements of the left-hand vector plus any elements from the right-hand vector that do not have matching label sets on the left.

Option C (`unless`) is correct because it returns elements of the left-hand vector that do not have matching label sets in the right-hand vector. Options A (`intersect`) and B (`union`) are not valid PromQL set operators; the intersection behavior is expressed by `and`, and union-like behavior is expressed by `or`, so neither keyword exists in the language.

11
MCQmedium

Which function evaluates the predictable linear extrapolation of a gauge metric over time to predict future values?

A.predict_linear(node_filesystem_free_bytes[1h], 4 * 3600)
B.holt_winters(node_filesystem_free_bytes[1h], 5m, 1m)
C.deriv(node_filesystem_free_bytes[1h])
D.extrapolate_linear(node_filesystem_free_bytes[1h], 4 * 3600)
AnswerA

`predict_linear` fits a least-squares linear regression over the 1h range vector and extrapolates it 4 hours ahead, satisfying the stem's demand for predictable linear extrapolation of a gauge over time. It returns the projected value of `node_filesystem_free_bytes`, exposing when the filesystem will exhaust free space.

Why this answer

predict_linear() is the PromQL function designed to perform linear regression over a range vector and extrapolate the result forward by a specified number of seconds. In predict_linear(node_filesystem_free_bytes[1h], 4 * 3600), Prometheus fits a linear trend to the last hour of samples and projects where the gauge will be in 4 hours, which is the classic pattern for disk-full alerts. The second argument is the extrapolation horizon in seconds, not a duration string.

Exam trap

The trap here is confusing deriv() (which returns the current rate of change) with predict_linear() (which returns a projected future value) — candidates who only remember 'linear regression' pick deriv and miss the extrapolation requirement.

How to eliminate wrong answers

Option B is wrong because holt_winters() performs double exponential smoothing for seasonal/trend forecasting on range vectors but does not extrapolate a linear prediction at a future timestamp the way predict_linear does, and its arguments are smoothing factors, not a future offset. Option C is wrong because deriv() only returns the per-second rate of change of a gauge based on linear regression over the range — it gives the slope, not a projected future value. Option D is wrong because extrapolate_linear() is not a real PromQL function; it is a fabricated name that sounds plausible but does not exist in the Prometheus query language.

12
MCQmedium

When writing a query with arithmetic operators, how does PromQL handle vector matching when both vectors have the exact same label sets?

A.It ignores labels entirely and matches strictly based on metric names.
B.It performs a one-to-one match automatically based on identical label sets.
C.It throws a matching error unless the 'on' modifier is explicitly provided.
D.It performs a cross-product join of all matching series.
AnswerB

Identical label sets on both sides give PromQL a one-to-one match by default, pairing each left-hand series with the right-hand series sharing the same labels. No on() or ignoring() clause is needed, so arithmetic between matching vectors works directly.

Why this answer

When both vectors in a PromQL arithmetic operation have identical label sets, PromQL performs a one-to-one match automatically — each series on the left is paired with the series on the right that has exactly the same labels. No 'on' or 'ignoring' modifier is needed because the default matching behavior already handles identical label sets. This is the foundation of operations like dividing a request-rate metric by a total-rate metric that share the same labels.

Exam trap

PCA often tests whether candidates know that PromQL's default one-to-one matching works automatically for identical label sets, and that errors only arise from many-to-many ambiguity — not from the absence of an 'on' modifier.

How to eliminate wrong answers

Option A is wrong because PromQL matches on the full label set (excluding __name__), not on metric names — metric names are actually dropped during matching unless preserved by a modifier. Option C is wrong because PromQL does not throw an error for identical label sets; it only errors when matching is ambiguous (many-to-one or many-to-many without a group modifier). Option D is wrong because a cross-product join is what happens when you explicitly use 'on()' with no labels or when label sets are disjoint — it is not the default behavior for identical label sets.

13
Multi-Selecthard

Which TWO of the following statements regarding native histograms in Prometheus are correct? (Choose TWO)

Select 2 answers
A.Native histograms require users to manually pre-define explicit bucket boundaries in application code.
B.The histogram_quantile() function can evaluate native histograms directly.
C.Native histograms store bucket distributions within a single time series sample.
D.Native histograms are incompatible with all rate-related PromQL functions.
E.Native histograms double the memory consumption of traditional counters.
AnswersB, C

Native histograms expose bucket counts through a sparse, structured sample format that histogram_quantile() parses natively, so quantile estimation works without the classic le-labelled bucket series. This satisfies the stem's requirement that the function evaluate native histograms directly.

Why this answer

Option B is correct because Prometheus's histogram_quantile() function natively supports native histograms, computing quantiles directly from the stored bucket distribution without needing the classic le-label bucket series. Option C is correct because native histograms encode the entire bucket distribution (counts across dynamically determined buckets) inside a single time series sample, rather than exposing one series per bucket as classic histograms do. Options A, D, and E are incorrect: native histograms use automatically configured, dynamic bucket boundaries so users do not pre-define explicit buckets; they work fine with rate-related PromQL functions like rate() and increase(); and they do not simply double memory consumption of counters, since their overhead depends on bucket count and schema resolution.

14
MCQhard

You need to perform a binary operation between two vectors where the left vector has labels {job="api", instance="a"} and the right vector has labels {job="api"}. You want to match them using the job label while retaining the instance label from the left side. Which modifier configuration is correct?

A.vector_a * on(instance) group_left(job) vector_b
B.vector_a * on(job) group_right(instance) vector_b
C.vector_a * on(job) group_left(instance) vector_b
D.vector_a * ignoring(instance) group_left vector_b
AnswerC

Using `on(job)` restricts matching to the `job` label, ignoring the differing `instance` label that would otherwise prevent a match. `group_left(instance)` then carries the left vector's `instance` label into the result, satisfying the requirement to retain it. This is the standard many-to-one matching configuration.

Why this answer

To match on a subset of labels while retaining extra labels on the left side during a one-to-many or many-to-one operation, group_left must be used with the on modifier.

15
Multi-Selecthard

When performing vector matching between two vectors of different cardinalities, which THREE vector matching modifiers can be used? (Choose three)

Select 3 answers
A.on
B.group_left
C.group_by
D.match_any
E.ignoring
AnswersA, B, E

The 'on' modifier restricts matching to the label sets you explicitly name, so only series sharing those listed labels pair up. This lets vectors of differing cardinality align on a chosen subset of dimensions rather than every shared label.

Why this answer

In PromQL, when performing binary operations between two instant vectors that have different label sets or cardinalities, the on modifier restricts matching to an explicitly specified set of labels, which is essential for one-to-one matching across differing label dimensions. The group_left modifier allows a many-to-one or one-to-many match by permitting the left vector to have multiple series matching a single series on the right, which is exactly how different cardinalities are reconciled. The ignoring modifier excludes specified labels from the matching process, enabling matches between vectors whose label sets differ by the ignored labels. group_by is not a valid PromQL vector matching modifier (it is not a keyword in binary operations), and match_any is not a PromQL modifier at all, so neither belongs here.

16
MCQeasy

A Prometheus selector includes a negative regex match for environment names: 'environment!="staging"'. Which selector operator achieves this using regular expressions instead of exact matching?

A.environment!~"staging"
B.environment!regex("staging")
C.environment!match("staging")
D.environment!="staging"
AnswerA

The `!~` operator applies a negative regular-expression match, so `environment!~"staging"` excludes any series whose environment label matches the regex "staging", satisfying the stem's requirement for regex-based negation rather than the exact-match `!=` operator. This mirrors the positive `=~` operator but inverts the match result.

Why this answer

The '!=' operator is for exact inequality, while '!~' is the negative regular expression match operator in PromQL.

17
Multi-Selecteasy

Which TWO of the following are valid data types returned by PromQL queries? (Choose two)

Select 2 answers
A.Histogram matrix
B.Range vector
C.Log stream
D.Instant vector
E.Distributed trace
AnswersB, D

A range vector returns a set of time series, each holding multiple data points sampled over a specified time window, such as `[5m]`. This satisfies the stem's requirement for a valid PromQL data type, distinct from the instant vector's single sample per series.

Why this answer

PromQL, the query language used by Prometheus, defines exactly four expression data types: instant vector, range vector, scalar, and string. Option B (Range vector) is correct because a range vector is a set of time series containing a range of data points over time for each series, produced by appending a duration selector like [5m] to a selector (e.g., http_requests_total[5m]). Option D (Instant vector) is correct because it is the most common PromQL result type: a set of time series containing a single sample for each series at a given timestamp, returned by expressions such as http_requests_total.

The unmarked options do not belong: 'Histogram matrix' (A) is not a PromQL type—histograms are exposed as instant or range vectors of bucket series, and 'matrix' is not a PromQL data type name; 'Log stream' (C) is a Loki concept, not PromQL; and 'Distributed trace' (E) is a tracing data type (e.g., from Tempo/Jaeger), not a PromQL return type.

18
MCQeasy

A user executes an instant query for a metric without providing a range vector. What type of vector is returned by default?

A.String
B.Range vector
C.Scalar
D.Instant vector
AnswerD

An instant query evaluates at a single timestamp, so PromQL returns an instant vector holding one sample per matching series. This satisfies the stem's default behaviour, since a range vector only appears when the selector explicitly supplies a duration such as [5m].

Why this answer

An instant vector evaluates to a single data point per time series at the current evaluation timestamp.

19
MCQhard

An engineer executes topk(3, http_requests_total). What happens if there are fewer than 3 time series matching the selector?

A.It returns all available time series without padding or error.
B.It pads the remaining slots with synthetic time series valued at 0.
C.It returns NaN for the missing slots.
D.It returns an evaluation error indicating insufficient time series.
AnswerA

topk is a selection, not a fixed-size generator. When fewer than three series match the selector, it simply returns every matching series, ranked by value, with no synthetic padding or error, satisfying the scenario where the selector yields fewer results than k.

Why this answer

If an instant vector has fewer elements than $k$, topk returns all available elements in the vector without error.

20
MCQmedium

You are using the 'predict_linear()' function to forecast disk space exhaustion based on the metric 'node_filesystem_free_bytes'. What type of input data does predict_linear require?

A.An instant vector representing current disk space.
B.A range vector of gauge values and a time duration scalar.
C.Two instant vectors joined via an 'on' clause.
D.A counter range vector wrapped in a rate() function.
AnswerB

predict_linear() extrapolates a gauge's rate of change, so it requires a range vector of gauge samples plus a scalar number of seconds to forecast ahead. A single instant sample gives no slope, so the range vector is the essential input for projecting disk exhaustion.

Why this answer

predict_linear() requires a range vector of gauge values (e.g., node_filesystem_free_bytes[1h]) and a scalar representing the number of seconds into the future to predict. It uses linear regression over the range to forecast the value at the future time.

Exam trap

PCA often tests the input types for predict_linear, and candidates may mistakenly think it requires an instant vector or a counter rate.

How to eliminate wrong answers

Option A is wrong because an instant vector only provides a single point in time, insufficient for linear regression. Option C is wrong because predict_linear does not join vectors; it operates on a single range vector. Option D is wrong because predict_linear is for gauges, not counters; using rate() on a counter would be inappropriate for disk space forecasting.

21
Multi-Selectmedium

Which TWO of the following are valid aggregation operators in PromQL?

Select 2 answers
A.sum
B.stddev
C.multiply
D.filter
E.rate
AnswersA, B

`sum` aggregates a vector's samples across matching label sets into a single instant vector, optionally grouped by labels via `by` or `without`. PromQL defines it as a core aggregation operator, so it satisfies the question's requirement for a valid operator.

Why this answer

In PromQL, aggregation operators combine the elements of a single instant vector into a new vector with fewer elements, and the valid set includes sum, min, max, avg, group, stddev, stdvar, count, count_values, bottomk, topk, and quantile. Option A (sum) is correct because sum is a core aggregation operator that adds the values of all series in the vector, optionally grouped by labels via by/without. Option B (stddev) is correct because stddev is a standard aggregation operator that computes the standard deviation across the grouped series.

Option C (multiply) is not an aggregation operator; arithmetic binary operators like * (multiply) operate between two instant vectors/scalars rather than aggregating one vector. Option D (filter) is not a PromQL operator at all; filtering is done through label matchers or functions like absent/unless-style logic, not a 'filter' keyword. Option E (rate) is a function, not an aggregation operator, used to calculate the per-second average rate of increase of a counter over a range vector.

22
MCQmedium

You are monitoring a counter metric 'errors_total' and need to calculate the total number of errors that occurred over the last 1 hour. Which function is most appropriate?

A.rate(errors_total[1h])
B.sum(errors_total[1h])
C.delta(errors_total[1h])
D.increase(errors_total[1h])
AnswerD

`increase()` extrapolates a counter's total growth across the specified 1h window, correctly handling counter resets and returning the actual number of errors that occurred. `rate()` would instead give a per-second average, and `delta()` cannot handle resets, so neither satisfies the requirement for a total count over the last hour.

Why this answer

The increase() function returns the total increase in the time series over the specified range vector, properly accounting for counter resets.

23
MCQhard

What is the behavior of the clamp_max() function when applied to an instant vector?

A.It drops any time series whose value exceeds the specified maximum.
B.It generates an alert if any time series exceeds the maximum.
C.It restricts all values in the vector so that none exceed the specified maximum.
D.It sets values exceeding the maximum to NaN.
AnswerC

clamp_max() caps each sample's value at the given maximum, leaving lower values untouched. Applied to an instant vector, it returns the same series with values above the threshold replaced by that maximum, satisfying the requirement to bound peaks rather than filter or drop them.

Why this answer

clamp_max(v, max) returns the input vector with every sample value capped at the specified maximum: values above max are replaced by max, while values at or below max pass through unchanged. It does not drop or flag series — it mutates the values in place. This is useful for capping spikes in graphs or enforcing upper bounds in derived metrics.

Exam trap

The trap is assuming clamp_max drops or nullifies out-of-range series — it actually replaces the value with the maximum, keeping the series intact.

How to eliminate wrong answers

Option A is wrong because clamp_max does not filter or drop series; it retains every series and only adjusts values that exceed the maximum. Option B is wrong because clamp_max is a pure transformation function with no alerting behavior — alerts are defined in alerting rules, not in PromQL functions. Option D is wrong because setting values to NaN is the behavior of functions like clamp_min with NaN handling or explicit NaN assignment, not clamp_max, which substitutes the max value itself.

24
MCQeasy

A Prometheus administrator wants to query the current value of the metric 'http_requests_total'. Which of the following PromQL expressions should be used?

A.http_requests_total[5m]
B.http_requests_total
C.rate(http_requests_total)
D.sum(http_requests_total) over (instance)
AnswerB

A bare metric selector returns the instant vector of current samples for http_requests_total at query evaluation time, which is exactly the current value requested. No rate or aggregation function is needed for a raw counter reading.

Why this answer

The expression `http_requests_total` is a valid PromQL instant vector selector that returns the current value of the metric at the evaluation timestamp. It does not require a range or function because the question asks for the current value, not a rate or aggregation. This is the simplest and correct way to query a single metric's latest sample.

Exam trap

PCA often tests the difference between instant and range vectors, and candidates frequently confuse the two by adding a time range when only the current value is needed.

How to eliminate wrong answers

Option A is wrong because `http_requests_total[5m]` is a range vector selector, which returns a matrix of samples over the last 5 minutes, not a single current value. Option C is wrong because `rate(http_requests_total)` expects a range vector and would produce a parse error; rate requires a range like `http_requests_total[5m]`. Option D is wrong because `sum(http_requests_total) over (instance)` is invalid PromQL syntax; aggregation operators do not use an `over` clause, and `sum` would aggregate across all instances, not return the raw current value.

25
MCQmedium

When should you use the 'absent()' function?

A.To alert when a metric has no data points in a given range.
B.To reset a counter.
C.To ignore null values in a calculation.
D.To handle missing labels in a join.
AnswerA

absent() returns a non-empty result when its input vector has no samples, letting alerting rules fire on missing data. This suits detecting a metric that has stopped reporting within a given range, which is exactly the scenario described.

Why this answer

absent() returns a time series if the input vector is empty, useful for alerting on missing metrics.

26
MCQmedium

When evaluating a PromQL query involving arithmetic operators, such as 'vector1 + vector2 * vector3', which operator has the highest precedence?

A.Both have equal precedence and are evaluated left-to-right.
B.+ (Addition)
C.* (Multiplication)
D.Precedence is determined by the order of labels.
AnswerC

Multiplication binds tighter than addition in PromQL, so in `vector1 + vector2 * vector3` the `*` operation is evaluated first, then the result is added to `vector1`. PromQL follows standard arithmetic precedence, giving `*` and `/` higher precedence than `+` and `-`, satisfying the stem's precedence constraint.

Why this answer

In PromQL, arithmetic operators follow standard mathematical precedence: multiplication (*), division (/), and modulo (%) bind tighter than addition (+) and subtraction (-). Therefore in 'vector1 + vector2 * vector3', the multiplication of vector2 and vector3 is evaluated first, and the result is then added to vector1. This mirrors conventional arithmetic rules rather than left-to-right evaluation.

Exam trap

The trap here is assuming PromQL evaluates strictly left-to-right like a simple calculator; candidates forget that * and / outrank + and - just as in standard arithmetic.

How to eliminate wrong answers

Option A is wrong because PromQL does not evaluate all arithmetic operators left-to-right — it applies precedence levels, so * is not equal to +. Option B is wrong because + has lower precedence than *, so it is not evaluated first. Option D is wrong because label ordering has no bearing on operator precedence; precedence is a fixed property of the operator type, not the data.

27
Multi-Selecteasy

Which TWO of the following label matching operators are supported in Prometheus label selectors? (Choose two)

Select 2 answers
A.= (exact equality)
B.=~ (regular expression match)
C.#= (wildcard match)
D.== (boolean equality comparison)
E.:= (assignment and match)
AnswersA, B

The = operator performs exact string equality against a label's value, matching only samples whose label equals the given string. It is one of Prometheus's core label matching operators, alongside !=, =~ and !~, satisfying the selector requirement.

Why this answer

Prometheus label selectors support the exact equality operator =, as in http_requests_total{job="api"}, which matches series whose label value is exactly the given string, so option A is correct. They also support the regular expression match operator =~, as in http_requests_total{job=~"api|web"}, which matches series whose label value matches the anchored RE2 regular expression, so option B is correct. The remaining operators are not part of PromQL selector syntax: #= is not a wildcard operator, == is a comparison operator used in expressions rather than label matching, and := is not a Prometheus label matching operator at all.

28
Multi-Selectmedium

Which THREE of the following modifiers or keywords are used in PromQL binary vector matching? (Choose THREE)

Select 3 answers
A.group_left
B.keep_matching
C.on
D.ignoring
E.group_by
AnswersA, C, D

`group_left` is a many-to-one vector matching modifier, permitting each right-hand sample to pair with multiple left-hand samples while retaining left-side labels. PromQL binary vector matching requires it, alongside `on`/`ignoring` and `group_right`, to resolve cardinality mismatches between operands, satisfying the stem's request for valid matching keywords.

Why this answer

In PromQL binary vector matching, the on keyword (option C) restricts matching to the listed labels, while ignoring (option D) excludes the listed labels from the default matching set; both are valid matching modifiers. The group_left keyword (option A) is a valid many-to-one grouping modifier used with on/ignoring to allow multiple series on the left side to match a single series on the right. The other options are not PromQL keywords: keep_matching (B) does not exist, and group_by (E) is not a binary vector matching modifier (grouping in PromQL uses by/without in aggregations, not group_by).

29
MCQhard

A Prometheus alert expression uses rate(http_requests_total[5m]) > 10. During a service restart, counter resets occur. How does the rate() function account for these counter resets?

A.It treats the negative difference as an error and returns 0 for the entire range.
B.It adds a fixed offset value configured in Prometheus global settings.
C.It assumes the counter reset to zero and adds the new value to the previous value.
D.It drops the samples surrounding the reset, resulting in a null value for that evaluation.
AnswerC

Prometheus rate() detects a decrease between samples and treats it as a counter reset, assuming the counter restarted at zero. It then adds the post-reset value to the pre-reset value, so the restart's lost increments are not counted as a negative rate, preserving an accurate request rate.

Why this answer

The rate() function automatically detects decreases in counter values (resets) and adjusts the calculation assuming the counter restarted at zero.

30
Multi-Selectmedium

Which THREE aggregation operators in PromQL support the 'by' and 'without' clause modifiers? (Choose three)

Select 3 answers
A.sum
B.histogram_quantile
C.avg
D.label_replace
E.count
AnswersA, C, E

`sum` aggregates sample values across matching series, and both `by` and `without` modifiers are valid for it, letting you group results by specified labels or strip them from the output. This satisfies the stem's requirement for operators supporting both clause modifiers.

Why this answer

The three correct answers are A (sum), C (avg), and E (count). These are all PromQL aggregation operators, and every aggregation operator in PromQL — including sum, avg, count, min, max, stddev, stdvar, topk, bottomk, quantile, count_values, and group — accepts the by and without clause modifiers to control how the input vector is grouped before aggregation. For example, sum by (job) (http_requests_total) aggregates per job, while sum without (instance) (http_requests_total) aggregates across all labels except instance.

Option B (histogram_quantile) is a function, not an aggregation operator, and it does not take by/without clauses; it operates on buckets produced by an aggregation such as sum by (le) (rate(...)). Option D (label_replace) is a label-manipulation function that rewrites label values and likewise does not support by/without grouping modifiers.

31
MCQeasy

Which PromQL function is specifically designed to calculate the per-second average rate of increase of a time series over a given range vector?

A.deriv()
B.irate()
C.increase()
D.rate()
AnswerD

rate() computes the per-second average rate of increase of a counter time series across the range vector, handling counter resets automatically. This satisfies the constraint of calculating per-second average increase, unlike irate() which uses only the last two samples.

Why this answer

The rate() function in PromQL is specifically designed to calculate the per-second average rate of increase of a time series over a given range vector. It takes a range vector (e.g., http_requests_total[5m]) and returns the average per-second growth rate, handling counter resets automatically. This is the canonical function for computing rates of counters.

Exam trap

PCA often tests the confusion between rate(), irate(), and increase() — candidates may pick increase() thinking it gives a per-second rate, but it returns the total increase over the range.

How to eliminate wrong answers

Option A is wrong because deriv() calculates the per-second derivative of a gauge, not the rate of increase of a counter — it is used for gauges. Option B is wrong because irate() calculates the instantaneous rate based on the last two samples, not the average over the whole range. Option C is wrong because increase() returns the total increase over the range, not the per-second rate — it is essentially rate() multiplied by the range duration in seconds.

32
MCQhard

When using 'irate', what is the impact of choosing a range vector that is too small (e.g., [10s])?

A.It captures high-frequency spikes but can be volatile.
B.It returns an error if no data points are found.
C.The result becomes a scalar.
D.The value is capped at 1.
AnswerA

A short range vector such as [10s] samples only the last two scrape points, so irate divides the freshest delta by that tiny interval. This captures high-frequency spikes but produces volatile, noisy results, satisfying the stem's stated impact of an undersized range.

Why this answer

Using a very small range vector with irate, such as [10s], means irate calculates the per-second rate based on only the last two data points within that short window. This can capture rapid changes but makes the result highly sensitive to scrape timing and outliers, leading to volatile output.

Exam trap

PCA often tests the trade-off between sensitivity and volatility when using irate with small ranges, and candidates may incorrectly assume it errors or caps values.

How to eliminate wrong answers

Option B is wrong because irate does not return an error if no data points are found; it simply returns no data for that timestamp. Option C is wrong because irate returns an instant vector, not a scalar. Option D is wrong because the value is not capped at 1; irate can return any positive value.

33
MCQhard

When evaluating a rule with offset, such as http_requests_total offset 1h, what exact time does Prometheus query?

A.It fetches data starting 1 hour in the future.
B.It calculates the moving average over the past 1 hour.
C.It delays rule evaluation by 1 hour to wait for late-arriving data.
D.It evaluates the query at the evaluation timestamp minus 1 hour.
AnswerD

The offset modifier shifts the entire query evaluation back by the specified duration, so `http_requests_total offset 1h` returns the sample value as it existed exactly one hour before the current evaluation timestamp. This satisfies the stem's requirement for the precise time Prometheus queries when an offset is applied.

Why this answer

The offset modifier shifts the evaluation time backward by the specified duration relative to the evaluation timestamp.

34
Multi-Selectmedium

Which TWO of the following are valid ways to modify or add labels to time series in PromQL? (Choose two)

Select 2 answers
A.label_replace()
B.label_join()
C.label_update()
D.label_drop()
E.label_add()
AnswersA, B

label_replace() rewrites labels on time series using a regex with capture groups, letting you add or modify a destination label from a source label. It operates within PromQL queries, satisfying the requirement for a valid PromQL label-modification method.

Why this answer

label_replace() (A) is a valid PromQL function that creates or modifies a label on each time series by matching a regex against a source label and writing a replacement value into a destination label, so it can both add and modify labels. label_join() (B) is also a valid PromQL function that concatenates values from multiple source labels into a single destination label, effectively adding or overwriting that label on each series. The remaining options are not real PromQL functions: label_update() (C), label_drop() (D), and label_add() (E) do not exist in the PromQL function set, so they cannot be used to modify or add labels.

Exam trap

The trap is that candidates assume PromQL has a full set of label verbs like 'label_add'/'label_drop'/'label_update' — in reality only 'label_replace()' and 'label_join()' exist, and everything else must be composed from them or from aggregation modifiers.

35
MCQhard

You want to find the maximum value of a gauge metric across all instances over a 1-hour sliding window. Which function accomplishes this?

A.max(node_memory_usage_bytes[1h])
B.max_over_time(node_memory_usage_bytes[1h])
C.topk(1, node_memory_usage_bytes[1h])
D.max_with_range(node_memory_usage_bytes, 1h)
AnswerB

max_over_time evaluates the range vector over the trailing one-hour window and returns the highest sample per series, giving the peak gauge value across all instances. The [1h] duration supplies the sliding window the stem specifies.

Why this answer

The max_over_time() function evaluates the maximum value of all data points in a specified range vector for each time series.

36
MCQmedium

An administrator wants to aggregate CPU usage across all nodes, keeping the instance label while summing the values. Which aggregation clause should be used?

A.sum(node_cpu_seconds_total) keeping (instance)
B.sum by (instance) (node_cpu_seconds_total)
C.sum(node_cpu_seconds_total) group by (instance)
D.sum without (instance) (node_cpu_seconds_total)
AnswerB

The by (instance) modifier groups series by the instance label and sums each group's CPU counters, retaining instance while collapsing other labels such as cpu and mode. This satisfies the stem's requirement to aggregate across nodes yet keep instance.

Why this answer

The by clause specifies the labels that should be preserved in the aggregated result vector.

37
MCQmedium

You want to find the top 3 jobs with the highest CPU usage using the metric 'process_cpu_seconds_total'. Which PromQL query structure is correct?

A.topk(3, rate(process_cpu_seconds_total[5m]))
B.bottomk(3, rate(process_cpu_seconds_total[5m]))
C.topk(3, process_cpu_seconds_total[5m])
D.topk(rate(process_cpu_seconds_total[5m]), 3)
AnswerA

topk(3, ...) returns the three series with the highest instantaneous values, and wrapping rate() over the 5m range converts the cumulative counter process_cpu_seconds_total into a per-second CPU usage rate, satisfying the requirement to rank jobs by CPU consumption.

Why this answer

The correct PromQL structure is topk(3, rate(process_cpu_seconds_total[5m])). topk takes the instant-vector result of rate() over a 5-minute range vector and returns the 3 series with the highest values. The rate() function is required because process_cpu_seconds_total is a counter, and raw counter values would rank by total lifetime CPU rather than current usage.

Exam trap

PCA often tests whether candidates remember that topk requires an instant vector (so counters must be wrapped in rate()) and that the k argument comes first — reversing the arguments or passing a range vector are the classic wrong-answer traps.

How to eliminate wrong answers

Option B is wrong because bottomk returns the 3 lowest values, which is the opposite of what 'highest CPU usage' requires. Option C is wrong because process_cpu_seconds_total[5m] is a range vector, and topk requires an instant vector — passing a range vector directly causes a parse/type error, and it also fails to convert the counter to a rate. Option D is wrong because the argument order is reversed: topk's signature is topk(k, instant_vector), so topk(rate(...), 3) is invalid syntax.

38
MCQmedium

When evaluating a histogram metric, what does the special pseudo-label le represent in bucket time series?

A.The upper bound of the cumulative histogram bucket.
B.The linear extrapolation factor for summary metrics.
C.The logging event identifier for tracing.
D.The exact latency error margin of the measurement.
AnswerA

The `le` pseudo-label means "less than or equal to", recording each bucket's inclusive upper bound. This satisfies the stem's constraint by exposing the cumulative count of observations falling at or below that threshold, letting you compute per-bucket counts by subtracting adjacent series.

Why this answer

The le (less than or equal to) label represents the upper bound of a histogram bucket.

39
MCQmedium

Which aggregation operator would you use to calculate the total sum of a metric across all instances?

A.sum()
B.avg_over_time()
C.total()
D.count()
AnswerA

`sum()` aggregates a metric's samples across every matched instance into a single total, satisfying the requirement to calculate the overall sum. Unlike `avg()`, which divides by sample count, or `max()`/`min()`, which select extremes, `sum()` adds each instance's contribution, yielding the combined total across all instances.

Why this answer

The sum() aggregation operator in PromQL takes an instant vector and aggregates all matching time series into a single value by summing their current sample values. When applied across all instances of a metric (e.g., sum(node_cpu_seconds_total)), it produces the total across every series returned by the selector. This is exactly the semantics needed to compute a fleet-wide total of a metric.

Exam trap

The trap here is confusing aggregation operators (sum, count) with range functions (avg_over_time, rate) — candidates who see 'over all instances' may reflexively pick avg_over_time() because it sounds like it spans instances, when it actually spans time within one series.

How to eliminate wrong answers

Option B is wrong because avg_over_time() is a range-vector function that computes the average of a single time series over a time window, not an aggregation across multiple series. Option C is wrong because total() is not a valid PromQL operator — it does not exist in the language. Option D is wrong because count() counts the number of time series in the vector rather than summing their values, so it returns a cardinality, not a total.

40
MCQeasy

What is the purpose of the 'offset' modifier in a PromQL query?

A.To remove specific label dimensions.
B.To filter out noise from the last 5 minutes.
C.To change the time range of a query to a point in the past.
D.To increase the precision of a rate calculation.
AnswerC

The offset modifier shifts the evaluation instant backwards by the given duration, so errors_total offset 1h returns the value from one hour ago. This satisfies the scenario's requirement to query a point in the past.

Why this answer

The 'offset' modifier allows querying data from the past relative to the current time.

41
MCQeasy

Which PromQL aggregator should be used to count the total number of active time series matching a selector?

A.count(up)
B.sum(up)
C.len(up)
D.total(up)
AnswerA

count() is the aggregation operator that returns the number of series in each group, so count(up) yields the total active series matching the selector. sum() would add sample values instead of counting series, which does not satisfy the requirement.

Why this answer

The count operator counts the number of time series in an instant vector.

42
MCQmedium

When writing a PromQL query involving a vector and a scalar, such as 'node_memory_free_bytes / (1024 * 1024)', how does Prometheus handle label matching?

A.The scalar operation is applied to every time series value in the vector independently, preserving all labels.
B.The operation is only applied to the first time series returned by the vector selector.
C.The scalar is matched against labels of the vector using exact label equality.
D.The query fails because scalars cannot be combined with vectors without an explicit 'on' clause.
AnswerA

Scalars carry no labels, so arithmetic between a vector and scalar applies element-wise to every sample, leaving the vector's label set untouched. This satisfies the stem's requirement that dividing by `(1024 * 1024)` converts bytes to mebibytes without dropping or altering any series identity.

Why this answer

Operations between an instant vector and a scalar are performed on each data point of the vector. Labels are unaffected.

43
Multi-Selectmedium

Which TWO of the following are true regarding instant vectors?

Select 2 answers
A.They contain at most one sample per time series.
B.They do not support label filtering.
C.They contain data over a time range.
D.They can be passed directly to the rate() function.
E.They are the default result of a simple selector.
AnswersA, E

An instant vector holds one sample per time series at a single evaluation timestamp, unlike a range vector which holds many samples per series. This single-sample-per-series structure is the defining property that makes instant vectors suitable for instant queries and comparisons.

Why this answer

Option A is correct because an instant vector holds exactly one sample per time series at a single evaluation timestamp, which is the defining characteristic of an instant vector in PromQL. Option E is correct because a simple selector such as `http_requests_total` returns an instant vector by default, giving the most recent sample for each matching series at the evaluation time. Option B is wrong because instant vectors fully support label filtering through selectors and matchers like `{job="api"}`.

Option C is wrong because data over a time range describes a range vector, not an instant vector. Option D is wrong because `rate()` requires a range vector as its argument, not an instant vector.

44
MCQmedium

You need to calculate the per-second rate of increase for a counter metric over the last 10 minutes. Which function is most appropriate?

A.rate(metric[10m])
B.increase(metric[10m])
C.irate(metric[10m])
D.delta(metric[10m])
AnswerA

rate() computes the per-second average rate of increase of a counter over the given range, handling counter resets and extrapolation at the range boundaries. The 10m range selector supplies the required window, yielding a per-second figure rather than a raw increase.

Why this answer

rate() is the standard function for calculating the per-second rate of increase over a range vector.

45
MCQeasy

Which selector syntax correctly matches all time series where the environment label does NOT equal production?

A.http_requests_total{environment=~"^((?!production).)*$"}
B.http_requests_total{environment!="production"}
C.http_requests_total{environment!~"production"}
D.http_requests_total{environment!^"production"}
AnswerB

The != operator is Prometheus's label matcher for inequality, so environment!="production" selects every time series of http_requests_total whose environment label holds any value other than production. This satisfies the stem's requirement to exclude production while retaining all other environments.

Why this answer

The != operator is the standard negative equality matcher in PromQL label selectors.

46
Multi-Selectmedium

Which THREE of the following functions are specifically designed to be used with range vectors? (Choose THREE)

Select 3 answers
A.delta
B.abs
C.rate
D.sum
E.increase
AnswersA, C, E

Delta computes the difference between a sample and its predecessor, so it requires a range vector to supply that historical window; instant vectors hold only one value per series and cannot feed it. This satisfies the stem's requirement for functions designed specifically around range vectors.

Why this answer

delta (A) is designed for range vectors because it computes the difference between the first and last sample values in each time series over the range, which is meaningful only when a range vector is supplied. rate (C) is also range-vector specific: it calculates the per-second average rate of increase of a counter over the range window, requiring multiple samples from a range vector. increase (E) likewise operates on range vectors, returning the total increase of a counter over the given range by extrapolating from the samples within that window. In contrast, abs (B) is a simple instant-vector function that returns the absolute value of each sample and does not need a range, while sum (D) is an aggregation operator that reduces an instant vector across labels and is not tied to range-vector semantics.

Exam trap

PCA often tests whether candidates can distinguish range-vector functions (rate, increase, delta, irate, idelta) from instant-vector functions (abs, ceil, floor) and aggregation operators (sum, avg, topk) — the trap is picking a math or aggregation function that sounds like it operates over time.

47
Multi-Selecteasy

Which TWO of the following are valid metric types natively supported by Prometheus? (Choose TWO)

Select 2 answers
A.Matrix
B.Gauge
C.Counter
D.Vector
E.Scalar
AnswersB, C

Gauge is one of Prometheus's four native metric types, representing a value that can rise or fall arbitrarily, such as temperature or memory usage. It is exposed through client libraries and stored directly in the time series database.

Why this answer

Prometheus natively supports four core metric types: Counter, Gauge, Histogram, and Summary. Option B (Gauge) is correct because a gauge represents a single numerical value that can arbitrarily go up and down, such as current memory usage or temperature. Option C (Counter) is correct because a counter is a cumulative metric that only increases (or resets to zero on restart), such as the total number of HTTP requests served.

The other options are not valid Prometheus metric types: Matrix, Vector, and Scalar are PromQL data types (instant vector, range vector, scalar, string) used in query expressions, not metric types exposed by instrumented targets.

48
MCQeasy

How does PromQL handle operator precedence between arithmetic operators like multiplication (*) and addition (+)?

A.Operators are evaluated strictly from left to right regardless of type.
B.Operators are evaluated strictly from right to left.
C.Multiplication has higher precedence than addition.
D.Addition has higher precedence than multiplication.
AnswerC

PromQL follows standard arithmetic precedence, so multiplication and division bind more tightly than addition and subtraction. Thus in an expression mixing * and +, the multiplication is evaluated first, matching conventional mathematical ordering rather than strict left-to-right evaluation.

Why this answer

PromQL follows standard mathematical order of operations, where multiplication and division take precedence over addition and subtraction.

49
Multi-Selectmedium

Which THREE of the following are valid aggregation operators in PromQL? (Choose THREE)

Select 3 answers
A.median
B.average
C.stddev
D.sum
E.topk
AnswersC, D, E

stddev is a valid PromQL aggregation operator, computing the standard deviation across the grouped sample values. It accepts a by or without clause and operates over an instant vector, matching the aggregation requirement in the stem.

Why this answer

In PromQL, the aggregation operators are applied with syntax like <aggr-op>([parameter,] <vector expression>) [without|by (...)], and the valid set includes stddev, sum, and topk. Option C (stddev) is correct because stddev is a built-in aggregation operator that computes the standard deviation across the aggregated time series. Option D (sum) is correct because sum is a core aggregation operator that adds the values of all matched series.

Option E (topk) is correct because topk is a parameterized aggregation operator that returns the k series with the highest values. Options A (median) and B (average) are not valid PromQL aggregation operators; the average is expressed as sum(...) / count(...), and median is not provided as an aggregation operator in PromQL.

50
MCQeasy

Which regular expression matcher selects all time series where the status label begins with the digit 5?

A.http_requests_total{status=@"5*"}
B.http_requests_total{status=~"^5.*"}
C.http_requests_total{status=^"5"}
D.http_requests_total{status=~"5$"}
AnswerB

The =~ operator applies RE2 regular expression matching, and the anchored pattern ^5.* requires the status label value to begin with the digit 5, matching any trailing characters. This selects exactly the time series whose status starts with 5.

Why this answer

The =~ operator combined with a regular expression starting with ^5 matches labels beginning with 5.

51
Multi-Selectmedium

Which TWO of the following statements about 'rate' vs 'irate' are correct?

Select 2 answers
A.irate() returns the average over the whole window.
B.rate() is better for alerting on slow-moving counters.
C.irate() is better for long-term trends.
D.irate() calculates the rate based on the last two points.
E.rate() only works on gauges.
AnswersB, D

Rate() suits alerting on slow-moving counters because it extrapolates across the full lookback window, producing a stable per-second average even when few samples exist. Irate() uses only the last two raw samples, so sparse counters yield erratic, spiky values that trigger false alerts. This satisfies the stem's slow-moving constraint.

Why this answer

Option B is correct because rate() averages the per-second increase across the entire range window, which smooths out short-lived spikes and counter resets, making it more suitable for alerting on slow-moving counters where a stable, representative value is desired. Option D is correct because irate() computes the instantaneous per-second rate using only the last two samples within the range vector, which makes it highly responsive to recent changes. Options A and C are incorrect because they swap the behaviors: irate() does not average over the whole window (that is rate()), and irate()'s volatility makes it poorly suited for long-term trend analysis, for which rate() is preferred.

Option E is incorrect because rate() is designed for counters, not gauges; applying it to gauges produces meaningless results since gauges can decrease arbitrarily.

Exam trap

PCA often tests the confusion between rate() and irate() — candidates mistakenly believe irate() averages over the window or that rate() works on gauges, when the opposite is true.

52
MCQhard

How does Prometheus handle subqueries embedded within an instant query, such as rate(http_requests_total[5m])[30m:1m]?

A.It caches the inner query results in memory for 30 minutes.
B.It increases the global scrape interval to 1 minute for the next 30 minutes.
C.It runs the inner instant query at multiple evaluation timestamps over the specified range at the given resolution, returning a range vector.
D.It converts the range vector into a scalar through statistical interpolation.
AnswerC

Prometheus evaluates the inner expression independently at each step across the 30-minute window, spaced at the 1-minute resolution, producing a range vector. This satisfies the subquery's requirement to apply an instant-vector function over time, which a plain range selector cannot do.

Why this answer

Prometheus evaluates subqueries by running the inner instant query at each step of the outer range, using the specified resolution (1m) and range (30m). This produces a range vector that can then be used by outer functions like rate(). The subquery syntax [30m:1m] means evaluate the inner expression over the last 30 minutes at 1-minute intervals.

Exam trap

PCA often tests the misconception that subqueries cache results or modify scrape intervals, when in fact they simply perform multiple evaluations of the inner query.

How to eliminate wrong answers

Option A is wrong because Prometheus does not cache subquery results in memory; it evaluates them on the fly. Option B is wrong because subqueries do not alter the global scrape interval; scrape intervals are configured per job. Option D is wrong because subqueries return a range vector, not a scalar; no statistical interpolation is performed.

53
Multi-Selecthard

Which THREE built-in functions in PromQL are designed specifically to analyze changes over time for gauge metrics? (Choose three)

Select 3 answers
A.delta()
B.rate()
C.deriv()
D.increase()
E.predict_linear()
AnswersA, C, E

delta() computes the difference between the first and last sample values within a range vector, showing absolute change for a gauge over the window. It satisfies the stem's requirement for a function analysing gauge changes over time.

Why this answer

delta() is correct because it computes the difference between the first and last sample values of a gauge over a specified range, directly measuring change over time. deriv() is correct because it calculates the per-second derivative of a gauge using simple linear regression, quantifying the rate of change of the gauge's value. predict_linear() is correct because it applies linear regression over a gauge's range to extrapolate future values, which is inherently a time-based change analysis for gauges. rate() and increase() are not correct here because they are designed for counters, not gauges — rate() computes the per-second average rate of increase of a counter, and increase() computes the total counter increase over a range, both of which assume monotonically increasing counter semantics.

54
Multi-Selecthard

Which TWO of the following statements regarding PromQL subqueries are correct? (Choose two)

Select 2 answers
A.Subqueries execute faster than standard instant queries because they bypass the storage engine.
B.Subqueries allow instant vector queries to be passed as range vector inputs to functions like max_over_time().
C.Subqueries have syntax in the form 'expression[range:resolution]'.
D.Subqueries can only be executed against range vectors, never instant vectors.
E.The resolution parameter in a subquery is mandatory.
AnswersB, C

Subqueries bridge the gap between instant and range vectors: wrapping an instant vector expression in brackets with a range gives functions like max_over_time() the range vector input they require, which a bare instant vector cannot supply.

Why this answer

Option B is correct because a PromQL subquery wraps an instant vector expression and evaluates it over a time range, producing a range vector that can be fed into range-vector functions such as max_over_time(), avg_over_time(), or rate(). Option C is correct because the subquery syntax is exactly <instant_query>[<range>:<resolution>], for example max_over_time(rate(http_requests_total[5m])[1h:1m]). Option A is wrong because subqueries do not bypass the storage engine; they still query TSDB data and typically add overhead by evaluating the inner expression at each resolution step.

Option D is wrong because subqueries operate on instant vector expressions (the inner expression must return an instant vector), not exclusively on range vectors. Option E is wrong because the resolution parameter is optional; when omitted, Prometheus uses the global evaluation_interval as the default step.

55
MCQeasy

Which function would you use to find the maximum value of a gauge metric 'node_cpu_load' over the past 30 minutes?

A.rate(node_cpu_load[30m])
B.max(node_cpu_load[30m])
C.topk(1, node_cpu_load[30m])
D.max_over_time(node_cpu_load[30m])
AnswerD

`max_over_time` is the correct range-vector function here: it evaluates each time series returned by `node_cpu_load` across the 30-minute window and returns the highest sample value, satisfying the "maximum over the past 30 minutes" constraint. `max()` instead aggregates across series at a single instant, not over time.

Why this answer

The max_over_time() function calculates the maximum value of all data points in the specified range vector for each time series.

56
MCQmedium

You need to calculate the 99th percentile HTTP request latency from a Prometheus histogram named http_request_duration_seconds. Which function is correct?

A.rate(histogram_quantile(0.99, http_request_duration_seconds_bucket)[5m])
B.quantile_over_time(0.99, http_request_duration_seconds[5m])
C.histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))
D.histogram_quantile(http_request_duration_seconds_bucket[5m], 0.99)
AnswerC

histogram_quantile() estimates the 0.99 quantile from the le bucket series, and rate() over the 5m range converts cumulative bucket counters into per-second rates. This satisfies the constraint of computing the 99th percentile latency from a histogram rather than a summary.

Why this answer

The correct PromQL expression is histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])). This computes the 99th percentile by first calculating the per-second rate of increase of each bucket over a 5-minute window, then applying histogram_quantile to interpolate the quantile from the bucket boundaries. The rate function is essential to convert cumulative counters into a rate suitable for quantile estimation.

Exam trap

The trap is forgetting to apply rate() to the bucket counters or misordering arguments; candidates often confuse histogram_quantile with quantile_over_time or place rate incorrectly.

How to eliminate wrong answers

Option A is wrong because it nests histogram_quantile inside rate, which is invalid: rate expects a range vector of counters, not a scalar quantile result. Option B is wrong because quantile_over_time operates on raw time series values (e.g., gauges) and does not correctly handle histogram buckets; it would compute a quantile of bucket counts, not of the observed latency distribution. Option D is wrong because the arguments to histogram_quantile are reversed (it expects the quantile first, then the bucket rate vector) and it lacks the rate function, so it would operate on cumulative counts, yielding incorrect results.

57
MCQeasy

What is the purpose of the instant vector selector syntax http_requests_total{job="api-server"}?

A.It aggregates all API server requests into a single sum.
B.It triggers an alert if the job is down.
C.It selects historical data points spanning the last hour for the matching series.
D.It selects current values of time series matching the metric name and label filter.
AnswerD

An instant vector selector returns one sample per matching series at the evaluation timestamp, filtered by metric name and label matchers such as job="api-server". It does not range over time or aggregate; it yields current values for the selected series.

Why this answer

The instant vector selector http_requests_total{job="api-server"} returns the most recent sample value for every time series whose metric name is http_requests_total and whose job label equals 'api-server'. It is evaluated at a single point in time (the query evaluation timestamp), producing one value per matching series rather than a range of samples. This is the fundamental building block for PromQL queries that feed into functions like rate(), sum(), or comparison operators.

Exam trap

The trap here is confusing instant vector selectors with range vector selectors — candidates see a label filter and assume it queries historical data, but the absence of a [duration] suffix means it returns only the latest sample per series.

How to eliminate wrong answers

Option A is wrong because an instant vector selector performs no aggregation — it returns one element per matching series, and aggregation requires an explicit function such as sum() or avg(). Option B is wrong because alerting is handled by alerting rules (with for/expr clauses) evaluated by the Alertmanager pipeline, not by a selector expression itself. Option C is wrong because selecting historical data over a time window requires a range vector selector with a duration suffix, e.g. http_requests_total{job="api-server"}[1h], not the bare instant selector.

58
MCQmedium

Which function is best suited for identifying the 'top 5' instances with the highest value for a specific metric?

A.sort_desc()
B.max_over_time()
C.topk(5, metric)
D.limit_rate(5, metric)
AnswerC

topk is an aggregation operator that returns the k time series with the highest instantaneous values for the given metric, sorted descending. It directly satisfies the 'top 5' ranking constraint, unlike sum, avg or count, which aggregate across series rather than selecting individual ones.

Why this answer

topk(5, metric) is the PromQL aggregation operator that returns the 5 time series with the highest instantaneous values for the given metric, which is exactly what is needed to identify the top 5 instances. It operates as an aggregation over the sample set at each evaluation step, preserving the labels of the winning series so you can see which instance is which. This is the canonical way to build 'top N' dashboards or alerts in Prometheus.

Exam trap

The trap is assuming sort_desc() alone gives you a 'top 5' — it sorts but does not limit, so candidates who forget the k-limiting behavior of topk pick the wrong operator.

How to eliminate wrong answers

Option A is wrong because sort_desc() only orders the full result set in descending order — it does not limit the output to a fixed number of series, so you would still get every instance, just sorted. Option B is wrong because max_over_time() returns the maximum value of a single series over a time range, not a cross-series ranking, so it cannot identify which instances are the top 5. Option D is wrong because limit_rate() is not a PromQL function at all; it is a fabricated name that confuses rate-limiting concepts with query aggregation.

59
MCQeasy

Which operator has higher precedence in PromQL: exponential (^), multiplication (*), or addition (+)?

A.Addition (+)
B.All arithmetic operators share equal precedence.
C.Multiplication (*)
D.Exponentiation (^)
AnswerD

Exponentiation binds tighter than multiplication and addition, so PromQL evaluates `^` first, then `*`, then `+`, matching standard mathematical precedence. This satisfies the stem's requirement to identify the highest-precedence operator among the three, since `^` outranks both `*` and `+` in every expression.

Why this answer

Exponentiation has the highest precedence in PromQL, followed by multiplication/division, and then addition/subtraction.

60
MCQhard

An operator needs to find the rate of change of a counter using deriv(). Why is this considered a bad practice in Prometheus?

A.deriv() does not account for counter resets, causing massive negative drops when counters reset.
B.deriv() automatically multiplies output by an undocumented scaling factor.
C.deriv() requires native histograms, which are incompatible with standard counters.
D.deriv() only works with scalar values and rejects time series vectors.
AnswerA

deriv() fits a linear regression over the range, treating values as ordinary numbers. When a counter resets to zero, that drop is read as a genuine negative slope, yielding large negative rates instead of the reset-corrected increase rate() provides.

Why this answer

deriv() is designed for linear regression on gauge metrics over range vectors and does not handle counter resets, leading to incorrect downward spikes when counters reset.

61
MCQmedium

Which operator has the highest precedence in PromQL?

A.Logical OR (or)
B.Addition (+)
C.Equality (==)
D.Exponentiation (^)
AnswerD

Exponentiation (^) binds tighter than multiplication, division, addition and subtraction, and also tighter than comparison and logical operators, so it evaluates first in any PromQL expression. This right-associative operator sits at the top of the precedence table.

Why this answer

In PromQL, the exponentiation operator (^) has the highest precedence among binary operators, higher than multiplicative, additive, comparison, and logical operators. This means expressions like 2 ^ 3 * 4 are parsed as (2 ^ 3) * 4. Knowing precedence is essential for writing correct PromQL without excessive parentheses.

Exam trap

The trap is assuming arithmetic operators share a single precedence tier — candidates often pick addition or equality, forgetting that exponentiation sits above all other binary operators in PromQL.

How to eliminate wrong answers

Option A is wrong because logical OR (or) has the lowest precedence, evaluated after comparison and arithmetic operators. Option B is wrong because addition (+) sits in the additive tier, below multiplication/division and far below exponentiation. Option C is wrong because equality (==) is a comparison operator with lower precedence than arithmetic operators including exponentiation.

62
MCQeasy

What is the result of applying a range selector like [5m] to a gauge metric?

A.A scalar value representing the sum.
B.A range vector containing all data points from the last 5 minutes.
C.An instant vector of the average over 5 minutes.
D.An error, because gauges are not time-series.
AnswerB

A range selector returns a range vector: every sample value with its timestamp falling inside the specified window, rather than a single instant value. Applying [5m] to a gauge therefore yields all points from the preceding five minutes.

Why this answer

Applying a range selector like [5m] to a gauge metric in PromQL returns a range vector containing all samples for that metric over the last 5 minutes. Range vectors are the input required by functions like rate(), increase(), and avg_over_time(). The selector does not aggregate or reduce the data — it simply collects the time series samples in the window.

Exam trap

The trap is confusing range vectors with instant vectors or scalars — candidates pick 'average over 5 minutes' because they mentally apply an aggregation that the selector itself does not perform.

How to eliminate wrong answers

Option A is wrong because a range selector does not produce a scalar sum; aggregation functions like sum() would be needed, and even then the result is an instant vector, not a scalar. Option C is wrong because an instant vector of the average requires an explicit aggregation function such as avg_over_time(metric[5m]), not just the range selector. Option D is wrong because gauges are absolutely time-series data in Prometheus — the range selector works on any metric type, including gauges, counters, and histograms.

63
MCQmedium

When performing a vector-to-vector binary operation between two instant vectors of different label sets, which modifier allows matching on a subset of common labels?

A.group_left(...)
B.ignoring(...)
C.matching(...)
D.on(...)
AnswerD

The `on(...)` modifier restricts matching to the labels you list, so vectors with differing label sets still pair up on that shared subset. Without it, Prometheus requires identical label sets for vector-to-vector binary operations, returning no results. This directly satisfies the stem's constraint of matching on common labels only.

Why this answer

The 'on(...)' modifier in PromQL allows vector-to-vector binary operations to match on a specified subset of labels, ignoring all other labels. When two instant vectors have different label sets, 'on(label1, label2)' restricts matching to only those labels, enabling the operation to proceed. This is the correct modifier for matching on a subset of common labels.

Exam trap

PCA often tests the difference between 'on' and 'ignoring' — candidates may pick 'ignoring' thinking it matches on a subset, but it actually excludes labels, while 'on' explicitly selects the matching labels.

How to eliminate wrong answers

Option A is wrong because group_left(...) is used for many-to-one matching, not for specifying a subset of labels to match on — it is a grouping modifier, not a matching modifier. Option B is wrong because ignoring(...) excludes specified labels from matching, which is the opposite of matching on a subset. Option C is wrong because 'matching(...)' is not a valid PromQL keyword — the correct keywords are 'on' and 'ignoring'.

64
Multi-Selecthard

Which THREE of the following are valid label matchers?

Select 3 answers
A.>>
B.==
C.!~
D.=~
E.!=
AnswersC, D, E

The `!~` operator is a valid PromQL label matcher, selecting time series whose label value does not match a given regular expression. It satisfies the stem's requirement by providing the negated regex-matching axis, complementing `=~`, `!=` and `=` as the fourth supported matcher type.

Why this answer

In Prometheus-style label matching, the valid matchers are = (equality), != (inequality), =~ (regex match), and !~ (negative regex match), so C (!~), D (=~), and E (!=) are all correct. C (!~) is right because it selects series whose label value does not match the given regular expression, e.g. job!~"api.*". D (=~) is right because it selects series whose label value matches the regular expression, e.g. job=~"api.*".

E (!=) is right because it selects series whose label value differs from the given string, e.g. job!="api". Options A (>>) and B (==) are not valid matchers: >> is not a PromQL label operator at all, and == is a comparison operator used in expressions, not a label matcher.

65
MCQhard

When executing a subquery in PromQL, such as 'max_over_time(rate(http_request_total[5m])[30m:1m])', what does the resolution parameter ('1m') specify?

A.The smoothing factor applied to eliminate high-frequency noise.
B.The time-to-live for cached subquery results in Prometheus storage.
C.The evaluation step size at which the inner expression is run across the subquery window.
D.The minimum scrape interval of the target exporter.
AnswerC

The resolution parameter sets the step interval at which the inner range-vector expression is evaluated across the subquery's window, producing a series that the outer max_over_time() then aggregates over. It is not the lookback delta nor the outer range.

Why this answer

The resolution inside subquery brackets specifies the evaluation step size at which the inner expression is evaluated within the subquery range.

66
MCQmedium

What is the primary operational difference between the 'rate()' and 'irate()' functions in PromQL?

A.rate() can be used with instant vectors, whereas irate() requires range vectors.
B.irate() automatically accounts for counter resets, whereas rate() does not.
C.irate() supports gauges, while rate() only supports counters.
D.rate() averages the per-second rate over the entire specified range vector, while irate() calculates the rate based on the last two data points in the range vector.
AnswerD

Both functions return per-second rates, but the axis of difference is the sample window: rate() divides the counter increase across the whole range vector, smoothing spikes, whereas irate() uses only the final two samples, giving the instantaneous rate.

Why this answer

rate() calculates the average per-second rate over the whole range vector, smoothing spikes, whereas irate() calculates the instantaneous rate using only the last two points.

Ready to test yourself?

Try a timed practice session using only Promql questions.