Given:
Map<ID, Account> accountMap = new Map>ID, Account> ([SELECT Id, Name FROM Account]);
What are three valid Apex loop structures for iterating through items in the collection? (Choose three.)
Suggested Answer: A, B, C
Get Premium DEX-450 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
11 comments · newest first
RO
Roselle
12 months ago
Wait, are we sure about B? Can you really loop through values like that?
LA
Lasandra
12 months ago
E looks wrong too, keySet() gives IDs, not Account records.
TO
Toi
12 months ago
D seems off, you can't iterate a Map directly like that.
DO
Dorsey
1 year ago
C is not valid, you can't use an index with a Map.
JU
Jutta
1 year ago
A and B are definitely valid!
EL
Elly
1 year ago
I practiced a similar question, and I believe option B should work because it lets us loop through the values directly.
HU
Hui
1 year ago
I'm a bit unsure about option C; I remember we can't use a traditional for loop like that with a Map, right?
SA
Sage
1 year ago
I think option A is definitely valid since we're iterating over the keys of the map.
AI
Aimee
1 year ago
I feel like option D is incorrect, but I'm not completely sure why. Can we iterate over a map like that?
KI
Kiley
1 year ago
The AP failover priority seems like the most straightforward answer. I'll go with that unless I spot something else that seems more likely.
VE
Venita
1 year ago
Hmm, this looks like a tricky one. I'll need to think through the possible causes carefully.