Online Access Free PDII Exam Questions
| Exam Code: | PDII |
| Exam Name: | Platform Developer II |
| Certification Provider: | Salesforce |
| Free Question Number: | 163 |
| Posted: | Oct 16, 2026 |
Consider the following code snippet:78
Java
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?
The Account object has a field, Audit_Code__c, that is used to specify what type of auditing the Account needs and a Lookup to User, Auditor__c, that is the assigned auditor. When an Account is initially created, the user specifies the Audit_Code__c. Each User in the org has a unique text field, Audit_Code__c, that is used to automatically assign the correct user to the Account's Auditor__c field.
Trigger:
Java
trigger AccountTrigger on Account (before insert) {
AuditAssigner.setAuditor(Trigger.new);
}
Apex Class:
Java
public class AuditAssigner {
public static void setAuditor(List<Account> accounts) {
for (User u : [SELECT Id, Audit_Code__c FROM User]) {
for (Account a : accounts) {
if (u.Audit_Code__c == a.Audit_Code__c) {
a.Auditor__c = u.Id;
}
}
}
}
}
What should be changed to most optimize the code's efficiency?
A developer is writing code that requires making callouts to an external web service. Which scenario necessitates that the callout be made in an asynchronous method?
A developer created a class that implements the Queueable Interface, as follows:
Java
public class without sharing OrderQueueableJob implements Queueable {
public void execute(QueueableContext context) {
// implementation logic
System.enqueueJob(new FollowUpJob());
}
}
As part of the deployment process, the developer is asked to create a corresponding test class. Which two actions should the developer take to successfully execute the test class?1
Consider the queries in the options below and the following information:
* For these queries, assume that there are more than 200,000 Account records.
* These records include soft-deleted records in the Recycle Bin.
* There are two fields marked as External Id: Customer_Number__c and ERP_Key__c.
Which two queries are optimized for large data volumes?