Salesforce Certified Platform Developer II — Question 79
A developer has written the following method:
static void processList(List<sobject> input){
Which code block can be used to call the method?
Answer options
- A. processList (acc)
- B. processList ([FIND 'Acme" 'RETURNING Account])
- C. processList([SELECT Id, Name FROM sObject WHERE Type = 'Account'])
- D. for Account acc : [SELECT Id, Name FROM Account])
Correct answer: D
Explanation
The correct answer is D because it iterates over a query result for Account objects and provides a list of sObject type to the method. Option A is incorrect as it tries to pass a single variable instead of a list. Option B and C both attempt to use methods that return a different type than what is expected by the method's parameter.