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 281:
A developer is working on a set of custom Aura components that can be Individually added to a home page. One of the components, c:searchAccounts, allows users to search for an Account and then select a specific found Account. Once selected, the other components. Should get other information related to the selected Account and display it.
Which event should the c: 2eazchRccounta component fire to make it known that an Account is selected?
A. An application event B. A refrestiview event C. A publish event D. A component event
D. A component event
Question 282:
If you have a method "doStuff(List<sObject> records)", which is a valid call?
A. doStuff([Select Id From Account]); B. doStuff(List<Account> records); C. doStuff(Account acct); D. doStuff(sObject obj);
A. doStuff([Select Id From Account]);
Question 283:
Universal Containers implements a private sharing model for the Convention_Attendance__c custom object.
As part of a new quality assurance effort, the company created an Event_Reviewer__c user lookup field on the object. Management wants the event reviewer to automatically gain Read/Write access to every record they are assigned to.
What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record?
A. Create an after-insert trigger on the Convention Attendee custom object, and use Apex sharing reasons and Apex managed sharing. B. Create a before-insert trigger on the Convention Attendee custom object, and use Apex sharing reasons and Apex managed sharing. C. Create a criteria-based sharing rule on the Convention Attendee custom object to share the records with a group of Event Reviewers. D. Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers.
A. Create an after-insert trigger on the Convention Attendee custom object, and use Apex sharing reasons and Apex managed sharing.
Explanation
In a private sharing model, access is restricted to the owner and those above them in the hierarchy. When a specific user is identified in a lookup field (like Event_Reviewer__c), standard sharing rules cannot dynamically grant access to that specific individual because sharing rules only target Roles, Public Groups, or Territories.
The solution is Apex Managed Sharing (Option A) . By using an after insert (and likely after update) trigger, the developer can programmatically create records in the object's "Share" table (e.g., Convention_Attendee__Share). Each share record specifies the UserOrGroupId (from the lookup field), the AccessLevel ('Edit' for Read/Write), and a RowCause (Apex Sharing Reason).
The "After" trigger is required because the ID of the Convention_Attendee__c record must exist before a Share record can be associated with it. "Before" triggers (Option B) are used for field updates on the record itself, not for creating related sharing records. Options C and D are not viable because they cannot dynamically reference a User ID stored within a field on the record itself. Apex Managed Sharing provides the most granular and automated way to handle this dynamic security requirement.
Question 284:
A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue?
A. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method. B. Move the prerequisite reference data setup to the constructor for the test class. C. Turn off triggers, flows, and validations when running tests. D. Move the prerequisite reference data setup to a @testSetup method in the test class.
D. Move the prerequisite reference data setup to a @testSetup method in the test class.
Explanation
The most effective way to optimize test performance when multiple test methods require the same set of records is to use the @testSetup annotation (Option D) .
When a method is marked with @testSetup, Salesforce executes it exactly once before any test methods in the class run. The platform then creates a "database snapshot" of those records. For every individual test method in the class, Salesforce simply rolls back the database to that snapshot rather than re-executing the DML operations required to create the records. This dramatically reduces the total number of DML statements and CPU time consumed during the test run.
In contrast, calling a TestDataFactory(Option A) from within every test method results in the same records being inserted and deleted repeatedly for every test case. If a class has 50 test methods, the records are created 50 times. With @testSetup, they are created once. Option C is not possible (you cannot programmatically disable these during a test run), and Option B is incorrect as test classes do not use constructors in this manner. Using @testSetup is the platform- recommended pattern for efficient, high-performance unit testing.
Question 285:
A developer created a Lightning web component that uses a Lightning-record-edit-force to collect information about Leads. Users complain that they only see one error message at a time when they save a Lead record.
What can the developer use to perform the validations, and allow multiple error messages to be displayed simultaneously?
A. Apex REST B. External JavaScript Library C. Apex Trigger D. Process Builder
B. External JavaScript Library
Question 286:
A developer is creating a Lightning web component that can be added to a Lightning App Page and displayed when the page Is rendered in desktop and mobile phone format. To ensure a great mobile experience, the developer chooses to use the SLDS grid utility.
Which two Lighting web components should the developer implement to ensure the application Is mobile-ready? (Choose Two)
A. <lightning-layou></lightning-layout> B. <lightning-tree-grid></lightning-tree-grid> C. <lightning-layout-item></lightning-layout-item> D. <lightning-tree></lightning-tree>
A. <lightning-layou></lightning-layout> C. <lightning-layout-item></lightning-layout-item>
Question 287:
Consider the following code snippet:
public class searchFeature {
public static List<List<object>> searchRecords(string searchquery) {
return [FIND :searchquery IN ALL FIELDS RETURNING Account, Opportunity, Lead];
}
}
// Test Class
@isTest
private class searchFeature_Test {
@TestSetup
private static void makeData() {
//insert opportunities, accounts and lead
}
private static searchRecords_Test() {
List<List<object>> records = searchFeature.searchRecords('Test');
System.assertNotEquals(records.size(),0);
}
}
A developer created the following test class to provide the proper code coverage for the snippet above:
However, when the test runs, no data is returned and the assertion fails. Which edit should the developer make to ensure the test class runs successfully?
A. Enclose the method call within Test. startTest () and Test , stop Test () B. Implement the seeAllData=true attribute in the @isTest annotation. C. Implement the without sharing keyword in the searchfeature Apex class. D. Implement the setFixedSearchResults method in the test class.
D. Implement the setFixedSearchResults method in the test class.
Explanation
When executing Salesforce Object Search Language (SOSL) queries within an Apex test context, the search engine does not actually search the database or the records created within the test setup by default. Instead, it returns an empty result set. This behavior ensures that tests run quickly and deterministically, without relying on the asynchronous indexing process of the full-text search engine.
To test code that utilizes SOSL, developers must define the expected search results explicitly using the Test. setFixedSearchResults(recordIds) method. This method accepts a list of Record IDs that the FIND clause should return. By implementing setFixedSearchResults in the test method before calling the searchFeature. searchRecords method, the SOSL query will return the specified test records, allowing the System. assertNotEquals assertion to pass. Options A (startTest/stopTest) helps with governor limits but does not fix SOSL results. Option B (SeeAllData) is generally discouraged and does not guarantee SOSL indexing availability. Option C (without sharing) affects record visibility but does not force the search engine to return un-indexed test data.
Question 288:
A developer Is writing a Listener for implementing outbound messaging. Which three considerations must the developer keep in mind in this case? (Choose Three)
A. Messages can be delivered out of order. B. Messages are retried Independent of their order In the queue. C. The session in an outbound message Is scoped for both API requests and UT requests. D. The Organization 1D is included only in the first outbound message. E. The Listener must be reachable from the public internet.
A. Messages can be delivered out of order. B. Messages are retried Independent of their order In the queue. C. The session in an outbound message Is scoped for both API requests and UT requests.
Question 289:
Universal Containers has an Apex trigger on Account that creates an Account Plan record when an Account is marked as a Customer. Recently a workflow rule was added so that whenever an Account is marked as a Customer, a 'Customer Since' date field is updated with today's date.
Since the addition of the workflow rule, two Account Plan records are created whenever the Account is marked as a Customer.
What might cause this to happen?
A. The workflow rule is configured to evaluate when a record is created and every time it is edited. B. The flow is configured to use an 'Update Records' element. C. The Apex trigger does not use a static variable to ensure it only fires once. D. The Apex trigger is not bulk safe and calls insert inside of a for loop.
C. The Apex trigger does not use a static variable to ensure it only fires once.
Explanation
This is a classic case of trigger recursion caused by the Salesforce Order of Execution. When an Account is updated to "Customer," the following occurs:
The original "Before" and "After" triggers run. The After trigger creates the first Account Plan.
The Record-Triggered Flow executes and updates the "Customer Since" date field.
Because a Flow (or Workflow) performed a field update, Salesforce re-triggers the Apex triggers on the Account object to ensure any logic dependent on that new date field is executed.
During this second pass, the After trigger runs again and, seeing the status is still "Customer," creates a second Account Plan.
To prevent this, developers use a static variable (Option C) in a handler class to act as a "recursion guard." Static variables persist for the duration of the entire transaction. By checking this variable at the start of the trigger, the code can detect that it has already run once and skip the record creation on the second pass. Option A and B describe standard Flow behavior but are not the "fix" for the trigger logic. Option D would cause issues with limits but wouldn't necessarily cause a double-fire unless recursion was involved.
Question 290:
What is the transaction limit on the max timeout for all callouts?
A. 120 seconds B. 60 seconds C. 120 seconds (synchronous); 200 seconds (async) D. 60 seconds (synchronous); 200 seconds (async E. There is no limit
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.