Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

HashiCorp Exam VA-002-P Topic 10 Question 90 Discussion

Actual exam question for HashiCorp's VA-002-P exam
Question #: 90
Topic #: 10
[All VA-002-P Questions]

What is the result of the following terraform function call?

lookup({a="hello", b="goodbye"}, "c", "what?")

Show Suggested Answer Hide Answer
Suggested Answer: C

lookup retrieves the value of a single element from a map, given its key. If the given key does not exist, the given default value is returned instead. In this case, the function call is searching for the key 'c'. But since there is no key 'c', the default vault 'what?' is returned.

https://www.terraform.io/docs/configuration/functions/lookup.html


Contribute your Thoughts:

Lanie
2 months ago
Terraform, more like 'terrifying', am I right? Anyway, the answer is C. Unless the map is actually a mystical artifact that bends the laws of reality, in which case all bets are off.
upvoted 0 times
Shawana
12 days ago
I'm pretty sure it's C) what?
upvoted 0 times
...
Adolph
15 days ago
Really? I thought it was B) hello
upvoted 0 times
...
Art
19 days ago
No, it's actually A) goodbye
upvoted 0 times
...
Lucy
26 days ago
C) what?
upvoted 0 times
...
...
Virgie
2 months ago
This question is a real head-scratcher. I'm going to go with C and hope the terraform gods are feeling generous today.
upvoted 0 times
...
Fabiola
2 months ago
D, obviously. The function is returning the key 'c' since it's not found in the map. What kind of sorcery is this terraform thing anyway?
upvoted 0 times
Suzi
1 months ago
I think you're mistaken. The correct answer is 'what?' since the key 'c' is not in the map.
upvoted 0 times
...
Francene
1 months ago
No, it actually returns 'what?' because the key 'c' is not found in the map.
upvoted 0 times
...
...
Genevive
2 months ago
I agree with Ayesha, the function lookup will return the value associated with key 'c', which is 'goodbye'. So, the correct answer is A) goodbye.
upvoted 0 times
...
Ayesha
2 months ago
I think the result is 'goodbye' because the function lookup searches for the key 'c' in the map and returns the corresponding value, which is 'goodbye'.
upvoted 0 times
...
Kanisha
2 months ago
C) what?
upvoted 0 times
...
Paris
2 months ago
Hold up, is this a trick question? If the map doesn't have the key 'c', shouldn't it just return the default value 'what?'? I'm going with C.
upvoted 0 times
Teresita
1 months ago
Looks like we all agree on option C then.
upvoted 0 times
...
Dick
1 months ago
Yeah, that makes sense. Option C it is.
upvoted 0 times
...
Alpha
1 months ago
I agree, I'm going with option C as well.
upvoted 0 times
...
Emmett
1 months ago
I think it should return the default value 'what?' if the key 'c' is not found.
upvoted 0 times
...
...
Goldie
3 months ago
I think the answer is B. The function call is looking for the key 'c', but the map only has keys 'a' and 'b', so it should return the value for 'a', which is 'hello'.
upvoted 0 times
...
Suzan
3 months ago
The result is clearly C. 'what?' is the default value returned when the key 'c' is not found in the map.
upvoted 0 times
Nathan
28 days ago
Oh, I see. So 'what?' is the default value if the key is not found.
upvoted 0 times
...
Leota
1 months ago
No, it's actually A) goodbye
upvoted 0 times
...
Vannessa
1 months ago
I think the answer is C) what?
upvoted 0 times
...
Celestine
2 months ago
Oh, I see. 'what?' is the default value if the key 'c' is not found.
upvoted 0 times
...
Verona
2 months ago
No, it's actually A) goodbye.
upvoted 0 times
...
Jina
2 months ago
I think the answer is C) what?
upvoted 0 times
...
...
Genevive
3 months ago
B) hello
upvoted 0 times
...
Ayesha
3 months ago
A) goodbye
upvoted 0 times
...

Save Cancel