Summer Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exams65

Salesforce Certified Platform Developer II (SP24) Question and Answers

Salesforce Certified Platform Developer II (SP24)

Last Update Jul 23, 2024
Total Questions : 196

We are offering FREE PDII Salesforce exam questions. All you do is to just go and sign up. Give your details, prepare PDII free exam questions and then go for complete pool of Salesforce Certified Platform Developer II (SP24) test questions that will help you more.

PDII pdf

PDII PDF

$35  $99.99
PDII Engine

PDII Testing Engine

$42  $119.99
PDII PDF + Engine

PDII PDF + Testing Engine

$56  $159.99
Questions 1

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

Discussion 0
Questions 2

Which technique can run custom logic when a Lightning web component is loaded?

Options:

A.  

Use an init event to call a function.

B.  

Use the randersd loack { } method.

C.  

Call 52. engqueusiction and pass in the method to call.

D.  

Use the connectedCallback { } method.

Discussion 0
Questions 3

Universal Containers allows customers to log into a Salesforce Community and update their orders via a custom Visualforce page. Universal Containers’ sales representatives can edit the orders on the same Visualforce page.

What should a developer use in an Apex test class to test that record sharing is enforced on the Visualforce page?

Options:

A.  

use System. profiles=() to test as a sales rep and a community user.

B.  

use System. profiles() to test as an administrator and a community user.

C.  

use System. profiles1h=() to test as a sales rep and a community user.

D.  

use System. runsAs () to test as an administrator and a community user.

Discussion 0
Questions 4

Which statement is considered a best practice for writing bulk safe Apex triggers?

Options:

A.  

Add records to collections and perform DML operations against these collections.

B.  

Add LIMIT 50000 to every SOQL statement.

C.  

Perform all DML operations from within a future method.

D.  

Use the Database methods with allorNone set to £21s= instead of DML statements.

Discussion 0
Questions 5

Refer to the test method below''

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)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 6

A company has an Apex process that makes multiple extensive database operations and web service callouts. The database processes and web services can take a long time to run and must be run sequentially.

How should the developer write this Apex code without running into governor limits and system limitations?

Options:

A.  

Use Queueable Apex to chain the jobs to run sequentially.

B.  

Use Apex Scheduler to schedule each process.

C.  

Use multiple 3zutuze methods for each process and callout.

D.  

Use Limits class to stop entire process once governor limits are reached.

Discussion 0
Questions 7

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?

Options:

A.  

Salesforce Lightning Inspector Transactions tab

B.  

Salesforce Lightning Inspector Actions tab

C.  

Salesforce Lightning Inspector Event Log tab

D.  

Salesforce Lightning Inspector Storage tab

Discussion 0
Questions 8

Consider the following code snippet:

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,

Discussion 0
Questions 9

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?

Options:

A.  

Add an within the .

B.  

Add an within the .

C.  

Add an within the .

D.  

Add an within the .

Discussion 0
Questions 10

A Visuzlforce page loads slowly due to the large amount of data it displays.

Which strategy can a developer use to improve the performance?

Options:

A.  

Use lazy loading to load the data on demand, instead of in the controller's constructor.

B.  

Use an

C.  

Use the transient keyword for the List variables used in the custom controller.

D.  

Use Javascript to move data processing to the browser instead of the controller.

Discussion 0
Questions 11

A developer wrote a trigger on Opportunity that will update a custom Last Sold Date

field on the Opportunity's Account whenever an Opportunity is closed. In the test

class for the trigger, the assertion to validate the Last Sold Date field fails.

What might be causing the failed assertion?

Options:

A.  

The test class has not defined an Account owner when inserting the test data.

B.  

The test class has not implemented seealldata=true in the test method.

C.  

The test class has not re-queried the Account record after updating the Opportunity.

D.  

The test class is not using System. runs () to run tests as a Salesforce administrator.

Discussion 0
Questions 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

Discussion 0
Questions 13

Universal Containers wants to notify an external system, in the event that an unhandled exception occurs, by publishing a custom event using Apex.

What is the appropriate publish/subscribe logic to meet this requirement?

Options:

A.  

Publish the error event using the Eventrus.publish() method and have the external system subscribe to the event using CometD.

B.  

Publish the error event using the addError () method and write a trigger to subscribe to the event and notify the external system.

C.  

Have the external system subscribe to the event channel. No publishing is necessary.

D.  

Publish the error event using the addError () method and have the external system subscribe to the event using Comet

D.  

Discussion 0
Questions 14

A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called rsutils in Salesforce. Another developer is coding a new Lightning web component (LWC) and wants to leverage the library,

Which statement properly loads the static resource within the LWC?

Options:

A.  

import jsUtilities from ‘@salesforce/rescurceUr1/jaUtiles’;

B.  

C.  

const jsUtilivy = SA.get{'SResource.isUtils');

D.  

impore {jsUtilities} from ‘@salasforce/resourceUrl/jsUtils’;

Discussion 0
Questions 15

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

Discussion 0
Questions 16

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.

Discussion 0
Questions 17

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

Discussion 0
Questions 18

As part of point-to-point integration, a developer must call an external web service which, due to high demand, takes a long time to provide a response. As part of the request, the developer must collect key Inputs from the end user before making the callout. Which two elements should the developer use to Implement these business requirements?

Choose 2 answers

Options:

A.  

Lightning web component

B.  

2 Apex method that returns a Continuation object

C.  

Screen Flow

D.  

Process Builder

Discussion 0
Questions 19

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.

Discussion 0
Questions 20

Given the following information regarding Universal Containers (UC):

* UC represents their customers as Accounts in Salesforce.

* All customers have a unique Customer__Number_c that is unique across all of UC's systems.

* UC also has a custom Invoice c object, with a Lookup to Account, to represent invoices that are sent out from their external system.

UC wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer pays their bills on time.

What is the optimal way to implement this?

Options:

A.  

Ensure Customer Number cis an External ID and that a custom field Invoice Number cis an External ID and Upsert invoice data nightly.

B.  

Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce without custom code.

C.  

Create a cross-reference table in the custom invoicing system with the Salesforce Account ID of each Customer and insert invoice data nightly,

D.  

Query the Account Object upon each call to insert invoice data to fetch the Salesforce ID corresponding to the Customer Number on the invoice.

Discussion 0
Questions 21

Which Salesforce feature allows a developer to see when a user last logged in to

Salesforce if real-time notification is not required?

Options:

A.  

Calendar Events

B.  

Asynchronous Data Capture Events

C.  

Event Monitoring Log

D.  

Developer Log

Discussion 0
Questions 22

What is the optimal way to fix this?

A)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 23

When the code is executed, the callout is unsuccessful and the following error appears within the Developer Console:

System.CalloutException: Unauthorized endpoint

Which recommended approach should the developer implement

to resolve the callout exception?

Options:

A.  

Annotate the getkRFCatalogContents method with @Future (Callout-true),

B.  

Change the access modifier for ERPCatalog from public to global.

C.  

Use the SetHeader() method to specify Basic Authentication,

D.  

Create a remote site setting configuration that includes the endpoint.

Discussion 0
Questions 24

An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary’ to control this feature.

The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters.

What is the optimal way to implement these requirements?

Options:

A.  

Write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic.

B.  

Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger on Contact for the last name logic.

C.  

Write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.

D.  

Write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic.

Discussion 0
Questions 25

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

Discussion 0
Questions 26

Refer to the following code snippets:

A developer is experiencing issues with a Lightning web component. The component must surface information about Opportunities owned by the currently logged-in user.

When the component is rendered, the following message is displayed: "Error retrieving data”.

Which modification should be implemented to the Apex class to overcome the issue?

Options:

A.  

Use the Cacheable=true attribute in the Apex method,

B.  

Ensure the OWD for the Opportunity object is Public.

C.  

Edit the code to use the w. cut sharing keyword in the Apex class.

D.  

Use the Continuation=true attribute in the Apex method.

Discussion 0
Questions 27

A developer is creating a page in App Builder that will be used in the Salesforce mobile app.

Which two practices should the developer follow to ensure the page operates with optimal performance?

Choose 2 answers

Options:

A.  

Limit 25 fields on the record detail page.

B.  

Limit the number of Tabs and Accordion components.

C.  

Analyze the page with Performance Analysis for App Builder.

D.  

Limit five visible components on the page.

Discussion 0
Questions 28

Consider the Apex class below that defines a RemoteAction used on 2 Visualforce search page.

Which code snippet will assert that the remote action returned the correct Account?

A)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 29

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,

Discussion 0
Questions 30

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.

Discussion 0
Questions 31

The Salesforce admin et Cloud Kicks created a custom object called Region_c to store all postal zip codes in the United States and the Cloud Kicks sales region the zip code belongs to.

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?

A)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 32

A developer is writing code that requires making callouts to an external web service.

Which scenario necessitates that the callout be made in an asynchronous method?

Options:

A.  

The callouts will be made in an Apex trigger.

B.  

The callouts will be made using the REST APL.

C.  

Over 10 callouts will be made in a single transaction.

D.  

The callout could take longer than 60 seconds to complete.

Discussion 0
Questions 33

A developer has a Visualforce page that automatically assigns ewnership of an Account to a queue upon save. The page appears to correctly assign ownership, but an assertion validating the correct ownership fails.

What can cause this problem?

Options:

A.  

The test class does not retrieve the updated value from the database,

B.  

The test class does not use the Bulk API for loading test data.

C.  

The test class does not use the seeallData=true= annotation.

D.  

The test class does not implement the Queueable interface.

Discussion 0
Questions 34

There are user complaints about slow render times of a custom data table within a Visualforce page that loads thousands of Account records at once.

What can a developer do to help alleviate such issues?

Options:

A.  

Use JavaScript remoting to query the accounts.

B.  

Use the transient keyword in the Apex code when querying the Account records.

C.  

Upload a third-party data table library as a static resource.

D.  

Use the standard Account List controller and implement pagination.

Discussion 0
Questions 35

When the sales team views an individual customer record, they need to see recent interactions for the customer. These interactions can be sales orders, phone calls, or Cases. The date range for recent interactions will be different for every customer record type.

How can this be accomplished?

Options:

A.  

Use batch Apex to query for the most recent interactions when the customer view screen is loaded.

B.  

Use Lightning Flow to read the customer's record type, and then do a dynamic query for recent interactions and display on the View page.

C.  

Use a Lightning component to query and display interactions based on record type that is passed in using a design:attribute from the Lightning page.

D.  

Use a dynamic form on the customer record page to display recent interactions.

Discussion 0
Questions 36

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

Discussion 0
Questions 37

Refer to the test method below:

The test method tests an Apex trigger that the developer knows will make a lot of queries when a lot of Accounts are simultaneously updated to be customers.

The test method fails at the Line 20 because of too many SOQL queries.

What is the correct way to fix this?

Options:

A.  

B.  

C.  

D.  

Discussion 0
Questions 38

A company wants to incorporate a third-party weh service to set the Address fields

when an Account is inserted, if they have not already been set.

What is the optimal way to achieve this?

Options:

A.  

Create a Workflow Rule, execute a Queueable job from it, and make a callout from the Queueable job.

B.  

Create an Apex trigger, execute a Queueable job from it, and make a callout from the Queueable job.

C.  

Create a Process, execute a Quaueable job from it, and make a callout from the Queueable job.

D.  

Create a Before Save Flow, execute a Queueable job from it, and make a callout from the Queusable job.

Discussion 0
Questions 39

Universal Charities (UC) uses Salesforce to collect electronic donations in the form of credit card deductions from individuals and corporations.

When a customer service agent enters the credit card information, it must be sent

to 8 3rd-party payment processor for the donation to be processed, UC uses one

payment processor for individuals and a different one for corporations.

What should a developer use to store the payment processor settings for the

different payment processors, so that their system administrator can modify the

settings once they are deployed, if needed?

Options:

A.  

Custom object

B.  

Custom metadata

C.  

Hierarchy custom setting

D.  

List custom setting

Discussion 0
Questions 40

A Visualforce page needs to make a callout to get billing information and tax information from two different REST endpoints. The information needs to be

displayed to the user at the same time and the return value of the billing information contains the input for the tax information callout. Each endpoint might take up to two minutes to process.

How should a developer implement the callouts?

Options:

A.  

An HTTP REST callout for the billing callout and a Continuation for the tax callout

B.  

A Continuation for both the billing callout and the tax callout

C.  

An HTTP REST callout for both the billing callout and the tax callout

D.  

A Continuation for the billing callout and an HTTP REST callout for the tax callout

Discussion 0
Questions 41

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.

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.

Discussion 0
Questions 42

For compliance purposes, a company is required to track long-term product usage in their org. The information that they need to log will be collected from more than one object and, over time, they predict they will have hundreds of millions of records.

What should a developer use to implement this?

Options:

A.  

Setup audit trail

B.  

Field audit trail

C.  

Big objects

D.  

Field history tracking

Discussion 0
Questions 43

When developing a Lightning web component, which setting displays lightninglayout-items im one column on small devices, such as mobile phones, and in two

columns on tablet-size and desktop-size screens?

Options:

A.  

Set size="12" tablet-device-size="6"

B.  

Set size="12" medium-device-size="6"

C.  

Set size="6" mobile-device-size="12"

D.  

Set size="6" small-device-size="12"

Discussion 0
Questions 44

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.

Discussion 0
Questions 45

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

returns data wrapped in a class.

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.

Discussion 0
Questions 46

A developer created a Lightning web component for the Account record page that displays the five most recently contacted Contacts for an Account. The Apex method,

Contacts, returns a list of Contacts and will be wired to a property in the component.

Which two lines must change in the above code to make the Apex method able to be wired?

Choose 2 answers

Options:

A.  

Add @AuraEnabled {cacheable=trues) to line 08.

B.  

Remove private from line 09.

C.  

Add public to line 04.

D.  

Add @AuraEnabled {cacheable=true) to line 03.

Discussion 0
Questions 47

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.

Discussion 0
Questions 48

How can a developer efficiently incorporate multiple JavaScript libraries in an Aura component?

Options:

A.  

Use JavaScript remoting and script tags.

B.  

Use CDNs with script attributes.

C.  

Implement the libraries in separate helper files.

D.  

Join multiple assets from a static resource.

Discussion 0
Questions 49

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)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 50

Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity's Account?

A)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0