
Free Plat-Dev-201 Practice Test Questions and Answers (2026) | Cert Empire Practice Questions
Free preview: 20 questions.
Salesforce Plat Dev 201
Q: 1
What is the result of the following code?


Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 2
How should a developer write unit tests for a private method in an Apex class?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 3
A developer needs to have records with specific field values in order to test a new Apex class.
What should the developer do to ensure the data is available to the test?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 4
A developer has a single custom controller class that works with a Visualforce Wizard to support
creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple
Visualforce pages and from a parameter on the initial URL.
Which three statements are useful inside the unit test to effectively test the custom controller?
Choose 3 answers
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 5
A custom Visualforce controller calls the ApexPages.addMessage() method, but no messages are
rendering on the page.
Which component should be added to the Visualforce page to display the message?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 6
The following Apex method is part of the ContactService class that is called from a trigger:
How should the developer modify the code to ensure best practices are met?
A)
B)
C)
D)
How should the developer modify the code to ensure best practices are met?
A)
B)
C)
D)Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 7
When using Salesforce DX, what does a developer need to enable to create and manage scratch
orgs?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 8
A custom picklist field, Pool Preference ¢, exists on a custom object. The picklist contains the
following options: ‘Vegan’, ‘Kosher’, 'No Preference’. The developer must ensure a value is populated
every time a record is created or updated.
What is the optimal way to ensure a value is selected every time a record is saved?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 9
Cloud Kicks Fitness, an ISV Salesforce partner, is developing a managed package application. One of
the application modules allows the user to calculate body fat using the Apex class, Bodyfat, and its
method, calculateBodyFat (). The product owner wants to ensure this method is accessible by the
consumer of the application when developing customizations outside the ISV's package namespace.
Which approach should a developer take to ensure calculateBodyFat () is accessible outside the
package namespace?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 10
Since Aura application events follow the traditional publish-subscribe model, which method is used
to fire an event?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 11
Consider the following code snippet:
apex
CopyEdit
public class with sharing AccountsController {
@AuraEnabled
public List getAllAccounts(){
return [SELECT Id, Name, Industry FROM Account];
}
}
Apex Test Class Snippet:
apex
CopyEdit
@isTest
private class with sharing AccountsController_Test {
@testSetup
private static void makeData(){
User user1 = [SELECT Id FROM User WHERE Profile.Name = 'System Administrator' AND isActive
= true LIMIT 1];
User user2 = [SELECT Id FROM User WHERE Profile.Name = 'Standard User' AND UserName =
'[email protected]' AND isActive = true LIMIT 1];
TestUtils.insertAccounts(10, user1.Id);
TestUtils.insertAccounts(20, user2.Id);
}
@isTest
private static void getAllAccounts_StandardUser_Test(){
List result = AccountsController.getAllAccounts();
System.assertEquals(20, result.size());
}
}
When the test class runs, the assertion fails.
Which change should the developer implement in the Apex test method to ensure the test method
executes successfully?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 12
A developer needs to confirm that a Contact trigger works correctly without changing the
organization's data.
What should the developer do to test the Contact trigger?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 13
Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightning web
component?
Choose 3 answers
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 14
Which code in a Visualforce page and/or controller might present a security vulnerability?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 15
Which two are phases in the Aura application event propagation framework?
Choose 2 answers
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 16
The Job_Application__c custom object has a field that is a master-detail relationship to the Contact
object, where the Contact object is the master.
As part of a feature implementation, a developer needs to retrieve a list containing all Contact
records where the related Account Industry is 'Technology', while also retrieving the Contact's
Job_Application__c records.
Based on the object's relationships, what is the most efficient statement to retrieve the list of
Contacts?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 17
Consider the following code snippet:
public static List obtainAllFields(Set leadIds) {
List result = new List();
for (Id leadId : leadIds) {
result.add([SELECT FIELDS(ALL) FROM Lead WHERE Id = :leadId]);
}
return result;
}
Given the multi-tenant architecture of the Salesforce platform, what is a best practice a developer
should implement to ensure successful execution of the method?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 18
Universal Hiring uses Salesforce to capture job applications. A salesforce administrator created two
custom objects; Job__c acting as the master object, to Application_c acting as the detail.
Within the Job__c object, a custom multi-select picklist, preferred _Locations__c, contains a list of
approved states for the position. Each Job_Application__c record relates to a Contact within the
system through a master-detail relationship.
Recruiters have requested the ability to view whether the Contact's Mailing State value matches a
value selected on the Preferred Locations__c field, within the Job_Application__c record. Recruiters
would like this value to be kept in sync if changes occur to the Contact's Mailing State.
What is the recommended tool a developer should use to meet the business requirement?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 19
A development team wants to use a deployment script to automatically deploy to a sandbox during
their development cycles.
Which two tools can they use to run a script that deploys to a sandbox?
Choose 2 answers
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 20
A developer considers the following snippet of code:
Boolean isOK;
Integer x;
String theString = 'Hello';
if (isOK == false && theString == 'Hello') {
x = 1;
} else if (isOK == true && theString == 'Hello') {
x = 2;
} else if (isOK == null && theString == 'Hello') {
x = 3;
} else {
x = 4;
}
Based an this code, what is the value of x?
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Question 1 of 20