PDII Salesforce Exam Practice Questions
PDII Salesforce Exam Practice Questions
What's Inside:
Important Note:
For full access to the complete question bank and topic-wise explanations, visit:
CertQuestionsBank.com
FB page: https://www.facebook.com/certquestionsbank
Share some PDII exam online questions below.
1.A developer is creating a Lightning web component that displays a list of records in a lightning-
datatable.
After saving a new record to the database, the list is not updating
What should the developer change in the code above for this to happen?
A. Create a new variable to store the result and annotate it with @track.
B. Call refreshApex () On this .data.
C. Create a variable to store the result and call refreshApex ()
D. Add the @track decorator to the data variable.
Answer: C
2.The test method above tests an Apex trigger that the developer knows will make a lot of queries
when a lot of Account are simultaneously updated to be customer.
The test method fails at the Line 20 because of too many SOQL queries
What is the correct way to fix this?
A. Add TesLstartTest() before and Test.stop Test() after both Line 7 of the code and Line 20 of the
code.
B. Change the DataFactory class to create fewer Accounts so that the number of queries in the
trigger is reduced.
C. Add TeststartTest() before Line 18 of the code and add Test.stopTest() after line 18 of the code.
D. Replace most of the Apex Trigger with Process Builder processes to reduce the number of queries
in the trigger.
Answer: C
3.How can a developer efficiently incorporate multiple JavaScript libraries, such as JQuery and
Momen US, 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.
Answer: C
4.A developer is asked to build a solution that will automatically send an email to the Customer when
an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The
criteria to send the email should be evaluated after all Workflow Rules have fired.
What is the optimal way to accomplish this?
A. Use a Workflow Email Alert.
B. Usea MassEmailMessage() with an Apex Trigger.
C. Use a SingleEmailMessage() with an Apex Trigger.
D. Use an Email Alert with Process Builder.
Answer: D
5.A developer is building a Lightning web component that retrieves data from Salesforce and assigns
it to the record property.
What must be done in the component to get the data from Salesforce?
A)
B)
C)
D)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
6.A company uses Opportunism to track sales to their customers and their org has millions of
Opportunities. They want to begging to track revenue over time through a related Revenue object.
As part of their initial implementation, they want to perform a one-time seeding of their data by
automatically creating and populating Revenue records for Opportunities, based on complex logic.
They estimate that roughly 100,000 Opportunities will have revenue records and populated.
What is the optimal way to automate this?
A. Use System.enqueueJob>() to Invoke a Queueable class.
B. Use System.scheduleJob() to schedule a Database.Scheduleable class.
C. Use Database.executeBatch() to invoke a Queueable dass.
D. Use Database.txtcuteBatch() to invoke a Database.Batchable class.
Answer: D
7.An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed
and Won. This trigger is working great, except (due to a recent acquisition) Opportunity records need
to be loaded into the Salesforce instance.
When a test batch of records are loaded, the Apex trigger creates Contract records. A developer is
tasked with preventing Contract records from being created when mass Loading the Opportunities,
but the daily users still need to have the Contract records created.
What is the most extendable way to update the Apex trigger to accomplish this?
A. Add a validation rule to the Contract to prevent Contract creation by the user who loads the data.
B. Add the Profile ID of the user who loads the data to the trigger, so the trigger will not fire for this
user.
C. Use a list custom setting to disable the trigger for the user who loads the data.
D. Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who loads
the data.
Answer: D
B)
C)
D)
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
10.A Visualforce page contains an industry select list and displays a table of Accounts that have a
matching value in their Industry field.
When a user changes the value in the industry select list, the table of Accounts should be
automatically updated to show the Accounts associated with the selected industry.
What is the optimal way to implement this?
A. Add an <apex: actionFunction> within the <apex : selectOptions>.
B. Add an <apex: actionFunction> within the <apex: select List >.
C. Add an <apex: actionSupport> within the <apex:selectList>.
D. Add an <apex: actionSupport> within the <apex: selectOptions>.
Answer: B
11.A developer creates a Lightning web component to allow a Contact to be quickly entered-
However, error messages are not displayed.
Which component should the developer add to the form to display error messages?
A. apex:messages
B. aura:messages
C. lightning-messages
D. lightning-error
Answer: C
12.After a Platform Event is defined in a Salesforce org, events can be published via which two
mechanisms? Choose 2 answers
A. internal Apps can use Outbound Messages
B. Internal Apps can use Process Builder.
C. External Apps require a custom Apex web service.
D. External Apps can use the standard Streaming API.
Answer: B,D
Explanation:
internal apps can use processes, flows, or Apex to publish platform event messages from a
Salesforce app. Process Builder is a tool that lets you automate business processes by creating
processes. You can use Process Builder to publish platform event messages when a record changes
or when a platform event occurs.
external apps can use Salesforce APIs to publish platform event messages. You can use any
Salesforce API to create platform events, such as SOAP API, REST API, or Bulk API. The Streaming
API is a Salesforce API that lets you push a stream of notifications from Salesforce to external apps.
You can use the Streaming API to publish platform event messages by creating records of your event
type.
Therefore, using Process Builder and Streaming API are two mechanisms to publish platform event
messages after a platform event is defined in a Salesforce org.
https://developer.salesforce.com/docs/atlas.en-
us.platform_events.meta/platform_events/platform_events_publish.htm
13.A developer wrote a test class that successfully asserts a trigger on Account. It fires and updates
data correctly in a sandbox environment.
A salesforce admin with a custom profile attempts to deploy this trigger via a change set into the
production environment, but the test class fails with an insufficient privileges error.
What should a developer do to fix the problem?
A. Add system.runAd ( ) to the best class to execute the trigger as a user with the correct object
permissions.
B. Configure the production environment to enable ‘’Run All tests as Admin User.’’
C. Verify that Test, statement ( ) is not inside a For loop in the test class.
D. Add seeAllData=true to the test class to work within the sharing model for the production
environment.
Answer: A
14.An org records customer order information In a custom object, Orcer__c, that has fields for the
shipping address. A developer is tasked with adding code to calculate shipping charges on an order,
based on a fiat percentage rate associated with the region of the shipping address.
What should the developer use to store the rates by region, so that when the changes are deployed
to production no additional steps are
needed for the calculation to work?
A. Custom object
B. Custom metadata type
C. Custom list setting
D. Custom hierarchy setting
Answer: B
15.An org has a Process Builder process on Opportunity that sets a custom field,
CommissionBaseAmount__c, when an Opportunity is edited and the Opportunity's Amount changes.
A developer recently deployed an Opportunity before update trigger that uses the
CommissionBaseAmount__c and complex logic to calculate a value for a custom field
CommissionAmount_c, when an Opportunity stage changes to Closed/Won.
Users report that when they change the Opportunity to Closed/Won and also change the Amount
during the same save, the C:rr.i;5icnA.T.cur.t c is incorrect.
Which two actions should the developer take to correct this problem? Choose 2 answers
A. Call the trigger from the process.
B. Uncheck the recursion checkbox on the process.
C. Use a static Boolean variable in the trigger.
D. Call the process from the trigger.
Answer: A,C
When a Lightning web component is rendered, a list of opportunity that match certain criteria should
be retrieved from the database and displayed to the end-user.
Which three considerations must the developer implement to make the fetchOpps method available
within the Lightning web component?
A. The fetchOpps method must be annotated with the @InvocableMethod annotation.
B. The fetchOpps method must specify the (continustion-true) attribute
C. The fetchOpps method cannot mutate the result set retrieved from the database.
D. The fetchOpps method must specify the (cacheable =true) attribute
E. The fecthOpps method must be annotated with the @ AuraEnabled annotation.
Answer: C,D,E
17.Universal Containers (UC) wants to develop a customer community to help their customers log
issues with their containers. The community needs to function for their German- and Spanish-
speaking customers also. UC heard that it's easy to create an international community using
Salesforce, and hired a developer to build out the site.
What should the developer use to ensure the site is multilingual?
A. Use Custom Settings to ensure custom messages are translated properly.
B. Use Custom Labels to ensure custom messages are translated property.
C. Use Custom Metadata to translate custom picklist values.
D. Use Custom Objects to translate custom picklist values.
Answer: B
18.A developer is writing a Jest for a Lightning web component that conditionally displays child
components based on a user’s checkbox selections.
What should the developer do to property test that the correct components display and hide for each
scenario?
A. Reset the DOM after each test with the after Each method.
B. Add a teardown block to reset the DOM after each test.
C. Create a new describe block for each test
D. Create a new jsdom instance for each test
Answer: C
19.Which two best practices should the developer Implement to optimize this code?
Choose 2 answers
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.
Answer: B,D
20.Just prior to a new deployment, the Salesforce Administrator who configured a new order
fulfillment process in a developer sandbox suddenly left the company. The users had fully tested all of
the changes in the sandbox and signed off on them.
Unfortunately, although a Change Set was started, it was not complete. A developer is brought in to
help finish the deployment.
What should the developer do to identify the configuration changes that need to be moved into
production?
A. Leverage the Setup Audit Trail to review the changes made by the departed Administrator and
identify which changes should be added to the Change Set.
B. Use the Metadata API and a supported development IDE to push all of the configuration from the
sandbox into production to ensure no changes are lost.
C. Set up Continuous Integration and a Git repository to automatically merge all changes from the
sandbox metadata with the production metadata.
D. In Salesforce setup, look at the last modified date for every object to determine which should be
added to the Change Set.
Answer: A
21.Universal Containers (UC) has enabled the translation workbench and has translated picklist
values. UC has a custom multi-select picklist field, Products__z, on the Account object that allows
sales reps to specify which of UC's products an Account already has. A developer is tasked with
writing an Apex method that retrieves Account records, Including product_c field.
What should the developer do to ensure the value of Products__c is in the current user's language?
A. Set the locale on each record in the SOQL result list.
B. Use the locale clause in the SOQL query.
C. Use toLabel1 Products_c in the fields list of the SOQL query.
D. Call the translate ( ) method on each record in the SOQL result list.
Answer: C
22.A company has a Lightning Page with many Lightning Components, some that cache reference
data. It is reported that the page does not always show the most current reference data.
What can a developer use to analyze and diagnose the problem in the Lightning Page?
A. Salesforce Lightning Inspector Storage Tab
B. Salesforce Lightning Inspector Actions Tab
C. Salesforce Lightning Inspector Event Log Tab
D. Salesforce Lightning Inspector Transactions Tab
Answer: A
23.Which method should be used to convert a Date to a String in the current user's locale?
A. Date.format
B. Date.parse
C. String.format
D. String. valueOf
Answer: A
As part of the deployment cycle, a developer creates the following test class:
When the test class runs, the assertion fails.
Which charge should the developer implement in the Apex test method to ensure the test method
execute successfully?
A. Query the Standard User into memory and enclose lines 14 and 15 within the System.runAs (user)
method.
B. Add System.runAs (User) to line 14 and enclose line 14 within Test.startTest() and Test.stoptest ().
C. Query the Administrator user into memory and enclose lines 14 and 15 within the System,runAs
(user) method.
D. Add @IsTest(seeAllData=True) to line 12 and enclose lines 14 and 15 within Test.startTest () and
test.stopTest()
Answer: B
25.A company has a Lightning Page with many Lightning Components, some that cache reference
data. It is reported that the page does not always show the most current reference data.
What can a developer use to analyze and diagnose the problem in the Lightning Page?
A. Salesforce Lightning Inspector Storage Tab
B. Salesforce Lightning Inspector Actions Tab
C. Salesforce Lightning Inspector Event Log Tab
D. Salesforce Lightning Inspector Transactions Tab
Answer: A
26.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
Answer: D
An external system with Account information and sets the Account's Integration-Updated___ c
checkbox to True when it completes.
The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web
service callouts."
What is the optimal way to fix this?
A. Add if ('Test.isRunningTest I)) around calloutUtil.sendAccountUpdate.
B. Add Test.startTest ()before and Test.stopTest () after CallcutoutUtil. sendAccoutUpdate.
C. Add Test.startTest before and Test.setMock and Test. stoptest () after
CallloutUtil.sendAccountUpdate.
D. Add Test.startTest() and Test .setMock before and Test.stopTest () after
CalloutUtil.sendAccountUpdate.
Answer: D
Get PDII exam dumps full version.