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 25 discussion

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

global with sharing class MyRemoter {
public String accountName { get; set; }
public static Account account { get; set; }
public AccountRemoter() {}
@RemoteAction
global static Account getAccount(String accountName) {
account = [SELECT Id, Name, NumberOfEmployees
FROM Account WHERE Name = :accountName];
return account;
}
}
Consider the Apex class above that defines a RemoteAction used on a Visualforce search page.
Which code snippet will assert that the remote action returned the correct Account?

  • A. Account a = controller.getAccount('TestAccount'); System.assertEquals( 'TestAccount', a.Name );
  • B. MyRemoter remote = new MyRemoter(); Account a = remote.getAccount('TestAccount'); System.assertEquals( 'TestAccount', a.Name );
  • C. MyRemoter remote = new MyRemoter('TestAccount'); Account a = remote.getAccount (); System.assertEquals( 'TestAccount', a.Name );
  • D. Account a = MyRemoter.getAccount('TestAccount'); System.assertEquals( 'TestAccount', a.Name );
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago