exam questions

Exam AZ-400 All Questions

View all questions & answers for the AZ-400 exam

Exam AZ-400 topic 9 question 48 discussion

Actual exam question from Microsoft's AZ-400
Question #: 48
Topic #: 9
[All AZ-400 Questions]

You have an Azure Resource Manager (ARM) template that contains the following expression.

[if(parameters('isComplete'), '1a', '2a')]

You need to migrate the template to Bicep.

Which expression should you run?

  • A. iif(isComplete, '1a', '2a')
  • B. if(isComplete, '1a', '2a')
  • C. if('isComplete') '1a' else '2a'
  • D. isComplete ? '1a' '2a'
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Yameo
Highly Voted 6 months, 4 weeks ago
Selected Answer: D
C is incorrect, the only possible is D, but the ':' is missing
upvoted 7 times
...
Christian_garcia_martin
Most Recent 3 months ago
Selected Answer: D
D is correct but looks the OCR missed the ":" you'll see in the exam
upvoted 1 times
...
Dankho
3 months, 4 weeks ago
Selected Answer: D
After reviewing all options, I'm going with D but it's missing the colon
upvoted 1 times
...
swk2az400
5 months, 3 weeks ago
Selected Answer: C
Two possiblities: if (parameters('isComplete')) { '1a' } else { '2a' } or in a shortened way var result = isComplete ? '1a' : '2a'
upvoted 2 times
...
Gooldmember
5 months, 3 weeks ago
Selected Answer: D
D is correct if you imagine the ':' is added :)
upvoted 2 times
...
maqsoodshah
6 months, 1 week ago
Selected Answer: A
isComplete ? '1a' '2a' This syntax is incorrect because the conditional operator (? :) requires a : between the two return values. The correct syntax would be isComplete ? '1a' : '2a', but even then, iif is the preferred method in Bicep. Correct answer : A. iif(isComplete, '1a', '2a') This is correct because iif is the equivalent function in Bicep for the ARM if expression. It evaluates the condition (isComplete) and returns the corresponding value based on whether the condition is true or false.
upvoted 3 times
Gooldmember
5 months, 3 weeks ago
I cant seem to find any documentation of your statement... I think option D is missing some text here on examtopics...
upvoted 2 times
...
...
schwagalla
6 months, 2 weeks ago
Selected Answer: D
It should be answer D, but the ':' is currently missing there. All the other answers are wrong. There is no if function in bicep that has an else block. See: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions The only way to use 'if' is together with a resource to conditionally deploy it. But you cannot use it to assign a string to a variable or so.
upvoted 1 times
...
Mattt
6 months, 2 weeks ago
Selected Answer: D
D is correct
upvoted 1 times
...
8fc2e85
7 months ago
Selected Answer: C
D not correct. Syntax isn't correct for bicep. Would be isComplete ? '1a' : '2a'
upvoted 1 times
8fc2e85
6 months, 2 weeks ago
D is correct with added ':'
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago