Labour Day Special - Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: top65certs

Salesforce PDII Dumps

Page: 1 / 13
Total 196 questions

Salesforce Certified Platform Developer II (SP23) Questions and Answers

Question 1

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

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

Question 2

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.

Question 3

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.

Question 4

A developer wrote the following method to find all the test accounts in the org:

What should be used to fix this failing test?

Options:

A.

Test. fixsdSsarchReaulta [) method to set up expected data

B.

@isTest (SeeAllData=true) to access org data for the test

C.

@testsetup method to set up expected data

D.

Teat.loadData to set up expected data

Question 5

Universal Containers decided to use Salesforce to manage a new hire interview process. A custom object called Candidate was created with organization-wide defaults set to Private. A lookup on the Candidate object sets an employee as an Interviewer.

What should be used to automatically give Read access to the record when the lookup field is set to the Interviewer user?

Options:

A.

The record can be shared using an Apex class.

B.

The record can be shared using a permission set.

C.

The record can be shared using a sharing rule.

D.

The record cannot he shared with the current setup.

Question 6

Given the following code:

Assuming there were 10 Contacts and five Accounts created today, what is the expected result?

Options:

A.

System.QueryException: Too many DML Statement errors on Contact

B.

System.QueryException: List has more than one row for Assignment on Account

C.

Systemn.LimitException: Too many SOQL Queries on Account

D.

System.LimitException: Too many SOQL Queries on Contact

Question 7

Universal Containers wants to notify an external system in the event that an unhandled exception occurs when their nightly Apex batch job runs.

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

Options:

A.

Have the external system subscribe to a custom Platform Event that gets fired with addError{).

B.

Have the external system subscribe to a custom

Platform Event that gets fired with EventBus.publish(1,

C.

Have the external system subscribe to a standard

Platform Event that gets fired with with Eventbus.publish(1.

D.

Have the external system subscribe to a standard Platform Event that gets fired.

Question 8

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

Question 9

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.

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

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 10

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 11

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.

Question 12

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

Question 13

A developer is trying to access org data from within a test class.

Which sObject type requires the test class to have the (seeAllData=true)

annotation?

Options:

A.

User

B.

RecordType

C.

Report

D.

Profile

Question 14

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:

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 15

Universal Containers stores user preferences in a hierarchy custom setting,

user Prefs_c, with a checkbox field, show _help co. Company-level defaults are

stored at the organizational level, but may be overridden at the user level. If a user

has not overridden preferences, then the defaults should be used.

How should the show_Help_ c preference be retrieved for the current user?

Options:

A.

Boolean show = User_Prefa_ c.getValuea().Show_Help_ co;

B.

Boolean show =

User Prefs c.getValues(UserInfo.getUserid{)).Show_Help c;

C.

Boolean show = User_Prefs_c.getlnstance(].Show Help c;

D.

Boolean show = User Prefs_c.show Melp_c;

Question 16

A company needs to automatically delete sensitive information after seven years.

This could delete almost a million records every day.

How can this be achieved?

Options:

A.

Schedule an 3fuzure process to query records older than seven years, and then recursively invoke itself in 1,000 record batches to delete them,

B.

Use aggregate functions to query for records older than seven years, and then delete the aggrigateResults objects.

{civ [+] Schedule a batch Apex process to run every day that queries and deletes records older than seven years.

C.

Perform a SOSL statement to find records older than 7 years, and then delete the entire result set.

Question 17

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.

Question 18

Refer to the Lightning component below:

The Lightning Component allows users to click a button to save their changes and then redirects them to a different page.

Currently when the user hits the Save button, the records are getting saved, but they are not redirected.

Which three techniques can a developer use to debug the JavaScript?

Choose 3 answers

Options:

A.

Use console.log () messages in the JavaScript.

B.

Use the browser's dev tools to debug the JavaScript.

C.

Enable Debug Mode for Lightning components for the user.

D.

Use Developer Console to view checkpoints.

E.

Use Developer Console to view the debug log.

Question 19

A developer is tasked with creating a Lightning web component that is responsive on various devices,

Which two components should help accomplish this goal?

Choose 2 answers

Options:

A.

lightning-navigation

B.

Lightning-input-location

C.

Lightning-layout

D.

lightning-layout—-item

Question 20

A company's support process dictates that any time a case is closed with a status of "Could net fix," an Engineering Review custom object record should be created and populated with information from the case, the contact, and any of the products associated with the case.

What Is the correct way to automate this using an Apex trigger?

Options:

A.

An after update trigger on Case that creates the Engineering Review record and inserts it

B.

An after upset trigger on Case that creates the Engineering Review record and inserts It .

C.

A before update trigger on Case that creates the Engineering Review record and Inserts It

D.

A before upset trigger on Case that creates the Engineering Review record and Inserts it

Question 21

Which statement is true regarding savepoints?

Options:

A.

You can roll back to any savepoint variable created in any order.

B.

Static variables are not reverted during a rollback.

C.

Reference to savepoints can cross trigger invocations.

D.

Savepoints are not limited by DML statement governor limits.

Question 22

A company wants to run different logic based on an Opportunity's record type.

Which code segment handles this request and follows best practices?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 23

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

Options:

A.

B.

C.

D.

Question 24

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 25

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 26

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 CometD.

Question 27

What is the best practice to initialize a Vizualforce page in a test class?

Options:

A.

Use Test. setCurrentPage (Page. MyTeatPage);

B.

Use Test. currantPage .getParamatars put (MyTaestPaga) ;

C.

Use controller. currentPage. setPage (MyTastfage) ;

D.

Use Test. setCurrentPage MyTestPags;

Question 28

Consider the queries in the options below and the following Information:

* For these queries, assume that there are more than 200,000 Account records.

* These records Include soft-deleted records; that is, deleted records that are still in the Recycle Bin.

* There are two fields that are marked as External Id on the

Account. These fields are customer_Number_c and ERR_Key_ s.

Which two queries are optimized for large data volumes?

Choose 2 answers

Options:

A.

SELECT I4 FROM Account WHERE Name !— NULL

B.

SELECT 1d FROM Accounts WHERE Name != '°

AND Customer_Number_c- "ValueA’

C.

SELECT ID FROM Account WHRE id IN :aListVariable

D.

SELECT Id FROM Account WHERE Name != ‘ ‘AND IsDeleted = false

Question 29

Universal Containers is implementing a new approval process for expense reimbursements. The process requires complex logic to determine the appropriate approver based on factors such as expense amount, employee role, and project type. The solution should allow for flexibility and future changes in the approval rules.

Which approach would be the most suitable for implementing this logic?

Options:

A.

Create a custom Apex class with a method to determine the appropriate approver based on the given criteria.

B.

Develop a custom Lightning component to handle the approval logic and integrate it into the expense reimbursement record page.

C.

Implement a custom formula field to calculate and determine the appropriate approver based on the given criteria.

D.

Use the Salesforce Approval Process feature and define multiple approval steps with entry criteria and approval assignments.

Question 30

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

Question 31

A developer is asked to replace the standard Case creation screen with a custom screen that takes users through a wizard before creating the Case. The org only has users running Lightning Experience.

What should the developer override the Case New Action with to satisfy the requirements?

Options:

A.

Lightning Page

B.

Lightning Record Page

C.

Lightning Component

D.

Lightning Flow

Question 32

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 certain conditions are met.

What is the optimal way to accomplish this?

Options:

A.

Use an Email Alert with Flow Builder.

B.

Use MassEmailMEssage () With an Apex trigger.

C.

Use a Workflow Email Alert.

D.

Use SingleEmailMessage() with an Apex trigger.

Question 33

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.

Question 34

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.

Question 35

A developer writes a Lightning web component that displays a dropdown list of all custom objects in the org from which a user will select. An Apex method prepares and returns data to the component.

What should the developer do to determine which objects to include in the response?

Options:

A.

Check the isCustom() value on the sObject describe result,

B.

Import the list of all custom objects from @salesforce/schema.

C.

Check the getobiectType [) value for ‘Custom’ or "Standard’ on the sObject describe result.

D.

Use the getcustomobjects() method from the Schema class.

Question 36

Universal Containers has an Apex trigger on Account that creates an Account Plan record when an Account is marked as a Customer.

Recently a record-triggered flow was added so that whenever an Account is marked as a Customer, a "Customer Since’ date field is updated with today's date. Since the addition of the flow, two Account Plan records are created whenever the Account is marked as a Customer.

What might cause this to happen?

Options:

A.

The Apex trigger does not use a static variable to ensure it only fires once.

B.

The flow is configured to use an "Update Records’ element.

C.

The Apex trigger is not bulk safe and calls insert inside of a for loop.

D.

The flow is configured to evaluate when a record is created and every time it is edited.

Question 37

Users report that a button on a custom Lightning web component (LWC) is not

saving the data they enter. The button looks to be clicked, but the LWC simply sits

there, seemingly doing nothing.

What should the developer use to ensure error messages are properly displayed?

Options:

A.

Add a try-catch block surrounding the DML statement.

B.

Use the Database method with a110rNone Set to false.

C.

Add the tag to the component.

D.

Add JavaScript and HTML to display an error message.

Question 38

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.

Question 39

An Apex trigger and Apex class increment a counter, Edit __C, any time the Case is changed.

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 40

A developer is tasked with ensuring that email addresses entered into the system for Contacts and for a custom object called survey Response c do not belong to a list of blocked domains.

The list of blocked domains is stored in a custom object for ease of maintenance by users. The survey Response c object is populated via a custom Visualforce page.

What is the optimal way to implement this?

Options:

A.

Implement the logic in validation rules on the Contact and the Burvey Response_c Objects.

B.

Implement the logic in a helper class that is called by an Apex trigger on Contact and from the custom Visualforce page controller.

C.

Implement the logic in an Apex trigger on Contact and also implement the logic within the custom Visualforce page controller.

D.

Implement the logic in the custom Visualforce page controller and call "that method from an Apex trigger on Contact.

Question 41

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 42

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.

Question 43

Universal Containers analyzes a Lightning web component and its Apex controller

class that retrieves a list of contacts associated with an account. The code snippets

are as follows:

Based on the code snippets, what change should be made to display the contacts’ mailing addresses in the Lightning web component?

Options:

A.

Add a new method in the Apex controller class to retneve the mailing addresses separately and modify the Lightning web component to invoke this method.

B.

Extend the lightning-datatable component in the Lightning web component to include a column for the MailingAddress field.

C.

Modify the SOQL guery in the getAccountContacts method to include the MailingAddress field.

D.

Modify the SOQL query in the getAccountContacts method to include the MailingAddress field and update the columns attribute in javascript file to add Mailing address fields.

Question 44

Universal Containers uses a custom Lightning page to provide a mechanism to perform a step-by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERF Number_c, that is then used in a query to find matching Accounts.

Which step should be taken to resolve the issue?

Options:

A.

Perform the SOQL query as part of a for loop.

B.

Mark the ERP_Numker = field as an external 10.

C.

Mark the ERP_Number__ c field as required.

D.

Move the SO0L query to within an asynchronous process.

Question 45

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

Question 46

Universal Containers develops a Salesforce application that requires frequent interaction with an external REST API.

To avoid duplicating code and improve maintainability, how should they implement the APL integration for code reuse?

Options:

A.

Use a separate Apex class for each API endpoint to encapsulate the integration logic,

B.

Include the API integration code directly in each Apex class that requires it.

C.

Create a reusable Apex class for the AFL integration and invoke it from the relevant Apex classes.

D.

Store the APT integration code as a static resource and reference it in each Apex class.

Question 47

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?

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 48

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?

Options:

A.

Use a Map to cache the results of the Region._c query by Id.

B.

Move the Region__c query to outside the loop.

C.

Use a Map accountMap instead of List accountList.

D.

Remove the last line updating accountList as It Is not needed.

Question 49

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 50

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.

Page: 1 / 13
Total 196 questions