Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.
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.)
A.
for (ID accountID : accountMap.keySet()) {ג€¦}
B.
for (Account accountRecord : accountMap.values()) {ג€¦}
C.
for (Integer i=0; I < accountMap.size(); i++) {ג€¦}
D.
for (ID accountID : accountMap) {ג€¦}
E.
for (Account accountRecord : accountMap.keySet()) {ג€¦}
choices:
A. for (ID accountID : accountMap.keySet()) {…}
B. for (Account accountRecord : accountMap.values()) {…}
C. for (Integer i=0; I < accountMap.size(); i++) {…}
D. for (ID accountID : accountMap) {…}
E. for (Account accountRecord : accountMap.keySet()) {…}
I see what happend here, the person who creates this question, just cheked those staments, and only work for ABC, so in that context DE are worng,
But you are asumming that some code is missing on those (DE)
E cannot be the right answer as Keyset contains Id so in order to loop it needs ID
For(ID thisloop: Map.keyset()) is correct
For(Account acc: Map.keyset()) is incorrect
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.
Mitu99
Highly Voted 2 years, 3 months agoJuanVentura
Highly Voted 2 years, 10 months agoABHI0O07
Most Recent 1 month agoNikospa11
3 months agomwwt2022
6 months, 3 weeks agoJuanVentura
2 years, 10 months agoBeenal
2 years, 10 months agoLoosi
3 years ago