Set 7
Set 7
nojce
Object Name:
Region<
Fields:
zip codea o (Text)
Region Name < (Text)
Cloud Kicks wants a trigger on the Lead to populate the Region based on
the Lead's zip code.
Which code segment is the most efficient way to fulfill this request?
zipa.add(l.PogstalCode) ;
A.@Q set«<String> zip2 = new Sec<String>();
for(Lead 1 : Trigger.new)
if(l.PostalCeode != Null) {
zips.add(l.PostalCode) ;
for(Lead 1 : Trigger.new) {
if(l.PostalCode != Null) {
l1.Regicon¢ = zipMap.get (l.PostalCode);
}
}
What is the optimal way for a developer to get the total number of
Opportunities for the Lightning component?
[
Salesforce Certified Platformm Developer II - Multiple Cholice
A.() Setup debug logging for every Sales Rep, then monitor the logs for errors and
exceptions.
B. O Disable all flows, and then re-enable them one at at time to see which one causes the
error,
Cs O Run the Apex Test Classes for the Apex trigger to ensure the code still has sufficient
code coverage.
D@ Add system.debug() statements to the code and use the Developer Console logs to
trace the code,
In the preceding Apex code, how can the developer alter the query
statement to use SOQL features to prevent race conditions within a
transaction?
A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces
information about Leads by wire calling gecFerchleadli=r when certain criteria are met,
Which three changes should the developer implement in the Apex class above to ensure the LWC can
display data efficiently while preserving security?
A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces
information about Leads by wire calling getFetchleadlist when certain criteria are met,
which three changes should the developer implement in the Apex class above to ensure the LWC can
display data efficiently while preserving security?
Choose 3 answers
A. O Implement the withour sharing keyword in the class declaration.
B. Use the WITH SECURITY_ENFORCED clause within the SOQL query.
C. Annotate the Apex method with GauraEnabled(Cacheable=trus).
D. Implement the with sharing keyword in the class declaration.
E. () Annotate the Apex method with ZauraZnabled.
A, O Event Monitoring
8.@ Custom Apex REST
e O SObject Tree REST
0.O Invocable Action
J Ol OZ. LOlNisider uie Apex Clidass PDelow Liial dgelines a emmoteAcCLIon useua
@RemcocteAction
global static Account getAccount (String accountName) ({
account = [SELECT Id, Name, NumberOfEmplovees
FROM Account WHERE Name = :accountName]:
retuxrn account;
Which code snippet will assert that the remote action returned the correct
Account?
A.(:).Account a = controller.getAccount('TestAccount'):
Sysrem.assercEquals( 'TescliAccount', a.Name );
C.@ Use the sLocale value provider to retrieve the user preferences.
D. O Use the $U=z=x global variable to retrieve the user preferences,
The list of blocked domains is stored Iin a custom object for ease of
maintenance by users. The survey Response ¢ object is populated via a
custom Visualforce page.
A Implement the logic in a helper class that is called by an Apex trigger on Contact and
from the custom Visualforce page controller.
B.O Implement the logic in validation rules on the Contact and the Survey_Response_¢
objects.
Ca O Implement the logic in the custom Visualforce page controller and call that method
from an Apex trigger on Contact.
D. O Implement the logic in an Apex trigger on Contact and also implement the logic within
the custom Visualforce page controller.
10 of 62. A developer created an Opportunity trigger that updates the account rating when an
associated opportunity is considered high value. Current criteria for an opportunity to be considered
high value is an amount greater than or equal to $1,000,000. However, this criteria value can
change over time.
There is a new requirement to also display high value opportunities in a Lightning web component.
wWhich two actions should the developer take to meet these business requirements, and also prevent
the business logic that obtains the high value opportunities from being repeated in more than one
place?
Choose 2 answers
A Create a helper class that fetches the high value opportunities.
B. D Leave the business logic code inside the trigger for efficiency.
R D Call the trigger from the Lightning web component.
D. Use custom metadata to hold the high value amount,
11 of 62. A large company uses Salesforce across several departments. Each department has its
own Salesforce Administrator. It was agreed that each Administrator would have their own sandbox
in which to test changes.
Recently, users notice that fields that were recently added for one department suddenly disappear
without waming.
Which two statements are true regarding these issues and resolution?
Choose 2 answers
A (") The administrators are deploying their own Change Sets over each other,
thus replacing entire Page Layouts in production.
B. M A sandbox should be created to use as a unified testing environment instead
of deploying Change Sets directly to production.
e Page Layouts should never be deployed via Change Sets, as this causes
Field-Level Security to be reset and fields to disappear.
D. O The administrators are deploying their own Change Sets, thus deleting each
other's fields from the objects in production.
What must be done in the component to get the data from Salesforce?
What should the developer do to properly test that the correct components
display and hide for each scenario?
14 of 62. A developer sees test fallures Iin the sandbox but not In
production. No code or metadata changes have been actively made to
either environment since the sandbox was created.
A. () Query the FiracDayOrweek field from the Locale for the current user.
B. Use UserIinfo.ge=tlocals= () in the component.
m |
Time Remaining: 01:29:07 m
m!
Time Remaining: 01:29:01 m
What should be used to automatically give Read access to the record when
the lookup field is set to the Interviewer user?
m |
Time Remaining: 01:28:57 m
m |
Time Remaining: 01:28:540
m |
Time Remaining: 01:28:51 m
21 of 62. A company notices that their unit tests in a test class with many
methods to create many records for prerequisite reference data are slow,
m |
Time Remaining: 01:28:48 m
A@ Application Event
B. O DML Operation
m |
Time Remaining: 01:28:449 m
23 of 62. A company has reference data stored in multiple custom metadata records that represent
default information and delete behavior for certain geographic regions.
when a contact is inserted, the default information should be set on the contact from the custom
metadata records based on the contact's address information. Additionally, if a user attempts to
delete a contact that belongs to a flagged region, the user must get an error message.
Depending on company personnel resources, what are two ways to automate this?
Choose 2 answers
A Flow Builder
B. D Apex invocable method
C. Apex trigger
m |
Time Remaining: 01:28:40@
@isTest
static void testIncrement() ¢
Account acct = new Account (Name = 'Test'):
acct.Number
Of Times Viewed < = 0;
insert acct:
AuditUtil.incrementViewed (acct.Id);
Account acctAfter = [SELECT Number
Of Times Viewed ¢ FROM
Account WHERE Id = :acct.Id][0]:
System.assertEguals
(1,
acctAfter.Number
Of Times Viewed c):
}
26 of 62. A Visualforce page loads slowly due to the large amount of data
it displays.
A Use lazy loading to load the data on demand, instead of in the controller's constructor.
B. O Use the transient keyword for the List variables used in the custom controller.
C.(O) Use an <apex:actionPoller> in the page to load all of the data asynchronously.
D. O Use JavaScript to move data processing to the browser instead of the controller.
27 of 62. A developer created a Lightning web component that allows users to input a text value
that Iis used to search for Accounts by calling an Apex method. The Apex method returns a list of
AccountWrappers and is called imperatively from a JavaScript event handler.
01l1:
02: public class AccountSearcher {
C3:
Which two changes should the developer make so the Apex method functions correctly?
Choose 2 answers
A Add GAuraEnabled to line 03,
B. Add GauraEnabled to lines 11 and 12,
o D Add GAuraEnabl=d to line 01.
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@ Use a hierarchy custom setting to skip executing the logic inside the trigger for the
user who loads the data.
B. O Add the Profile ID of the user who loads the data to the trigger, so the trigger will not
fire for this user.
C.O Add a validation rule to the Contract to prevent Contract creation by the user who
loads the data.
D. O Use a list custom setting to disable the trigger for the user who loads the data.
'/
Salesforce Certified Platform Developer II - Multiple Choice
How should the developer write this Apex code without running into
governor limits and system limitations?
A, O Use Limits class to stop entire process once governor limits are reached.
8.@ Use Queueable Apex to chain the jobs to run sequentially.
82 O Use multiple Efuture methods for each process and callout.
D. O Use Apex Scheduler to schedule each process.
'/
Salesforce Certified Platform Developer II - Multiple Choice
31 of 62. A company recently deployed a Visualforce page with a custom controller that has a data
grid of information about Opportunities in the org. Users report that they receive a "Maximum view
state size limit" error message under certain conditions.
According to Visualforce best practice, which three actions should the developer take to reduce the
view state?
Choose 3 answers
A. D Use the final keyword in the controller for variables that will not change.
B. Use the transient keyword in the Apex controller for variables that do not
maintain state.
C. Use filters and pagination to reduce the amount of data.
D. O Use the private keyword in the controller for variables,
E. Refine any SOQL queries to return only data relevant to the page.
32 of 62. Consider the queries in the options below and the following information:
e For these queries, assume that there are more than 200,000 Account records.
e These records include soft-deleted records; that is, deleted records that are still in the Recycle
Bin.
e There are two fields that are marked as External Id on the Account., These fields are
Customer Number < and ERP_Key
<.
Choose 2 answers
A SELECT Id FROM Account WHERE Id IN :alistVariable
B.(C) SELECT Id FROM Account WHERE Name != NULL
C. SELECT Id FRCM Account WHERE Name != '' AND Customer Number c =
'Valuel'
D.D SELECT Id FROM Account WHERE Name != '' AND IsDeleted = false
'/
Salesforce Certified Platform Developer II - Multiple Choice
<aura:compeonent
implements="force:hasRecordld, flexipage:availableForAllPageTyps
<div>Hello!</div>
</aura:component>
How can the component's controller get the context of the Lightning page
that the sObject is on without requiring additional test coverage?
{
Account a = [SELECT Id, Name FROM Account WHERE CreatedDate
= TODAY LIMIT 5):
c.AccountlId = a.Id:;
update c;
Assuming there were 10 Contacts and five Accounts created today, what is
the expected result?
'/
Salesforce Certified Platform Developer II - Multiple Choice
<template>
<lightning-record-edit-form
object—-api-name="Contact">
<lightning-input-field field-name="FirstName">
</lightning-input-field>
<lightning-input-field fisld-name="LastName">
</lightning-input-field>
<lightning-input-field field-name="Email"></lightning-
input-field>
<lightning-button type="submit"
name="submit"
label="Create Contact">
</lightning-button>
—
B. O aura:messages
C.O lightning-error
D@ lightning-meszsages
‘-j"“"' t Y","'
'/
Salesforce Certified Platform Developer II - Multiple Choice
36 of 62. Which tag should a developer use to display different text while
an <apex:commandButton> IS processing an action?
A, O <apex:pageMesgs=zages>
B.O <apex:actionPoller>
C.O <apex:acrtionSupporct>
D@ <apex:acticonStatus>
A. O Change Sets
'/
Salesforce Certified Platform Developer II - Multiple Choice
Which feature can be used to ensure that the variables are testable in both
Production and all Sandboxes?
A@ Custom metadata
B. () Custom setting
C. O Custom variable
Assuming the Name field exists, how should the developer do this?
A@ Cast each object into an sObject and use 2Coject.get ( ‘Name’ ) to compare the Name
fields.
B. O Invoke a Schema.describe () function to compare the values of each Name field.
C. O Use the Salesforce Metadata API to extract the value of each object and compare the
Name fields.
D. O Use a String.replac= () method to parse the contents of each Name field and then
compare the results.
12 1)
13 .catch( (exrrorxr) => |{
14 conscle.erxor{exrxror):
1S }):
14 conacle.erxor{exror):
18 ¥):
16 }
27 )
Given the code above, which two changes need to be made in the Apex Controller for the code to
work?
Choose 2 answers
A Change the argument in the Apex Controller line 05 from sCbiect to S=ring.
B. Remove line 06 from the Apex Controller and instead use rirsctName in the
return on line 07,
C. O Change the method signature to be globkal =tatic, notpublic =tatic.
D. D Annotate the entire class as GAuraEnabled Iinstead of just the single method.
Users report that when they change the Opportunity to Closed/Won and
also change the Amount during the same save,
the commissionamount¢ is incorrect.
A An arter update trigger on Case that creates the Engineering Review record and
inserts it
B. Abefor= ups==rrt trigger on Case that creates the Engineering Review record and
inserts it
42 o An after upaser: trigger on Case that creates the Engineering Review record and
inserts it
D.O A pefore update trigger on Case that creates the Engineering Review record and
inserts it
A, O Create a Before Save Flow, execute a Queueable job from it, and make a callout from
the Queueable job.
B. Create an Apex class, execute a Future method from it, and make a callout from the
Future method.
C Create an Apex trigger, execute a Queueable job from it, and make a callout from the
Queueable job.
D. Create an Apex class, execute a Batch Apex job from it, and make a callout from the
Batch Apex job.
[ Ml e Menncs'td e Pandh
s Al e -
45 of 62. A developer is tasked with creating a Lightning web component that is responsive on
various devices,
Choose 2 answers
A.D lightning~-layocout-item
B. D lightning-input-location
C lightning-navigation
D. lightning~layout
A An Apex trigger that creates Apex managed sharing records based on the junction
object’'s relationships
8. O A Lightning web component on the Community Home Page that uses Lightning Data
Services,
) O A Visualforce page that uses a custom controller that specifies withour szharing to
expose the records
D. O A custom list view on the junction object with filters that will show the proper records
based on owner
‘4
Salesforce Certified Platform Developer II - Multiple Choice
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. O Custom object
8. o Custom list setting
C@ Custom metadata type
D. O Custom hierarchy setting
‘4
Salesforce Certified Platform Developer II - Multiple Choice
<lightning:layout multipleRows="false">
<lightning:laycutItem size="é">(!v.rec.Name)
</lightning:layoutItem>
<lightning:layocutltem size="6">{!v.rec.Description__
¢}
</lightning:layoutltem>
</lightning:layout>
52 of 62. A developer created a class that implements the Queueable Interface, as follows:
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?
Choose 2 answers
A, Implement se=AllData=trus to ensure the Queueable job is able to run in
bulk mode.
B. Ensure the running user of the test class has, at least, the Vview All
permission on the Order object,
P D Implement Tes: . isRunningTest () to prevent chaining jobs during test
execution.
D. Enclose System.engqueueJcobk (new OrderQueueableJob()) within
Test . svartTes=:r and Tesc. stopTesc ().
53 of 62. Which three actions must be completed in a Lightning web component for a JavaScript file
in a static resource to be loaded?
Choose 3 answers
A, D Append the static resource to the DOM.
B. D Reference the static resource in a <script> tag.
C Call 1loadScripz:.
D. Import the static resource.
E. Import a method from the platformResourcelLoader.
|
m
Time Remaining: 01:25:28 m
A.@ Use =«t2corabl=() in the Apex method to store the response in the client-side cache.
B. O Return all records into a list when the component is created and filter the array in
JavaScript.
Ci O Use a selective SOQL query with a custom index.
D. O Use SOSL to query the records on filter change,
|
m
Time Remaining: 01:25:19 m
MyOpportunities.js
OpportunityController.cls
’
L
update accountlisct;
Consider the above trigger intended to assign the Account to the manager of the Account's region.
which two changes should a developer make in this trigger to adhere to best practices?
Choose 2 answers
A, D Use a Map to cache the results of the Region__c query by Id.
B. Move the Region__c query to outside the loop.
o Remove the last line updating accountlLis=r as it is not needed.
D.C] Use a Map accountMap instead of List accountList.
Salesforce Certified Platform Developer II - Multiple Choice
If the URLs used in these callouts will change often, which feature should
the developer use to minimize changes needed to the Apex class?
A, O Session Id
B. O Connected Apps
C@ Named Credentials
D. O Remote Site Settings
Which change should the developer implement in the Apex test method to
ensure the test method executes successfully?
A.@ Add System.runis (Uzerxr) to line 14 and enclose line 15 within Tesc.z2tarctTesz () and
Test.stopTest().
B. o Add @IzTest (22=2AllData=true) to line 12 and enclose lines 15 and 16 within
Tesat.startTeat() and Test.stopTesc
().
C. O Query the Standard User into memory and enclose lines 15 and 16 within the
System.runhz (uzer) method.
D. O Query the Administrator user into memory and enclose lines 15 and 16 within the
Sys=tem.runis
(u==xr) method.
reg.setEndpoint(‘https://TestEndpeoint.example.com/some_path');
reg.secMachod('GET") ;
Blob headexrxValue = Blob.valueOf ('myUserName' + ':' + 'sctrongPassword'):
Scring authorizationHeader = '"BASIC ' + EncodingUrtil.basseédEncode (headexValue)
reg.sectHeader ('Autherization', authorizationHeader):
Hetp hettp = new Hettp():
HITPResponse resa = http.send({req):
Which two steps should the developer take to add flexibility to change the endpoint and credentials
without needing to modify code?
Choose 2 answers
A. C] Use reg.sectEndpoint (Label .endPointURL) ;.
D. O The Apex trigger is not bulk safe and calls insert inside of a for loop.
61 of 62. After a platform event is defined Iin a Salesforce org, events can
be published via which mechanism?