New Year Special Sale - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: mxmas70

Home > Salesforce > Developers > PDII

PDII Salesforce Certified Platform Developer II (SU24) Question and Answers

Question # 4

Which scenario requires a developer to use an Apex callout

Instead of Outbound Messaging?

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.

Full Access
Question # 5

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?

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.

Full Access
Question # 6

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?

A.

DML Operation

B.

Changelog

C.

Application Event

D.

Component Event

Full Access
Question # 7

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?

A.

Apex managed sharing

B.

Criteria-based sharing

C.

Lightning web component

D.

View All on Defect__c

Full Access
Question # 8

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?

A.

Lightning Page

B.

Lightning Record Page

C.

Lightning Component

D.

Lightning Flow

Full Access
Question # 9

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?

A.

SOAP API with the Partner WSDL

B.

Apex REST Web Service

C.

SOAP API with the Enterprise WSDL

D.

Metadata APT

Full Access
Question # 10

A developer is creating a Lightning web component that displays a list of records in a lightning-datatable. After saving a new record to the database, the list is not updating.

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

happen?

A.

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.

Full Access
Question # 11

A page throws an ‘Attempt to dereference a null object’ error for a Contact.

What change in the controller will fix the error?

A.

Declare a static final Contact at the top of the controller.

B.

(o] Use a condition in the getter to return a new Contact if it is null.

G Change the setter’s signature to return a Contact.

C.

Change the getter's signature to be static Contact.

Full Access
Question # 12

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

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

Full Access
Question # 13

Which statement is true regarding savepoints?

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.

Full Access
Question # 14

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?

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

Full Access
Question # 15

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?

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.

Full Access
Question # 16

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)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 17

A developer has a requirement to query three fields (Id, Name, Type) from an Account; and first and last names for all Contacts associated with the Account.

Which option is the preferred, optimized method to achieve this for the Account named ‘Ozone Electronics’?

A)

B)

C)

D)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 18

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?

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.

Full Access
Question # 19

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

A.

Use Test. setCurrentPage (Page. MyTeatPage);

B.

Use Test. currantPage .getParamatars put (MyTaestPaga) ;

C.

Use controller. currentPage. setPage (MyTastfage) ;

D.

Use Test. setCurrentPage MyTestPags;

Full Access
Question # 20

A company has a native iOS order placement app that needs to connect to Salesforce to retrieve consolidated information from many different objects in a

JSON format.

Which is the optimal method to implement this in Salesforce?

A.

Apex REST web service

B.

Apex SOAP web service

C.

Apex SOAP callout

D.

Apex REST callout

Full Access
Question # 21

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?

A.

Custom setting

B.

Custom object

C.

Custom variable

D.

Custom metadata

Full Access
Question # 22

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?

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.

Full Access
Question # 23

A user receives the generic "An internal server error has occurred” while interacting

with a custom Lightning component.

What should the developer do to ensure a more meaningful message?

A.

Add an onerror event handler to the tag.

B.

Add an error-view component to the markup.

C.

Use platform events to process the error

D.

Use an AuraHandledexception in a try-catch block.

Full Access
Question # 24

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

What may have caused this problem?

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.

Full Access
Question # 25

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?

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.

Full Access
Question # 26

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?

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.

Full Access
Question # 27

As part of their quoting and ordering process, a company needs to send POFs to their document storage system's REST endpoint that supports OAuth 2.0. Each Salesforce user must be individually authenticated with the document storage system to send the PDF.

What is the optimal way for a developer to implement the authentication to the REST endpoint?

A.

Named Credential with an OAuth Authentication Provider

B.

Named Credential with Password Authentication

C.

Hierarchy Custom Setting with an OAuth token custom field

D.

Hierarchy Custom Setting with 2 password custom field

Full Access
Question # 28

An org has 2 requirement that addresses on Contacts and Accounts should be normalized to a company standard by Apex code any time that they are saved.

What is the optimal way to implement this?

A.

Apex triggers on Contact and Account that call a helper class to normalize the address

B.

Apex trigger on Account that calls the Contact trigger to normalize the address

C.

Apex triggers on Contact and Account that normalize the address

D.

Apex trigger on Contact that calls the Account trigger to normalize the address

Full Access
Question # 29

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?

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.

Full Access
Question # 30

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?

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.

Full Access
Question # 31

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

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

Full Access
Question # 32

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)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 33

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?

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.

Full Access
Question # 34

Consider the following code snippet:

A developer created the following test class to provide the proper code coverage for the snippet above:

However, when the test runs, no data is returned and the assertion fails.

Which edit should the developer make to ensure the test class runs successfully?

A.

Implement the without sharing keyword in the searchFeaturs Apex class.

B.

Implement the seeAllData=true attribute in the @1sTest annotation.

C.

Enclose the method call within Test. startbest i) and @Test_stopTast |).

D.

Implement the setFixedSearchResult= method in the test class.

Full Access
Question # 35

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

What should be used to fix this failing test?

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

Full Access
Question # 36

An environment has two Apex triggers: an after-update trigger on Account and an after-update trigger on Contact.

The Account after-update trigger fires whenever an Account's address is updated, and it updates every associated Contact with that address. The Contact after-update trigger fires on every edit, and it updates every Campaign Member record related to the Contact with the Contact's state.

Consider the following: A mass update of 200 Account records’ addresses, where each Account has 50 Contacts. Each Contact has one Campaign Member. This means there are 10,000 Contact records across the Accounts and 10,000 Campaign Member records across the contacts.

What will happen when the mass update occurs?

A.

There will be no error and all updates will succeed, since the limit on the number of records processed by DML statements was not exceeded.

B.

The mass update of Account address will succeed, but the Contact address updates will fail due to exceeding number of records processed by DML statements.

C.

There will be no error, since each trigger fires within its own context and each trigger does not exceed the limit of the number of records processed by DML statements.

D.

The mass update will fail, since the two triggers fire in the same context, thus exceeding the number of records processed by DML statements.

Full Access
Question # 37

Which three approaches should a developer implement to obtain the best performance for data retrieval when building a Lightning web component? Choose 3 answers

A.

Use lazy load for occasionally accessed data.

B.

Use layoutTypes: 9'Full') to display a set of fields.

C.

Use the Lightning Data Service.

D.

Use getRecordUi to obtain metadata.

E.

Use {Cacheable=true} whenever possible

Full Access
Question # 38

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

class for a Visualforce controller?

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,

Full Access
Question # 39

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?

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.

Full Access
Question # 40

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?

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.

Full Access
Question # 41

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?

A.

Use the @future annotation.

B.

Implement the Qususabls interface.

C.

Implement the Batchable interface.

D.

Use platform events.

Full Access
Question # 42

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

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.

Full Access
Question # 43

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

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.

Full Access
Question # 44

An Apex class does not achieve expected code coverage. The testsetup method explicitly calls a method In the Apex class..

How can the developer generate the code coverage?

A.

Use system.assert() in testSetup to verify the values are being returned.

B.

Verify the user has permissions passing a user into System,.runds().

C.

Call the Apex class method from a testsetup Instead of the testsetup methed.

D.

Add @testvisible to the method in the class the developer is testing.

Full Access
Question # 45

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?

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.

Full Access
Question # 46

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?

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.

Full Access
Question # 47

A developer is responsible for formulating the deployment process for a Salesforce project. The project follows a source-driven development approach, and the developer wants to ensure efficient deployment and version control of the metadata changes.

Which tool or mechanism should be utilized for managing the source-driven deployment process?

A.

Metadata API

B.

Change Sets

C.

Force.com IDE

D.

Salesforce CLI with Salesforce DX

Full Access
Question # 48

A developer gets an error saying ‘Maximum Trigger Depth Exceeded.’

What is a possible reason to get this error message?

A.

A trigger is recursively invoked more than 16 times.

B.

The SOQL governor limits are being hit.

C.

There are numerous DML operations in the trigger logic.

D.

A flow trigger was included too many times.

Full Access
Question # 49

A developer used custom settings to store some configuration data that changes occasionally. However, tests are now Failing in some of the sandboxes that were recently refreshed.

What should be done to eliminate this issue going forward?

A.

Set the setting type on the custom setting to List.

B.

Replace custom settings with static resources.

C.

Set the setting type on the custom setting to Hierarchy.

D.

Replace custom settings with custom metadata.

Full Access
Question # 50

Refer to the test method below:

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?

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.

Full Access