Labour Day Special Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

Salesforce PDII Salesforce Certified Platform Developer II (SP23) Exam Practice Test

Page: 1 / 20
Total 196 questions

Salesforce Certified Platform Developer II (SP23) Questions and Answers

Question 1

Universal Containers implements a private sharing model for the Convention Attendee co 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 ReadWrite 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?

Options:

A.

Create a before insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.

B.

Create an after insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing.

C.

Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers,

D.

Create a criteria-based sharing rule on the Convention Attendee custom object to share the records with a group of Event Reviewers.

Question 2

A developer is creating a Lightning web component to display a calendar. The component will be used in multiple countries. In some locales, the first day of the week is a Monday, or a Saturday, or a Sunday. ‘What should the developer do to ensure the calendar displays accurately for users in every locale?

Options:

A.

Query the FirstDayofweek field from the Locale for the current user.

B.

Import the @salesforce/i18n module and use

the firstdayofweek internationalization property.

C.

Use a custom metadata type to store key/value pairs.

D.

Use UserInfo.getLocale() in the component.

Question 3

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

Options:

A.

Remote action

B.

Flow Builder

C.

Apex trigger

D.

Apex invocable method

Question 4

A company has code to update a Request and Request Lines and make a callout to

their external ERP system's REST endpoint with the updated records.

Question # 4

The callousUtil.makeRestCallout fails with a "You have uncommitted work pending. Please commit or rollback before calling cut’ error.

What should be done to address the problem?

Options:

A.

Change the callousUtil makeRestCallout to an @InvocsblsMethod method.

B.

Remove the Database. setSavepoint and Database. rollback.

C.

Change the CallousUtill .makeRestCallout to an @future method.

Question 5

Which tag should a developer use to display different text while an is Processing an action?

Options:

A.

B.

C.

D.

Question 6

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.

Which 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

Options:

A.

Call the trigger from the Lightning web component.

B.

Create a helper class that fetches the high value opportunities,

C.

Leave the business logic code inside the trigger for efficiency.

D.

Use custom metadata to hold the high value amount.

Question 7

Universal Containers wants to use a Customer Community with Customer Community Plus licenses to allow their customers access to track how many containers they have rented and when they are due back. Universal Containers uses a Private sharing model for External users, Many of their customers are multi-national corporations with complex Account hierarchies. Each account on the hierarchy represents a department within the same business,

One of the requirements is to allow certain community users within the same

Account hierarchy to see several departments’ containers, based on a custom

junction object that relates the Contact to the various Account records that

represent the departments.

Which solution solves these requirements?

Options:

A.

A Visualforce page that uses a custom controller that specifies without sharing [0 expose the records

B.

An Apex trigger that creates Apex managed sharing records based on the junction object's relationships

C.

A Lightning web component on the Community Home Page that uses Lightning Data Services.

D.

A custom list view on the junction object with filters that will show the proper records based on owner

Question 8

A company uses Dpportunities to track sales to their customers and their org has millions of Opportunities. They want to begin 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 created and populated.

What is the optimal way to automate this?

Options:

A.

Use system, acheduladeb() to schedule a patakape.Scheduleable class.

B.

Use system, enqueuJob (| to invoke a gueusable class.

C.

Use Database. executeBatch () to invoke a Queueable class.

D.

Use Database. =executeBatch() to invoke a Database. Batchable class.

Question 9

A software company uses a custom object, Defact__c, to track defects in their

software. Defect__c has organization-wide defaults set to private. Each Defect_ c

has a related list of Reviewer < records, each with a lookup field to User that is

used to indicate that the User will review the defect__c.

What should be used to give the User on the Reviewer_c record read only access

to the Defect__c record on the Reviewer_c record?

Options:

A.

Apex managed sharing

B.

Criteria-based sharing

C.

Lightning web component

D.

View All on Defect__c

Question 10

How should a developer verify that a specific Account record is being tested in a test

class for a Visualforce controller?

Options:

A.

Insert the Account in the test class, instantiate the page reference in the test class, then use System.currentFageReference() .getFarameters() .put{) to set the Account ID.

B.

Insert the Account into Salesforce, instantiate the page reference in the test class, then use system. setFarentRecordId() .get() to set the Account ID.

{of Instantiate the page reference in the test class, insert the Account in

the test class, then use =seeAllData=trus to view the Account.

C.

Instantiate the page reference in the test class, insert the Account in

the test class, then use system.setFarentRecordrd() .get() to set the Account ID,

Question 11

Consider the controller code below that is called from an Aura component and

returns data wrapped in a class.

Question # 11

The developer verified that the queries return a single record each and there is error handling in the Aura component, but the component is not getting anything back when calling the controller getSemeData.

‘What is wrong?

Options:

A.

Instances of Apex classes, such as MyDatsWrapper, cannot be returned to a Lightning component.

B.

The member's Name and option should not have getter and setter.

C.

The member's Name and option should not be declared public.

D.

The member's Kame and option of the class MyDataWrapper should be annotated with @AuraEnabled also.

Question 12

A developer needs to store variables to control the style and behavior of a Lightning Web Component.

Which feature can be used to ensure that the variables are testable in both Production and all Sandboxes?

Options:

A.

Custom setting

B.

Custom object

C.

Custom variable

D.

Custom metadata

Question 13

In an organization that has multi-currency enabled, a developer Is tasked with building a Lighting component that displays the top ten Opportunities most recently accessed by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user's locale.

What is the most effective approach to ensure values displayed respect the user's locale settings?

Options:

A.

Use REGEX expressions to format the values retrieved via SOQL.

B.

Use a wrapper class to format the values retrieved via SOQL.

C.

Use the FOR VIEW clause in the SOQL query.

D.

Use the FORMAT () function in the SOQL query.

Question 14

Which scenario requires a developer to use an Apex callout

Instead of Outbound Messaging?

Options:

A.

The target system uses a REST APL.

B.

The target system uses a SCAP API.

C.

The callout needs to be asynchronous.

D.

The callout needs to be invoked from a flow.

Question 15

A business currently has a process to manually upload orders from its external Order Management System (OMS) into Salesforce.

This is a labor intensive process since accounts must be exported out of Salesforce to get the IDs. The upload file must be updated with the correct account IDs to relate

the orders to the corresponding accounts.

Which two recommendations should make this process more efficient?

Choose 2 answers

Options:

A.

Identify unique fields on Order and Account and set them as External IDs.

B.

Use the insert wizard in the Data Loader to import the data.

C.

Ensure the data in the file is sorted by the order ID.

D.

Use the upsert wizard in the Data Loader to import the data.

Question 16

A company has many different unit test methods that create Account records as

part of their data setup. A new required field was added to the Account and now all

of the unit tests fail.

What is the optimal way for a developer to fix the issue?

Options:

A.

Add the required field to the data setup for all of the unit tests.

B.

Add a before insert trigger on Account to set the value of the required field,

C.

Change the required field to be a validation rule that excludes the System Administrator profile.

D.

Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there.

Question 17

How should a developer assert that a trigger with an asynchronous process has successfully run?

Options:

A.

Create all test data in the test class, use system. runs {} to invoke the trigger, then perform assertions.

B.

Insert records into Salesforce, use seeAllData=true, then perform assertions.

C.

Create all test data, use future in the rest class, then perform assertions.

D.

Create all test data in the test class, invoke Test.startTest{} and Test.etopTaat {} and then perform assertions.

Question 18

Universal Containers develops a Visualforce page that requires the inclusion of external JavaScript and C55 files. They want to ensure efficient loading and caching of the page.

Which feature should be utilized to achieve this goal?

Options:

A.

ActionFunction

B.

PageBlockTable

C.

Static resources

D.

RemoteAction

Question 19

A developer creates an application event that has triggered an infinite loop.

What may have caused this problem?

Options:

A.

The event is fired from a custom renderer.

B.

The event has multiple handlers registered in the project.

C.

The event handler calls a trigger.

D.

An event is fired ‘ontouchend'’ and is unhandled.

Question 20

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.

Question # 20

What should the developer change in the code above for this to

happen?

Options:

A.

Call rafrasnApex() ON this.dazta.

B.

Create a new variable to store the result and annotate it with @track.

C.

Create a variable to store the result and call refreshpex().

D.

Add the @track decorator to the data variable.

Question 21

A developer has a test class that creates test data before making a mock callout but now receives a 'You have uncommitted work pending. Please commit or rollback before calling out’ error.

Which step should be taken to resolve the error?

Options:

A.

Ensure both the Insertion and mock callout occur after the I==L. stoptest_().

B.

Ensure the records are Inserted before the Tezt.startTest() statement and the mock callout occurs within a method annotated with @testSetup.

C.

Ensure both the insertion and mock callout occur after the Test.startTest().

D.

Ensure the records are inserted before the Test.startTess() statement and the mock callout occurs after the Test. Startest().

Question 22

A developer has working business logic code, but sees the following error in the test class:

You have uncommitted work pending. Please commit

or rollback before calling out.

What is a possible solution?

Options:

A.

Call support for help with the target endpoint, as It is likely an external code error.

B.

Use mast. T=RunningTes={} before making the callout to bypass it in test execution,

C.

Set seeAllData to true the top of the test class, since the code does not fall in practice.

D.

Rewrite the business logic and test classes with @Testvisible set on the callout.

Question 23

A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections.

What should the developer do to properly test that the correct components display and hide for each scenario?

Options:

A.

Create a new describe block for each test.

B.

Reset the DOM after each test with the after Each() method.

C.

Add a teardown block to reset the DOM after each test.

D.

Create a new jsdom instance for each test.

Question 24

Refer to the test method below:

Question # 24

The test method calls an @future method that increments the

Number_of_Times_Viewed__c value. The assertion is failing because the

Number of Times Viewed_c equals 0.

What is the optimal way to fix this?

Options:

A.

Change the assertion to system.asserciquals (0, acctAfter Number _Cf_Timea_Viewed__c).

B.

Add Test.atartTeat() before and Teat.stopTest() after inser= acct.

C.

Add rest.staztTest() before and Test.stopTess() after AuditUcil.incrementViewed.

D.

Change the initialization to acct. Number_Of_Times_Viewed_c = 1.

Question 25

Question # 25

What should be added to the setup, in the location indicated, for the unit test above to create the controller extension for the test?

A)

Question # 25

B)

Question # 25

C)

Question # 25

Options:

A.

Option A

B.

Option B

C.

Option C

Question 26

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, zudizar_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 _e, that is used to automatically assign the correct user to the Account’s Auditor_c field.

Question # 26

What should be changed to most optimize the code’s efficiency?

Choose 2 answers

Options:

A.

Add an initial SOQL query to get all distinct audit codes.

B.

Build a Map> of audit code to accounts.

C.

Build a Map>of Account Id to audit codes.

D.

Add a WHERE clause to the SOQL query to filter on audit codes.

Question 27

A Salesforce Platform Developer is leading a team that is tasked with deploying a

new application to production. The team has used source-driven development, and

they want to ensure that the application is deployed successfully.

What tool or mechanism should be used to verify that the deployment is successful?

Options:

A.

Force.com Migration Tool

B.

Salesforce DX CLI

C.

Apex Test Execution

D.

Salesforce Inspector

Question 28

Consider the following code snippet:

Question # 28

How should the component communicate to the

component that an order has been selected by the user?

Options:

A.

Create and fire a component event.

B.

Create and fire an application event.

C.

Create and fire a standard DOM event.

D.

Create and dispatch a custom event,

Question 29

A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution.

How should the developer implement error exception handling in their code to handle this?

Options:

A.

Use Database methods to obtain lists of Database.SaveResults.

B.

Use a try-catch statement and handle DML cleanup in the catch statement,

C.

Use Database.setSavepoint {} and Database.rollBack with a try-catch statement.

D.

Use a try-catch and use sObject.addError() on any failures.

Question 30

A developer wrote a class named asccuntRisteryManager that relies on field history tracking. The class has a static method called getaccountHistory that Lakes in an Account as a parameter and returns a list of associated accountHistory object records.

The following test fails:

Question # 30

What should be done to make this test pass?

Options:

A.

Create Accountdistory records manually in the test setup and write a query to get them.

B.

Use @isTest (SeeAllData=true] to see historical data from the org and query for Accountdistory records.

C.

Use Test. isRunningTest (] in getAccountHistory() to conditionally return fake AccountHistory records.

D.

The tact method should he delated since this code cannat be tested

Question 31

Refer to the Aura component below:

Question # 31

A developer receives complaints that the component loads slowly.

Which change can the developer implement to make the component perform faster?

Options:

A.

Change the type of contactInfo to "Map”.

B.

Move the contents of

C.

Add a change event handler for showContactInfo.

D.

Change the default for showContactInfo to “False.

Question 32

What is a benefit of JavaScript remoting over Visualforce Remote Objects?

Options:

A.

Does not require any JavaScript code

B.

Supports complex server-side application logic

C.

Does not require any Apex code

D.

Allows for specified re-render targets

Question 33

Universal Containers (LIC) 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?

Options:

A.

Use custom labels to ensure custom messages are translated properly.

B.

Use custom settings to ensure custom messages are translated properly.

C.

Use custom objects to translate custom picklist values.

D.

Use custom metadata to translate custom picklist values.

Question 34

What is the correct way to fix this?

Options:

A.

Add Test.startTest() before and add Test. stopTest() after both Line 7 and Line 20 of the code.

B.

Add Test_startTest() before and add Test. stopTest() after Line 18 of the code.

C.

Use Limits.getlimitQueries() to find the total number of queries that can be issued.

D.

Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced.

Question 35

A company has a custom object, Order__c, that has a custom picklist field, Status__c, with values of ‘New,' 'In Progress,’ or ‘Fulfilled’ and a lookup field,

Contact__c, to Contact.

Which SOQL query will return a unique list of all the Contact records that have no ‘Fulfilled’ Orders?

A)

Question # 35

B)

Question # 35

C)

Question # 35

D)

Question # 35

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 36

Refer to the test method below''

Question # 36

The test method calls a web service that updates an external system with Account

information and sets the Accounts 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.”

A)

Question # 36

B)

Question # 36

C)

Question # 36

D)

Question # 36

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 37

There is an Apex controller and a Visualforce page in an org that displays records with a custom filter consisting of a combination of picklist values selected by the

user.

The page takes too long to display results for some of the input combinations, while for other input choices it throws the exception, "Maximum view state size limit exceeded”.

What step should the developer take to resolve this issue?

Options:

A.

Adjust any code that filters by picklist values since they are not indexed,

B.

Remove instances of the transient keyword from the Apex controller to avoid the view state error.

C.

Use a StandardSetController or SOQL LIMIT in the Apex controller to limit the number of records displayed at a time.

D.

Split the layout to filter records in one Visualforce page and display the list of records in a second page using the same Apex controller.

Question 38

A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field.

Question # 38

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?

Options:

A.

Add an within the .

B.

Add an within the .

C.

Add an within the .

D.

Add an within the .

Question 39

Universal Containers is leading a development team that follows the source-driven development approach in Salesforce. As part of their continuous integration and delivery (CL/CD) process, they need to automatically deploy changes to multiple environments, including sandbox and production.

‘Which mechanism or tool would best support their CI/CD pipeline in source-driven development?

Options:

A.

Salesforce CLI with Salesforce DX

B.

Salesforce Extensions for Visual Studio Code

C.

Change Sets

D.

Ant Migration Tool

Question 40

An Aura component has a section that displays some information about an Account

and it works well on the desktop, but users have to scroll horizontally to see the description field output on their mobile devices and tablets.

Question # 40

How should a developer change the component to be responsive for mobile and tablet devices?

A)

Question # 40

B)

Question # 40

C)

Question # 40

D)

Question # 40

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 41

A developer built an Aura component for guests to self-register upon arrival at a front desk kiosk. Now the developer needs to create a component for the utility tray to alert users whenever a guest arrives at the front desk.

What should be used?

Options:

A.

DML Operation

B.

Changelog

C.

Application Event

D.

Component Event

Question 42

A developer created the following test method:

Question # 42

The developer org has five accounts where the name starts with “Test”. The developer executes this test in the Developer Console.

After the test code runs, which statement is true?

Options:

A.

The test will fail.

B.

There will be no accounts where the name starts with "Test".

C.

There will be five accounts where the name starts with "Test".

D.

There will be six accounts where the name starts with "Test".

Question 43

A developer is asked to look into an issue where a scheduled Apex is running into DML limits. Upon investigation, the developer finds that the number of records processed by the scheduled Apex has recently increased to more than 10,000.

What should the developer do to eliminate the limit exception error?

Options:

A.

Use the @future annotation.

B.

Implement the Qususabls interface.

C.

Implement the Batchable interface.

D.

Use platform events.

Question 44

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?

Options:

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.

Ensure proper usage of test data factory in all test methods.

D.

Reduce the amount of test methods in the class.

Question 45

A corporation has many different Salesforce orgs, with some different objects and some common objects, and wants to build a single Java application that can create, retrieve, and update common object records in all of the different orgs.

Which method of integration should the application use?

Options:

A.

SOAP API with the Partner WSDL

B.

Apex REST Web Service

C.

SOAP API with the Enterprise WSDL

D.

Metadata APT

Question 46

A developer created 2 class that implements the Queueable Interface, as follows:

Question # 46

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

Options:

A.

Implement seeAllData=True to ensure the Queueable job is able to run in bulk mode.

B.

Ensure the running user of the test class has, at I the View All permission on the Order object.

C.

Enclose System.enqueueJob(new OrderQueueableJob ()] within Tess. and Test .stopTest (1.

D.

Implement Test. isRunningTest() to prevent chaining jobs during test execution.

Question 47

Universal Containers is using a custom Salesforce application to manage customer

support cases. The support team needs to collaborate with external partners to

resolve certain cases. However, they want to control the visibility and access to the

cases shared with the external partners. Which Salesforce feature can help achieve this requirement?

Options:

A.

Role hierarchy

B.

Criteria-based sharing rules

C.

Apex managed sharing

D.

Sharing sets

Question 48

A developer is asked to develop a new AppFxchange application. A feature of the program creates Survey records when a Case reaches a certain stage and is of a certain Record Type. This feature needs to be configurable, as different Salesforce instances require Surveys at different times. Additionally, the out-of-the-box AppExchange app needs to come with a set of best practice settings that apply to

most customers.

What should the developer use to store and package the custom configuration settings for the app?

Options:

A.

Custom objects

B.

Custom settings

C.

Custom metadata

D.

Custom labels

Question 49

Salesforce users consistently receive a "Maximum trigger depth exceeded” error when saving an Account. How can a developer fix this error?

Options:

A.

Split the trigger logic into two separate triggers.

B.

Convert the trigger to use the 3suzure annotation, and chain any subsequent trigger invocations to the Account object.

C.

Modify the trigger to use the L=MultiThread=true annotation,

D.

Use a helper class to set a Boolean to TRUE the first time a trigger 1s fired, and then modify the trigger ta only fire when the Boolean is FALSE.

Question 50

Consider the Apex controller below, that is called from an Aura component.

Question # 50

What is wrong with this code?

Options:

A.

Line 1: class must be global

8. Lines 1 and 6: class and method must be global

B.

Line 6: method must be static

C.

Line 8: method must first serialize the list to JSON before returning

Page: 1 / 20
Total 196 questions