Salesforce PDII Online Practice
Questions and Exam Preparation
PDII Exam Details
Exam Code
:PDII
Exam Name
:Salesforce Certified Platform Developer II (Plat-Dev-301)
Certification
:Salesforce Certifications
Vendor
:Salesforce
Total Questions
:445 Q&As
Last Updated
:Jul 14, 2026
Salesforce PDII Online Questions &
Answers
Question 1:
Which two scenarios require an Apex method to be called imperatively from a Lightning web component? (Choose Two)
A. Calling a method that makes a web service callout B. Calling a method that is not annotated with cacheable=true C. Calling a method with the click of a button D. Calling a method that is external to the main controller for the Lightning web component
B. Calling a method that is not annotated with cacheable=true C. Calling a method with the click of a button
Question 2:
An org has a custom object, Part__c. Its records are regularly imported from the company's Enterprise Resource Planning (ERP) system.
What can be used to ensure the correct Part__c records are updated in Salesforce when imports are made?
A. A Formula field B. An External ID field C. A Master-detail field D. A Lookup field
Universal Containers needs to integrate with an external system. The process is initiated when a record is created in Salesforce. The remote system does not require Salesforce to wait for a response before continuing.
What should the developer use to accomplish this?
A. Trigger with HTTP callout B. PushTopic event C. Outbound message D. Platform event
A. Trigger with HTTP callout
Question 4:
A Salesforce developer is hired by a multi-national company to build a custom Lightning application that shows employees their employment benefits and earned commissions over time. The application must acknowledge and respect the user's locale context for dates, times, numbers, currency, and currency symbols.
Which approach should the developer implement to ensure the Lightning application complies with the user's locale?
A. Create a Hierarchical custom setting to store user preferences B. Use the $Locale value provider to retrieve the user preferences C. Use the $User global variable to retrieve the user preferences D. Use the $Label global value provider.
B. Use the $Locale value provider to retrieve the user preferences
Explanation
In the Aura Component Framework, the $Locale global value provider (Option B) is specifically designed to handle globalization and localization. It provides direct access to the current user's locale preferences, including date and time formats, number grouping symbols, and currency symbols. Instead of manually querying the User object or creating custom settings, a developer can use expressions like {!$Locale. currencySymbol} or {!$Locale.dateFormat} directly in the component's markup or controller.
Using $Locale ensures that the application remains dynamic; if an employee moves from a US office to a European office and updates their Salesforce profile locale, the application will automatically reflect the new formatting rules without any code changes. This is more efficient than using $User (Option C), which would require additional logic to map locale strings to specific formats. $Label (Option D) is used for translated text strings, not formatting patterns. By leveraging the native $Locale provider, the developer ensures that the commission and benefit data are presented in a familiar, accurate context for every employee worldwide.
Question 5:
An org has a requirement that addresses on Contacts and Accounts should be normalized to a company standard by Apex code any time that they are saved.
What is the optimal way to implement this?
A. Apex trigger on Account that calls the Contact trigger to normalize the address B. Apex trigger on Contact that calls the Account trigger to normalize the address C. Apex trigger on Account that and Account that normalized the address D. Apex trigger on Account and Account that call a helper class to normalize the address
B. Apex trigger on Contact that calls the Account trigger to normalize the address
Explanation
In software engineering, the DRY (Don't Repeat Yourself) principle is fundamental for maintainability. If the logic for normalizing an address is identical for both Accounts and Contacts, that logic should not be duplicated across two separate trigger files.
The optimal implementation (Option D) is to create a single Trigger Helper or Utility class . This class contains a static method (e.g., AddressService.normalize(List<sObject> records)) that performs the normalization logic. You then create a small trigger on the Account object and a small trigger on the Contact object, both of which simply invoke this shared helper method.
This approach offers several advantages:
Maintainability: If the company standard for addresses changes (e.g., changing "St." to "Street"), the developer only needs to update the code in one place .
Reusability: The helper method can also be called from other contexts, such as an Anonymous Apex script or a Batch job.
Readability: Triggers remain "thin" and easy to read, acting only as entry points rather than containing complex business logic.
Options A and B are technically impossible; a trigger on one object cannot "call" a trigger on another object directly. Option C is less optimal because it leads to code duplication and a higher risk of bugs when logic is updated in one trigger but forgotten in the other.
Question 6:
If a developer wanted to display error messages with the standard Salesforce Ul styling, what would they use?
A. <apex:pageMessages> B. <apex:message> C. <apex:outputText> D. <apex:error>
A. <apex:pageMessages>
Question 7:
A company decides that every time an Opportunity is created, they want to create a follow up Task and assign it to the Opportunity Owner.
What should a developer use to implement the requirements?
A. A Process Builder on Opportunity B. A trigger on Task C. A trigger on Opportunity D. A Process Builder on Task
A. A Process Builder on Opportunity
Question 8:
Consider the following code snippet:
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 ];
As part of the deployment cycle, a developer creates the following test class. 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?
A. Query the Standard User into memory and enclose lines 14 and 15 within the System.runAs(user) method. B. Add System.runAs(user) to line 14 and enclose line 14 within Test.startTest() and Test.stopTest(). C. Query the Administrator user into memory and enclose lines 14 and 15 within the System.runAs(user) method. D. Add @IsTest(seeAllData=true) to line 12 and enclose lines 14 and 15 within Test.startTest() and Test.stopTest().
B. Add System.runAs(user) to line 14 and enclose line 14 within Test.startTest() and Test.stopTest().
Question 9:
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();Account a = remote.getAccount('TestAccount');System.assertEquals( 'TestAccount', a.Name ); D. Account a = MyRemoter.getAccount('TestAccount');System.assertEquals( 'TestAccount', a.Name );
D. Account a = MyRemoter.getAccount('TestAccount');System.assertEquals( 'TestAccount', a.Name );
Question 10:
There are user complaints about slow render times of a custom data table within a Visualforce page that loads thousands of Account records at once.
What can a developer do to help alleviate such issues?
A. Use the standard Account List controller and implement pagination. B. Use JavaScript remoting to query the accounts. C. Use the transient keyword in the Apex code when querying the Account records. D. Upload a third-party data table library as a static resource.
A. Use the standard Account List controller and implement pagination.
Explanation
Loading "thousands" of records at once into a Visualforce page causes performance issues primarily due to the heavy DOM processing required to render thousands of table rows and the large View State generated.
The most effective way to improve performance and user experience in this scenario is pagination. Instead of rendering all records simultaneously, pagination displays a subset (e.g., 20 records) at a time. Using the StandardSetController (which is implied by "standard Account List controller" in the context of lists) allows for efficient server-side pagination. It queries and retrieves only the records needed for the current page view, drastically reducing the View State size and the DOM elements the browser must render. While JavaScript Remoting (Option B) is fast for data retrieval, pagination is the fundamental pattern required to solve the "render time" issue for large lists.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Salesforce exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your PDII exam preparations
and Salesforce certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.