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
:Jun 19, 2026
Salesforce PDII Online Questions &
Answers
Question 361:
Refer to the code below:
A developer is building this Aura component to display information about top Opportunities in the org.
Which three code changes must be made for the component to work? (Choose Three)
A. Add the static keyword to the Apex method. B. Set the controller in the component markup. C. Add the RemoteAction annotation to the Apex method. D. Add the AuraEnabled annotation to the Apex method. E. Get the controller action with cmp.get(`'oppController.getTopOpps").
A. Add the static keyword to the Apex method. B. Set the controller in the component markup. D. Add the AuraEnabled annotation to the Apex method.
Question 362:
A developer must create a way for external partners to submit millions of leads into Salesforce per day. How should the developer meet this requirement?
A. Publicly expose a Visualforce page via Force.com Sites B. Create a web service on Heroku that uses Heroku Connect C. Host a Web-to-Lead form on the company website D. Publicly expose an Apex Web Service via Force.com Sites
B. Create a web service on Heroku that uses Heroku Connect
Question 363:
The use of the transient keyword In Visualforce Page Controllers helps with which common performance issued?
A. Reduces View State B. Improves Query Performance C. Improves Page Transfers D. Reduces Load Times
A. Reduces View State
Explanation
In Visualforce, the "View State" is a hidden form field that maintains the state of the page (and the controller's variables) across postbacks to the server. If the View State becomes too large, it can slow down page loads and eventually hit the Salesforce View State limit (170KB), causing the page to crash.
The transient keyword is used to declare instance variables in Apex controllers that should not be saved in the View State. When a variable is marked as transient, its value is discarded after the request finishes and is not transmitted back to the client. This effectively reduces the size of the View State. It is commonly used for data that is needed only for the duration of the current request (like a large list of records displayed in a read-only table) and can be easily requeried or recalculated if needed.
Question 364:
Universal Containers requested the addition of a third-party Map widget to an existing Lightning web component.
Which two actions should the developer take to implement this requirement? (Choose Two)
A. Import the third-party JavaScript module directly Into the component. B. Use a content distribution network and Include <script> <script> tags In the component. C. Import loadscript from lightning platformResourceLoader. D. Upload the third-party JavaScript library as a static resource that Imports Into the component.
C. Import loadscript from lightning platformResourceLoader. D. Upload the third-party JavaScript library as a static resource that Imports Into the component.
Question 365:
Universal Containers wants to notify an external system in the event that an unhandled exception occurs when their nightly Apex batch gob runs.
What is the appropriate publish/subscribe logic to meet this requirement?
A. Have the external system subscribe to a standard Platform Event that gets fired with EventBus.publish(). B. Have the external system subscribe to a custom Platform Event that gets fired with addError(). C. Have the external system subscribe to a custom Platform Event that gets fired with EventBus.publish() D. Have the external system subscribe to a standard Platform Event that gets fired.
C. Have the external system subscribe to a custom Platform Event that gets fired with EventBus.publish()
Explanation
According to 1, you can use Apex to publish event messages from a Salesforce app by calling the EventBus.publish method. For example, if you defined a custom platform event called Low Ink, reference this event type as Low_Ink__e. Next, create instances of this event, and then pass them to the Apex method.
According to 2 and 3, you can write an after insert Apex trigger on the event object to subscribe to incoming events. Triggers provide an autosubscription mechanism in Apex. Unlike triggers on standard or custom objects, triggers on platform events don't execute in the same Apex transaction as the one that published the event. The trigger runs asynchronously in its own process. Therefore, using a custom Platform Event and EventBus.publish method seems to be the appropriate publish/subscribe logic to meet the requirement.
Question 366:
Which use case is an appropriate fit for the @future asynchronous Apex method? (Choose two.)
A. A developer has jobs that need larger query results than regular transactions allow B. A developer needs to segregate DML operations and bypass the mixed save DML error C. A developer has long-running jobs with large data volumes that need to be performed in batches D. A developer has long-running methods and needs to prevent delaying an Apex transaction
B. A developer needs to segregate DML operations and bypass the mixed save DML error D. A developer has long-running methods and needs to prevent delaying an Apex transaction
Question 367:
A custom Aura component, AddressValidation.cmp, exists in the system. The Salesforce admin for the organization is unable to find and select the component while creating a quick action for the Account sObject.
What should the developer do to ensure that AddressValidation.cmp can be selected when creating a quick action?
A. Ensure the component implements the lightning:actionOverride interface. B. Ensure the component implements the force:lightningQuickAction interface. C. Ensure the access attribute of the aura:component tag is set to GLOBAL. D. Ensure the component implements the force:hasRecordId interface.
B. Ensure the component implements the force:lightningQuickAction interface.
Question 368:
Consider the following code snippet:
trigger OpportunityTrigger on Opportunity (before insert, before update) {
for(Opportunity opp : Trigger.new){
OpportunityHandler.setPricingStructure(Opp);
}
}
public class OpportunityHandler{
public static void setPricingStructure(Opportunity thisOpp){
Pricing_Structure_c ps = [Select Type_c FROM Pricing_Structure_c WHERE industry_c = :thisOpp.
Account_Industry_c];
thisOpp.Pricing_Structure_c = ps.Type_c;
update thisOpp;
}
}
Which two best practices should the developer Implement to optimize this code? (Choose Two)
A. Use a collection for the DML statement. B. Query the Pricing_structure__c records outside of the loop. C. Change the trigger context to after update, after insert. D. Remove the DML statement.
B. Query the Pricing_structure__c records outside of the loop. D. Remove the DML statement.
Explanation
The provided code violates two fundamental Salesforce Apex best practices: bulkification and efficient use of trigger contexts. First, the code performs a SOQL query inside a loop (setPricingStructure is called inside the trigger's for loop). This is a critical performance issue because it consumes one SOQL query per record in the transaction. If 200 opportunities are updated at once, the code will hit the governor limit of 100 SOQL queries and throw an exception. To optimize this, the developer should use a Map or List to query all necessary Pricing_Structure__c records once, outside the loop (Option B), and then reference that collection during processing.
Second, the code is running in a before trigger context. In a before insert or before update trigger, any changes made directly to the records in Trigger.new are automatically saved to the database when the trigger completes without the need for an explicit DML update statement. Including an update thisOpp; statement (Option D) is not only redundant but dangerous, as it can trigger a recursive loop where the update re-fires the same trigger, leading to a "Maximum stack depth reached" error. By removing the DML statement and bulkifying the query, the code becomes more efficient, scalable, and compliant with platform governor limits.
Question 369:
In a VisualForce page with a VisualForce component that has rendered set to false when the page loads, how can a developer ensure it will show on a re-render?
A. Set the re-render attribute of the component to true. B. Perform a full page refresh since rendered elements cannot be re-rendered without refreshing. C. Set the rendered attribute of the component to true and re-render the component. D. Set the rendered attribute of the component to true and re-render a parent component.
D. Set the rendered attribute of the component to true and re-render a parent component.
Question 370:
Which tag should a developer use to display different text while an <apex:commandButton> is executing versus not executing?
A. <apex:actionStatus> B. <apex:actionSupport> C. <apex:pageMessages> D. <apex:actionPoller>
A. <apex:actionStatus>
Explanation
In Visualforce, the <apex:actionStatus> component is specifically designed to provide user feedback during asynchronous (AJAX) operations. When an <apex:commandButton> or <apex:actionSupport> initiates a request to the server, there is a delay while the server processes the logic and returns the updated data. To prevent users from clicking the button multiple times or to simply inform them that the system is working, developers use <apex:actionStatus>.
This tag allows you to define two facets: startText (or a start facet) and stopText (or a stop facet). By linking the status attribute of the <apex:commandButton> to the id of the <apex:actionStatus>, the page will automatically toggle between these states. For example, while the button is processing, the status can display "Processing..." or a loading spinner, and once the action is complete, it can return to being hidden or display a "Completed" message.
Option D is used for timed, repeated requests. Option C is for displaying validation or system errors. Option B is used to add AJAX support to other components (like a picklist) but doesn't manage the display state of the request itself. Therefore, <apex:actionStatus> is the standard tool for managing UI state during the request- response lifecycle in Visualforce.
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.