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 321:
A developer migrated functionality from JavaScript demoting to a Lightning web component and wants to use the existing getOpportunities() method to provide data.
Which modification to the method is necessary?
A. A The method must be decorated with uraEnabled. B. The method must return a JSON Object. C. The method must be decorated with (cacheable=true). D. The method must return a String of a serialized JSON Array.
A. A The method must be decorated with uraEnabled.
Question 322:
A company has a custom object, Order__c, that has a required, unique, external ID field called Order_Number__c. Which statement should be used to perform the DML necessary to insert new records and update existing records in a List of Order__c records?
A. upsert orders; B. merge orders; C. merge orders Order_Number__c; D. upsert orders Order_Number__c;
D. upsert orders Order_Number__c;
Question 323:
Universal Containers uses a custom Lightning page to provide a mechanism to perform a step-by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERP_Number__c, that is then used in a query to find matching Accounts.
A developer receives the exception 'SOQL query not selective enough.
Which step should be taken to resolve the issue?
A. Move the SOQL query to within an asyncronous process. B. Mark the ERP_Number__c field as an external ID. C. Change the query to use a SOSL statement instead of SOQL. D. Mark the ERP_Number__c field as required.
B. Mark the ERP_Number__c field as an external ID.
Explanation
The "SOQL query not selective enough" error occurs when a query on an object with a large volume of records (typically over 200,000) does not use a filtered index to narrow down the result set effectively. In Salesforce, the query optimizer must be able to use an index to scan a small enough percentage of the total records to maintain performance. When a query filters on a non-indexed field, the system is forced to perform a full table scan, which triggers this exception to prevent performance degradation.
To resolve this, the developer must ensure that the field used in the WHERE clause is indexed. Marking a custom field as an "External ID" or "Unique" automatically creates a custom index on that field. By marking ERP_Number__c as an External ID, the platform generates a underlying database index, allowing the query optimizer to quickly locate matching records without scanning the entire table. While the LIKE operator with a trailing wildcard (e.g., 'Text%') can utilize an index, it will only be considered "selective" if the filter narrow the results below the platform's selectivity thresholds (typically 10% of the first million records). Making the field an External ID is the standard programmatic solution to provide the necessary indexing for selectivity. Option A is incorrect because moving a non-selective query to an asynchronous process does not change the fact that it is non-selective; it will still fail.
Question 324:
What is the transaction limit on the max Salesforce CPU time?
A. 100 seconds B. 60 seconds C. 100 seconds (synchronous); 200 seconds (async) D. 10 seconds (synchronous); 60 seconds (async) E. There is no limit
D. 10 seconds (synchronous); 60 seconds (async)
Question 325:
Exhibit:
trigger ContactTrigger on Contact (before insert) { List<Id> accountIds = new List<Id>();
for (Contact c : Trigger.new) { accountIds.add(c.AccountId);
}
for (Account a : [ SELECT Id, Industry FROM Account WHERE Id IN :accountIds ]) {
for (Contact c : Trigger.new) {
if (c.AccountId == a.Id) { ContactUtil.setDefaultsOnContact(c, a);
}
}
}
}
What can be done to improve the performance of the insert trigger shown above?
A. for (Contact c : Trigger.new) {ContactUtil.setDefaultsOnContact(c, c.Account);} B. Map<Id, Contact> conMap = new Map<Id, Contact>([SELECT Id, Account.IndustryFROM ContactWHERE Id IN :Trigger.newMap.keySet()]);for (Contact c : Trigger.new) {ContactUtil.setDefaultsOnContact(c, conMap.get(c.Id).Account);} C. Map<Id, Account> acctMap = new Map<Id, Account>([SELECT Id, IndustryFROM AccountWHERE Id IN :accountIds]);for (Contact c : Trigger.new) {ContactUtil.setDefaultsOnContact(acctMap.get(c.AccountId));} D. Map<Id, Contact> conMap = new Map<Id, Contact>([SELECT Id, Account.IndustryFROM ContactWHERE AccountId IN :accountIds]);for (Contact c : Trigger.new) {ContactUtil.setDefaultsOnContact(c, conMap.get(c.Id).Account);}
D. Map<Id, Contact> conMap = new Map<Id, Contact>([SELECT Id, Account.IndustryFROM ContactWHERE AccountId IN :accountIds]);for (Contact c : Trigger.new) {ContactUtil.setDefaultsOnContact(c, conMap.get(c.Id).Account);}
Question 326:
A customer has a single Visualforce page that allows each user to input up to 1500 sales forecasts and instantly view pivoted forecast calculations. Users are complaining that the page is loading slowly, and they are seeing error messages regarding heap and view state limits.
What are three recommendations to optimize page performance? (Choose three.)
A. Segregate calculation functionality from input functionality B. Specify the list of sales forecasts as transient C. Implement pagination and reduce records per page D. Create formula fields to compute pivoted forecast calculations E. Use JavaScript Remoting instead of controller actions
A. Segregate calculation functionality from input functionality C. Implement pagination and reduce records per page E. Use JavaScript Remoting instead of controller actions
Question 327:
Universal Containers wants to use a Customer Community with Customer Community Plus licenses so their customers can track how many of containers they are renting and when they are due back. Many of their customers are global companies with complex Account hierarchies, representing various departments within the same organization. One of the requirements is that certain community users within the same Account hierarchy be able to see several departments' containers, based on a junction object that relates the Contact to the various Account records that represent the departments.
Which solution solves these requirements?
A. A Lightning web component on the Community Home Page that uses Lightning Data Services. B. An Apex Trigger that creates Apex Managed Sharing records based on the junction object's relationships C. A Custom List View on the junction object with filters that will show the proper records based on owner D. A Visualforce page that uses a Custom Controller that specifies without sharing to expose the records
B. An Apex Trigger that creates Apex Managed Sharing records based on the junction object's relationships
Explanation
The "Customer Community Plus" license is distinct because it supports advanced sharing features, including Apex Managed Sharing. In a Private sharing model, a standard community user can only see records they own or those shared with them via the role hierarchy (if applicable). Since the requirement involves granting access based on a complex relationship defined in a junction object , standard sharing rules are insufficient because they cannot "walk" the relationship of the junction object to determine access.
Apex Managed Sharing (Option B) allows a developer to bridge this gap. A trigger can be written on the junction object. When a relationship is created between a Contact (Community User) and an Account (Department), the trigger can insert a record into the AccountShare table (or the share table of the container object). This share record explicitly grants the User 'Read' access to the related records.
Option D is an "anti-pattern" because using without sharing to bypass security is a security risk and doesn't actually grant record access for standard platform features; it only hides the restriction within that specific page. Option A and C are UI-level solutions and do not address the underlying record-level security (sharing) required for a Private OWD model. Apex Managed Sharing provides a robust, programmatic way to enforce complex, data-driven security requirements in a Community environment.
Question 328:
A company requires an external system to be notified whenever an account is updated.
trigger AccountTrigger on Account (after update) {
for (Account updatedAccount : Trigger.new) { AccountTriggerHelper.notinyxternalSystem(updatedAccount.Id);
}
}
public class AccountTriggerHelper {
@future(callout=true) public static void notinyxternalSystem(Id accountId) { Account acc = [ SELECT Id, Name FROM Account WHERE Id = :accountId ];
What LimitException could the following code trigger?
A. System.LimitException: Too many future calls B. System.LimitException: Too many callouts C. System.LimitException: Too many SOQL queries D. System.CalloutException: Callout from triggers are currently not supported
A. System.LimitException: Too many future calls
Question 329:
A developer needs a Lightning web component to display in one column on phones and two columns on tablets/desktops. Which should the developer add to the code?
A. Add size="12" medium-device-size="6" to the <lightning-layout-item> elements B. Add size="6" small-device-size="12" to the <lightning-layout-item> elements C. Add small-device-size="12" to the <lightning-layout-item> elements D. Add medium-device-size="6" to the <lightning-layout-item> elements
A. Add size="12" medium-device-size="6" to the <lightning-layout-item> elements
Explanation
The lightning-layout grid system uses a 12-column model. To achieve a responsive design, developers use attributes that target different screen breakpoints.
size: Defines the default size (usually targeting the smallest devices if no other attributes are present).
medium-device-size: Targets tablets and small desktops.
large-device-size: Targets large monitors.
To show one column on a phone, an item must occupy all 12 columns (size="12"). To show two columns on a tablet/desktop, each item must occupy 6 columns (medium-device-size="6").
Option A correctly implements this. While small-device-size exists, the size attribute itself typically serves as the baseline for small devices. If you set size="12" and medium-device-size="6", the component will "stack" on phones and sit side- by-side on anything larger.
Question 330:
A company has a native iOS app for placing orders that needs to connect to Salesforce to retrieve consolidated information from many different objects in a JSON format.
Which is the optimal method to implement this in Salesforce?
A. Apex SOAP Callout B. Apex REST Callout C. Apex SOAP Web Service D. Apex REST Web Service
D. Apex REST Web Service
Explanation
When an external application needs to request data from Salesforce, you must expose an endpoint. Since the requirement specifically mentions JSON format and a native mobile app (iOS), an Apex REST web service (Option D) is the optimal choice. REST (Representational State Transfer) is the industry-standard architecture for mobile-to-cloud integrations because it is lightweight, uses standard HTTP methods, and natively supports JSON.
By using the @RestResource and @HttpGet annotations in an Apex class, a developer can create a custom endpoint that performs complex logic, such as querying multiple objects (Accounts, Orders, Line Items), and returns a single, consolidated JSON response. This is far more efficient than the standard REST API if the mobile app would otherwise need to make multiple sequential calls to gather the same information.
Options A and B are incorrect because "callouts" are used when Salesforce requests data from an external system, not the other way around. Option C (SOAP) is a heavier, XML-based protocol that is less efficient for mobile development and does not use the JSON format natively. Therefore, a custom Apex REST service provides the best performance and flexibility for mobile integrations.
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.