0
0
Terraformcloud~10 mins

Numeric functions (min, max, ceil) in Terraform - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to find the minimum of two numbers.

Terraform
output "min_value" {
  value = min(10, [1])
}
Drag options to blanks, or click blank then click option'
A30
B5
C15
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a number larger than 10.
Confusing min with max function.
2fill in blank
medium

Complete the code to find the maximum of three numbers.

Terraform
output "max_value" {
  value = max(7, 14, [1])
}
Drag options to blanks, or click blank then click option'
A20
B5
C10
D12
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a number smaller than 14.
Using min instead of max function.
3fill in blank
hard

Fix the error in the code to correctly round up the number.

Terraform
output "rounded_up" {
  value = ceil([1])
}
Drag options to blanks, or click blank then click option'
A3
B"3.2"
C3.2
Dceil
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a string instead of a number.
Passing the function name instead of a number.
4fill in blank
hard

Fill both blanks to create a value that is the maximum of 5 and the ceiling of 4.3.

Terraform
output "max_ceil" {
  value = max([1], ceil([2]))
}
Drag options to blanks, or click blank then click option'
A5
B4.3
C3.7
D6
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number other than 5 in the first blank.
Using a number other than 4.3 in the second blank.
5fill in blank
hard

Fill all three blanks to output the minimum of the ceiling of 7.1, the maximum of 3 and 9, and 8.

Terraform
output "complex_calc" {
  value = min(ceil([1]), max([2], [3]), 8)
}
Drag options to blanks, or click blank then click option'
A7.1
B3
C9
D6
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the numbers in max function.
Using wrong numbers for ceiling or max.