Question 1170
A Terraform 1.12 configuration evaluates join("/", concat(["us"], reverse(["west", "east"]))). Which result follows from the expression as written?
- "west/east/us"
- "us/east/west/west"
- "us/east/west"
- "useastwest"
Explanation
Correct Answer
C:For the specific expression join("/", concat(["us"], reverse(["west", "east"]))), First, reverse reorders the right-hand list before concat appends it; The outer join uses a slash only between consecutive list members and preserves their computed order.
Incorrect Answers
A:For the concrete expression join("/", concat(["us"], reverse(["west", "east"]))), this reverses the members even though join preserves the order returned by the inner expression; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
B:For the concrete expression join("/", concat(["us"], reverse(["west", "east"]))), join must not repeat the last item after the list has been joined; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
D:For the concrete expression join("/", concat(["us"], reverse(["west", "east"]))), this omits the slash delimiters requested by join; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1171
A Terraform 1.12 configuration evaluates reverse(concat(["us"], reverse(["west", "east"]))). Which result follows from the expression as written?
- ["us", "east", "west"]
- ["east", "us", "west"]
- ["east", "west", "us"]
- ["west", "east", "us"]
Explanation
Correct Answer
D:For the specific expression reverse(concat(["us"], reverse(["west", "east"]))), First, reverse reorders the right-hand list before concat appends it; reverse then returns the exact opposite element order, without sorting or removing members.
Incorrect Answers
A:For the concrete expression reverse(concat(["us"], reverse(["west", "east"]))), this leaves the inner result unchanged and skips the outer reverse call; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
B:For the concrete expression reverse(concat(["us"], reverse(["west", "east"]))), alphabetic sorting is not the same as reversing the sequence produced by the inner expression; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
C:For the concrete expression reverse(concat(["us"], reverse(["west", "east"]))), rotating the input left one position does not invert every position as reverse requires; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1172
A Terraform 1.12 configuration evaluates sort(concat(["us"], reverse(["west", "east"]))). Which result follows from the expression as written?
- ["east", "us", "west"]
- ["west", "east", "us"]
- ["us", "east", "west"]
- ["west", "us", "east"]
Explanation
Correct Answer
A:For the specific expression sort(concat(["us"], reverse(["west", "east"]))), First, reverse reorders the right-hand list before concat appends it; Terraform sort then compares the resulting strings lexicographically in ascending order; it neither drops values nor preserves a non-sorted arrangement.
Incorrect Answers
B:For the concrete expression sort(concat(["us"], reverse(["west", "east"]))), a reversal is not guaranteed to produce ascending lexical order; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
C:For the concrete expression sort(concat(["us"], reverse(["west", "east"]))), this retains the source order rather than explicitly sorting the result (unless it was already sorted); the inner stage produces ["us", "east", "west"] before the outer operation is applied.
D:For the concrete expression sort(concat(["us"], reverse(["west", "east"]))), this puts strings in descending lexical order rather than ascending order; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1173
A Terraform 1.12 configuration evaluates element(concat(["us"], reverse(["west", "east"])), 4). Which result follows from the expression as written?
- "index out of range"
- "east"
- "us"
- "west"
Explanation
Correct Answer
B:For the specific expression element(concat(["us"], reverse(["west", "east"])), 4), First, reverse reorders the right-hand list before concat appends it; The list has 3 entries, so element wraps index 4 modulo 3 and selects zero-based position one.
Incorrect Answers
A:For the concrete expression element(concat(["us"], reverse(["west", "east"])), 4), element wraps a positive index instead of failing like ordinary square-bracket indexing; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
C:For the concrete expression element(concat(["us"], reverse(["west", "east"])), 4), index wraparound lands at position one, not the first position of the inner list; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
D:For the concrete expression element(concat(["us"], reverse(["west", "east"])), 4), the final list member is not selected; the effective index is one; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1174
A Terraform 1.12 configuration evaluates slice(concat(["us"], reverse(["west", "east"])), 1, 3). Which result follows from the expression as written?
- ["us", "east"]
- ["west", "east"]
- ["east", "west"]
- ["us", "east", "west"]
Explanation
Correct Answer
C:For the specific expression slice(concat(["us"], reverse(["west", "east"])), 1, 3), First, reverse reorders the right-hand list before concat appends it; slice begins at zero-based index one and continues through the final member, stopping before the exclusive end index 3.
Incorrect Answers
A:For the concrete expression slice(concat(["us"], reverse(["west", "east"])), 1, 3), this takes an initial prefix rather than starting with the second entry; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
B:For the concrete expression slice(concat(["us"], reverse(["west", "east"])), 1, 3), slice preserves order rather than reversing the extracted portion; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
D:For the concrete expression slice(concat(["us"], reverse(["west", "east"])), 1, 3), this incorrectly keeps the first list member, although the slice begins at index one; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1175
A Terraform 1.12 configuration evaluates format("primary=%s", element(concat(["us"], reverse(["west", "east"])), 0)). Which result follows from the expression as written?
- "primary=east"
- "us"
- "secondary=us"
- "primary=us"
Explanation
Correct Answer
D:For the specific expression format("primary=%s", element(concat(["us"], reverse(["west", "east"])), 0)), First, reverse reorders the right-hand list before concat appends it; element at zero selects the first member, and the single %s placeholder in format substitutes that member after the literal primary= prefix.
Incorrect Answers
A:For the concrete expression format("primary=%s", element(concat(["us"], reverse(["west", "east"])), 0)), this uses the second list element; element at index zero selects the first value; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
B:For the concrete expression format("primary=%s", element(concat(["us"], reverse(["west", "east"])), 0)), the format string has a literal primary= prefix that must appear in the result; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
C:For the concrete expression format("primary=%s", element(concat(["us"], reverse(["west", "east"])), 0)), the prefix is specified literally as primary= rather than secondary=; the inner stage produces ["us", "east", "west"] before the outer operation is applied.
Question 1176
A Terraform 1.12 configuration evaluates length(flatten([["red", "green"], [], ["blue"]])). Which result follows from the expression as written?
- 3
- 2
- 5
- 7
Explanation
Correct Answer
A:For the specific expression length(flatten([["red", "green"], [], ["blue"]])), First, flatten traverses inner lists while empty inner lists contribute nothing; that produces exactly 3 elements; The outer length call counts those resulting elements rather than the original textual arguments.
Incorrect Answers
B:For the concrete expression length(flatten([["red", "green"], [], ["blue"]])), this drops one legitimate list element; the inner operation returns 3 values; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
C:For the concrete expression length(flatten([["red", "green"], [], ["blue"]])), the inner collection has 3 values, not 5; length counts the resulting collection only; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
D:In the calculation length(flatten([["red", "green"], [], ["blue"]])), 7 is not the size of the evaluated collection: the inner result has 3 elements, and length counts precisely those elements.
Question 1177
A Terraform 1.12 configuration evaluates join("/", flatten([["red", "green"], [], ["blue"]])). Which result follows from the expression as written?
- "red/green/blue/blue"
- "red/green/blue"
- "redgreenblue"
- "blue/green/red"
Explanation
Correct Answer
B:For the specific expression join("/", flatten([["red", "green"], [], ["blue"]])), First, flatten traverses inner lists while empty inner lists contribute nothing; The outer join uses a slash only between consecutive list members and preserves their computed order.
Incorrect Answers
A:For the concrete expression join("/", flatten([["red", "green"], [], ["blue"]])), join must not repeat the last item after the list has been joined; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
C:For the concrete expression join("/", flatten([["red", "green"], [], ["blue"]])), this omits the slash delimiters requested by join; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
D:For the concrete expression join("/", flatten([["red", "green"], [], ["blue"]])), this reverses the members even though join preserves the order returned by the inner expression; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
Question 1178
A Terraform 1.12 configuration evaluates reverse(flatten([["red", "green"], [], ["blue"]])). Which result follows from the expression as written?
- ["green", "blue", "red"]
- ["green", "red", "blue"]
- ["blue", "green", "red"]
- ["red", "green", "blue"]
Explanation
Correct Answer
C:For the specific expression reverse(flatten([["red", "green"], [], ["blue"]])), First, flatten traverses inner lists while empty inner lists contribute nothing; reverse then returns the exact opposite element order, without sorting or removing members.
Incorrect Answers
A:For the concrete expression reverse(flatten([["red", "green"], [], ["blue"]])), rotating the input left one position does not invert every position as reverse requires; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
B:For the concrete expression reverse(flatten([["red", "green"], [], ["blue"]])), this rotates the reversed list rather than returning the exact reversed sequence; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
D:For the concrete expression reverse(flatten([["red", "green"], [], ["blue"]])), this leaves the inner result unchanged and skips the outer reverse call; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
Question 1179
A Terraform 1.12 configuration evaluates sort(flatten([["red", "green"], [], ["blue"]])). Which result follows from the expression as written?
- ["red", "green", "blue"]
- ["blue", "green"]
- ["green", "blue", "red"]
- ["blue", "green", "red"]
Explanation
Correct Answer
D:For the specific expression sort(flatten([["red", "green"], [], ["blue"]])), First, flatten traverses inner lists while empty inner lists contribute nothing; Terraform sort then compares the resulting strings lexicographically in ascending order; it neither drops values nor preserves a non-sorted arrangement.
Incorrect Answers
A:For the concrete expression sort(flatten([["red", "green"], [], ["blue"]])), this retains the source order rather than explicitly sorting the result (unless it was already sorted); the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
B:For the concrete expression sort(flatten([["red", "green"], [], ["blue"]])), sorting does not remove the final element of the list; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
C:For the concrete expression sort(flatten([["red", "green"], [], ["blue"]])), this rotates entries rather than sorting them lexicographically; the inner stage produces ["red", "green", "blue"] before the outer operation is applied.
Question 1180
An engineer tests the parseint behavior in terraform console. What is the result of parseint("ff", 16)?
- 16
- 15
- 255
- "ff"
Explanation
Correct Answer
C:Evaluating the actual call parseint("ff", 16): In hexadecimal, each f digit represents fifteen; ff equals fifteen times sixteen plus fifteen, or 255.
Incorrect Answers
A:Given the specific operands supplied to the Terraform expression parseint("ff", 16), sixteen specifies the input base rather than the parsed integer.
B:Given the specific operands supplied to the Terraform expression parseint("ff", 16), fifteen is the value of one hexadecimal f, but this input has two digits.
D:Given the specific operands supplied to the Terraform expression parseint("ff", 16), parseint converts to a number instead of preserving the source string.