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 61:
A developer notices the execution of all the test methods in a class takes a long time to run, due to the initial setup of all the test data that is needed to perform the tests.
What should the developer do to speed up test execution?
A. Define a method that creates test data and annotate with @testSetup. B. Define a method that creates test data and annotate with @createData C. Reduce the amount of test methods in the class. D. Ensure proper usage of test data factory In all test methods.
A. Define a method that creates test data and annotate with @testSetup.
Explanation
In Salesforce Apex testing, the @testSetup annotation is a powerful tool designed to improve test performance and reduce code redundancy. When a method is marked with @testSetup, it executes once before any of the individual test methods in the class run. The data created in this method is then persisted for the entire class.
The primary performance benefit comes from how Salesforce handles this data: the platform creates a "snapshot" of the database state after the setup method finishes. For every subsequent test method in the class, the system simply rolls back the database to this snapshot rather than re-executing the data creation logic. This significantly reduces the time spent on DML operations, which are often the most time-consuming part of a test suite.
Option D (Data Factories) is a best practice for code reuse, but if called inside every test method, it still results in redundant DML operations. Options B and C are incorrect; @createData is not a valid Salesforce annotation, and reducing the number of tests sacrifices code coverage and quality. By using @testSetup, a developer ensures that heavy data initialization happens only once, leading to faster execution cycles and more efficient resource usage during deployments.
Question 62:
A company has reference data stored in multiple Custom Metadata records that represent default information for certain address information.
When a Contact is inserted, the default information should be set on the Contact from the Custom Metadata records.
What is the optimal way to automate this?
A. Process Builder B. Apex Trigger C. Workflow Rule D. Visual Flow
A. Process Builder
Question 63:
A company has a custom component that allows users to search for records of a certain object type by invoking an Apex Controller that returns a list of results based on the user's input, when the search Is completed, a searchComplete event is fired, with the results put in a results attribute of the event. The component is designed to be used within other components and may appear on a single page more than once.
What is the optimal code that should be added to fire the event when the search has completed?
A. var evt = component.getEvent("searchComplete");evt.setParams({ results: results });evt.fire(); B. var evt = $A.get("e.c.searchComplete");evt.setParams({ results: results });evt.fire(); C. var evt = component.getEvent("searchComplete");evt.set("v.results", results);evt.fire(); D. var evt = $A.get("e.c.searchComplete");evt.set("v.results", results);evt.fire();
B. var evt = $A.get("e.c.searchComplete");evt.setParams({ results: results });evt.fire();
Question 64:
A developer wrote an Apex method to update a list of Contacts and wants to make it available for use by Lightning web components.
Which annotation should the developer add to the Apex method to achieve this?
A. @AuraEnabled B. @RemoteAction C. @RemoteAction(cacheable=true) D. @AuraEnable
D. @AuraEnable
Question 65:
How can a developer efficiently incorporate multiple JavaScript libraries, such as JQuery and MomenUS, in a Lightning Component?
A. Implement the libraries in separate helper files. B. Use CONs with script attributes C. Use JavaScript remoting and script tags. D. Join multiple assets from a static resource.
D. Join multiple assets from a static resource.
Question 66:
When developing a Lightning web component, which setting displays lightning-layout-items in one column on small devices, such as mobile phones, and in two columns on tablet-size and desktop-size screens?
A. Set size="12" tablet-device-size="6" B. Set size="6" small-device-size="12" C. Set size="12" medium-device-size="6" D. Set size="12" mobile-device-size="12"
B. Set size="6" small-device-size="12"
Explanation
The lightning-layout and lightning-layout-item components utilize a 12-column grid system to create responsive layouts. In this system, "12" represents the full width of the container (one column), while "6" represents half the width (two columns side-by-side). To manage responsiveness across different screen sizes, Salesforce provides specific attributes that target different breakpoints.
The size attribute defines the default width for the smallest devices (mobile). By setting size="12", the item takes up the full width of the screen on mobile devices, resulting in a single-column stack. The medium- device-size attribute targets tablets and small desktop screens. By setting medium-device-size="6", the layout item is instructed to occupy only half of the grid (6 out of 12 columns) once the screen reaches the "medium" breakpoint. When two adjacent items both have this setting, they will sit side-by- side, creating a two-column layout.
Option C is the correct answer because medium-device-size is the standard attribute used to transition from a mobile view to a tablet/desktop view in the Lightning Design System (SLDS) grid logic. Using size="12" ensures the "one column" requirement for mobile, and medium-device-size="6" satisfies the "two columns" requirement for larger screens.
Question 67:
Recently a Salesforce org's integration failed because it exceeded the number of allowed API calls in a 24-hour period. The integration handles a near real-time, complex insertion of data into Salesforce.
The flow of data is as follows:
1. The integration looks up Contact records with a given email address and, if found, the integration adds a Task to the first matching Contact it finds.
2. If a match is not found, the integration looks up Lead records with a given email address and, if found, the integration adds a Task to the first matching Lead it finds.
3. If a match is not found, the integration will create a Lead and a Task for that newly created Lead.
What is one way in which the integration can stay near real-time, but not exceed the number of allowed API calls in a 24-hour period?
A. Use the REST API as well as the SOAP API to effectively double the API calls allowed in a 24-hour period. B. write a custom Apex web service that, given an email address, does all of the logic the integration code was doing. C. Create several Apex InboundEmailHandlers to accept calls from the third-party system, thus bypassing the API limits. D. Create an Inbound Message that, using Flow, can do all of the logic the integration code was doing.
C. Create several Apex InboundEmailHandlers to accept calls from the third-party system, thus bypassing the API limits.
Question 68:
A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
A. Use the transient keyword for the List variables used in the custom controller. B. Use lazy loading to load the data on demand, instead of in the controller's constructor. C. Use JavaScript to move data processing to the browser instead of the controller. D. Use an <apex:actionPoller> in the page to load all of the data asynchronously.
A. Use the transient keyword for the List variables used in the custom controller.
Explanation
When a Visualforce page is slow because it attempts to load a massive dataset all at once, the bottleneck is often the time taken by the controller constructor to query and process those records before the page can even begin to render. Lazy Loading (Option B) is a strategy where the developer avoids loading all data during the initial page initialization.
Instead of querying 10,000 records in the constructor, the developer can load only the structural elements of the page first. Then, using an action method (triggered by <apex:actionFunction> or a window.onload script), the data is fetched in the background. This allows the user to see the page layout immediately while the data "populates" shortly after. This significantly improves the Time to First Byte (TTFB) and the perceived performance of the page.
Option A (transient) is excellent for reducing the View State size and speeding up postbacks (button clicks), but it does not inherently speed up the initial load time of a large dataset. Option C (JavaScript processing) can help but doesn't solve the data retrieval bottleneck. Option D (actionPoller) is used for periodic updates and is not an efficient way to load an initial large dataset. Lazy loading ensures that the "heavy lifting" is decoupled from the initial page load, providing a more responsive experience.
Question 69:
A developer must create a custom pagination solution. While users navigate through pages, if the data is changed from elsewhere, users should still see the cached results first accessed.
How can the developer meet these requirements?
A. Use @Cache annotation B. Use a StandardSetController C. Use OFFSET in SOQL queries D. Use OFFSET WITH CACHE in SOQL queries
B. Use a StandardSetController
Question 70:
A developer created a custom component to display an HTML table. The developer wants to be able to use the component on different Visualforce Pages and specify different header text for the table.
Which tag should the developer use inside the component?
A. <apex:variable> B. <apex:define> C. <apex:param> D. <apex:attribute>
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.