You need to sign in to do that
Don't have an account?
Vinu Varghese
Apex loop
Given Map<Id, Account> accountMap = new Map<Id, Account> {[SELECT Id, Name FROM Account]}; What are three valid Apex loop structures for iterating items in the collection?
Choose 3 answers
a. For(ID accountId : accountMap.keySet()) {--}
b. For(Account accountRecord : accountMap.value()) {--}
c. For( Integer i=0; i< accountMap.size(); i++) {--}
d. For(ID accountId : accountMap) {--}
e. For(Account accountRecord : accountMap.keySet()) {--}
I think A,B,C
Choose 3 answers
a. For(ID accountId : accountMap.keySet()) {--}
b. For(Account accountRecord : accountMap.value()) {--}
c. For( Integer i=0; i< accountMap.size(); i++) {--}
d. For(ID accountId : accountMap) {--}
e. For(Account accountRecord : accountMap.keySet()) {--}
I think A,B,C
Not sure if records from query data is required in other places(in Class), if it is not it can be combined as below.
For(Account v_Account : [SELECT Id, Name FROM Account]){
System.debug('Account Name::' + v_Account.Name);
}
Thanks.
I see that this is a question that might be related to a certification exam and Please be advised that this community is focused on Salesforce technical discussions where the forums and participants are geared toward programming troubleshooting and support.
You can easily check the behaviour of which would work by simply taking and simply executing the scenario.
I hope you understand and going forward I would request you to not post such questions in the forum.
Regards,
Salesforce Support.