Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 104 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 104
Topic #: 1
[All Certified Platform Developer II Questions]

A developer has written the following method:
static void processList(List<sobject> input){
Which code block can be used to call the method?

  • 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])
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
FriedConsole2000
9 months, 1 week ago
Selected Answer: A
"A" is the only one that could be true. It doesn't define "acc", so it could be true. "D" doesn't reference the method name.
upvoted 1 times
...
moitam
1 year, 2 months ago
Selected Answer: A
I will go with option A for this one. To call a method with an sObject parameter, you need to pass an instance of a specific sObject type, such as Account, Contact, or Opportunity2. Based on this, I think the correct answer is A. processList (acc), where acc is an instance of Account sObject. Example: List<sObject> myList = new List<sObject>(); myList.add(new Account(Name = 'Acme', Phone = '111-111-1111')); myList.add(new Account(Name = 'Beta', Phone = '222-222-2222')); static void processList(List<sObject> input) { for (sObject obj : input) { Account acc = (Account) obj; System.debug('Name: ' + acc.Name + ', Phone: ' + acc.Phone); } } processList(myList);
upvoted 3 times
...
Ronin192
2 years ago
Selected Answer: D
D is correct, tested and it gives no error
upvoted 2 times
...
skipper009
2 years, 9 months ago
I think this is a poorly constructed question. But C makes more sense if only if it's Account instead of sObject.
upvoted 1 times
lorenac2
1 year, 10 months ago
Agreed, bad question, again. SOSL always returns a list of lists even if only returning one object. I verified this.
upvoted 1 times
...
...
nibbio
2 years, 11 months ago
Selected Answer: D
Correct Answer D, sObject is not supported on queries. the SOSL query returns a list of list of sObject so it cannot be the right answer.
upvoted 2 times
drwebber
2 years, 11 months ago
Seems that something was missed in the answers. BC is not correct answers, but there's no invocation of the processList method in D. On the other hand, it's possible to name list as 'acc' (List<Account> acc;)
upvoted 3 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.

SaveCancel
Loading ...