Bird
Raised Fist0
Terraformcloud~20 mins

Numeric functions (min, max, ceil) in Terraform - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Terraform Numeric Functions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
1:00remaining
Terraform min function output
What is the output of the following Terraform expression?

min(5, 3, 9, 1)
Terraform
min(5, 3, 9, 1)
A9
B3
C5
D1
Attempts:
2 left
💡 Hint
The min function returns the smallest number from the list.
❓ service_behavior
intermediate
1:00remaining
Terraform max function output
What value does this Terraform expression return?

max(2.5, 7.1, 4.8, 6.0)
Terraform
max(2.5, 7.1, 4.8, 6.0)
A4.8
B6.0
C7.1
D2.5
Attempts:
2 left
💡 Hint
The max function returns the largest number from the list.
❓ Configuration
advanced
1:30remaining
Using ceil function in Terraform
Given this Terraform expression:

ceil(4.3)

What is the output?
Terraform
ceil(4.3)
A5
B4
C4.3
DError: ceil expects an integer
Attempts:
2 left
💡 Hint
The ceil function rounds a number up to the nearest whole number.
❓ Architecture
advanced
1:30remaining
Combining min, max, and ceil in Terraform
What is the output of this Terraform expression?

ceil(min(3.2, 5.7, 4.1) + max(1.5, 2.8))
Terraform
ceil(min(3.2, 5.7, 4.1) + max(1.5, 2.8))
A6
B7
C8
D5
Attempts:
2 left
💡 Hint
Calculate min and max first, then add and apply ceil.
❓ security
expert
2:00remaining
Terraform numeric function misuse impact
If a Terraform configuration uses ceil on a negative float value like ceil(-3.7), what is the output and potential impact on resource scaling?
Terraform
ceil(-3.7)
A-4; may cause resource count to be lower than expected
B-3; may cause resource count to be higher than expected
C-3; no impact on resource scaling
DError; ceil does not accept negative numbers
Attempts:
2 left
💡 Hint
Remember how ceil rounds negative numbers.

Practice

(1/5)
1. What does the Terraform function min(3, 7, 2) return?
easy
A. Error
B. 3
C. 7
D. 2

Solution

  1. Step 1: Understand the min function

    The min function returns the smallest number from the given list.
  2. Step 2: Compare the numbers 3, 7, and 2

    Among 3, 7, and 2, the smallest number is 2.
  3. Final Answer:

    2 -> Option D
  4. Quick Check:

    min(3,7,2) = 2 [OK]
Hint: min returns the smallest number from the list [OK]
Common Mistakes:
  • Confusing min with max
  • Expecting average instead of minimum
  • Using ceil instead of min
2. Which of the following is the correct syntax to use the ceil function in Terraform?
easy
A. ceil(4.3)
B. ceil 4.3
C. ceil[4.3]
D. ceil{4.3}

Solution

  1. Step 1: Recall Terraform function syntax

    Terraform functions use parentheses to enclose arguments, like function_name(argument).
  2. Step 2: Check each option

    Only ceil(4.3) uses correct function call syntax.
  3. Final Answer:

    ceil(4.3) -> Option A
  4. Quick Check:

    Function calls use parentheses [OK]
Hint: Terraform functions always use parentheses for arguments [OK]
Common Mistakes:
  • Using spaces instead of parentheses
  • Using brackets or braces instead of parentheses
  • Missing parentheses
3. What is the output of this Terraform expression?
max(5, ceil(3.2), min(4, 2))
medium
A. 2
B. 5
C. 3
D. 4

Solution

  1. Step 1: Evaluate inner functions

    ceil(3.2) rounds 3.2 up to 4.
    min(4, 2) returns 2.
  2. Step 2: Evaluate max function

    Now the expression is max(5, 4, 2). The largest number is 5.
  3. Final Answer:

    5 -> Option B
  4. Quick Check:

    max(5,4,2) = 5 [OK]
Hint: Evaluate inner functions first, then apply max [OK]
Common Mistakes:
  • Ignoring nested function calls
  • Mixing up min and max
  • Forgetting ceil rounds up
4. Identify the error in this Terraform expression:
ceil(5.7, 2)
medium
A. Invalid function name
B. Missing parentheses
C. Too many arguments for ceil function
D. ceil cannot be used with decimals

Solution

  1. Step 1: Check the ceil function signature

    The ceil function takes exactly one argument, a decimal number.
  2. Step 2: Analyze the given expression

    The expression ceil(5.7, 2) has two arguments, which is invalid.
  3. Final Answer:

    Too many arguments for ceil function -> Option C
  4. Quick Check:

    ceil expects one argument [OK]
Hint: ceil takes only one decimal argument [OK]
Common Mistakes:
  • Passing multiple arguments
  • Confusing ceil with round
  • Using wrong argument types
5. You want to find the smallest whole number greater than or equal to the minimum of 3.4, 2.1, and 5.9 in Terraform. Which expression achieves this?
hard
A. ceil(min(3.4, 2.1, 5.9))
B. min(ceil(3.4, 2.1, 5.9))
C. max(min(3.4, 2.1, 5.9))
D. ceil(max(3.4, 2.1, 5.9))

Solution

  1. Step 1: Find the minimum of the numbers

    min(3.4, 2.1, 5.9) returns 2.1, the smallest number.
  2. Step 2: Apply ceil to round up to the nearest whole number

    ceil(2.1) rounds 2.1 up to 3.
  3. Final Answer:

    ceil(min(3.4, 2.1, 5.9)) -> Option A
  4. Quick Check:

    min=2.1, ceil(2.1)=3 [OK]
Hint: Apply min first, then ceil to round up [OK]
Common Mistakes:
  • Applying ceil before min
  • Using max instead of min
  • Confusing order of functions
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard