Winter Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: geek65

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

Questions 4

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

Buy Now
Questions 5

A developer is debugging an Apex-based order creation process that has a requirement to have three savepoints, SP1, SP2, and 5P3 {created in order), before the final execution of the process.

During the final execution process, the developer has a routine to roll back to SP1 for a given condition. Once the condition is fixed, the code then calls 2 roll back to SP3 to continue with final execution. However, when the roll back to SP3 is called, a Funtime error occurs.

Why does the developer receive a runtime error?

Options:

A.

SP3 became invalid when SP1 was rolled back.

B.

The developer has too many DML statements between the savepoints.

C.

The developer used too many savepoints in one trigger session.

D.

The developer should have called SF2 before calling SP3.

Buy Now
Questions 6

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.

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.

Buy Now
Questions 7

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.

Buy Now
Questions 8

Universal Containers uses Salesforce to track orders in an order__c object.

The order = object has private organization-wide defaults. The order = object

has a custom field, Quality_Controller_c, that is a Lookup to User and is used

to indicate that the specified User is performing quality control on the order_ co.

What should be used to automatically give read only access to the User set in the

Quality_Controller field?

Options:

A.

Record ownership

B.

Criteria-based sharing

C.

Apex managed sharing

D.

User managed sharing

Buy Now
Questions 9

A developer is asked to find a way to store sacret data with an ability to specify which profiles and users can access which secrets.

What should be used to store this data?

Options:

A.

system.Cookie class

B.

Custom settings

C.

Static resources

D.

Custom metadata

Buy Now
Questions 10

Recently, users notice that fields that were recently added for one department suddenly disappear without warning.

Which two statements are true regarding these issues and resolution?

Choose 2 answers

Options:

A.

A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production.

B.

Page Layouts should never be deployed via Change Sets, as this causes Field-Level Security to be reset and fields to disappear.

C.

The administrators are deploying their own Change Sets over each other, thus replacing entire Page Layouts in production.

D.

The administrators are deploying their own Change Sets, thus deleting each other's fields from the objects in production.

Buy Now
Questions 11

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.

Buy Now
Questions 12

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.

Buy Now
Questions 13

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.

Buy Now
Questions 14

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.

Buy Now
Questions 15

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.

Buy Now
Questions 16

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

Buy Now
Questions 17

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;

Buy Now
Questions 18

A developer is developing a reusable Aura component that will reside on an sObject Lightning page with the following HTML snippet:

How can the component"5 controller get the context of the Lightning page that the sObject is on without requiring additional test coverage?

Options:

A.

Add force:hasSobjectName to the implements attribute.

B.

Use the gerSubjectType method in an Apex class.

C.

Set the sObject type as a component attribute.

D.

Create a design attribute and configure via App Builder.

Buy Now
Questions 19

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;

Buy Now
Questions 20

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

Options:

A.

B.

C.

D.

Buy Now
Questions 21

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.

Buy Now
Questions 22

A developer wants to write a generic Apex method that will compare the Salesforce Name field between any two object records. For example, to compare the Name field of an Account and an Opportunity; or the Name of an Account and a Contact.

Assuming the Name field exists, how should the developer do this?

Options:

A.

Cast each object into an sObject and use sObject.get to compare the Name fields,

B.

describe) function to compare the values of each Name field.

C.

Use the Salesforce Metadata API to extract the value of each object and compare the Name fields.

D.

Use a string. Replace () method to parse the contents of each Name field and then compare the results.

Buy Now
Questions 23

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

Buy Now
Questions 24

A Lightning web component exists in the system and displays information about the record in context as a medal. Salesforce administrators need to use this component

within the Lightning App Builder,

Which two settings should the developer configure within the xml resource file?

Choose 2 answers

Options:

A.

Specify the target to be lightning_RecordPage

B.

Set the IsExposed=d attribute to true.

C.

Specify the target to be lightning_AppPage

D.

Set the IsVisible attribute to true

Buy Now
Questions 25

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.

Buy Now
Questions 26

Business rules require a Contact ta always be created when a new Account is created.

What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?

Options:

A.

Use setSaverpoint (1) and rollback() with a try-catch block.

B.

Use the Database. Insect method with a11orNone SEL LO alee,

C.

Use the Database. Delete method if the Contact insertion fails.

D.

Disable validation rules on Contacts and set default values with a trigger.

Buy Now
Questions 27

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.

Buy Now
Questions 28

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 .

Buy Now
Questions 29

An Apex trigger creates an order co record every time an Opportunity is won by a Sales Rep. Recently the trigger is creating two orders.

What is the optimal technique for 2 developer to troubleshoot this?

Options:

A.

Disable all flows, and then re-enable them one at at time to see which one causes the error.

B.

Run the Apex Test Classes for the Apex trigger to ensure the code still has sufficient code coverage.

C.

Set up debug logging for every Sales Rep, then monitor the logs for errors and exceptions,

D.

Add system.debug() statements to the code and use the Developer Console logs to trace the code.

Buy Now
Questions 30

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?

Options:

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

Buy Now
Questions 31

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

What change in the controller will fix the error?

Options:

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.

Buy Now
Questions 32

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.

Buy Now
Questions 33

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.

Buy Now
Questions 34

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

Buy Now
Questions 35

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.

Buy Now
Questions 36

Refer to the following code snippet:

A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces information about Leads by wire calling geyFetchLeadList whencertain criteria are met.

Which three changes should the developer implement in the Apex class above to ensure the LWC can display data efficiently while preserving security?

Choose 3 answers

Options:

A.

Annotate the Apex method with @AuraEnabled.

B.

Implement the with sharing keyword in the class declaration.

C.

Implement the with keyword in the class declaration.

D.

Use the WZ E D clause within the SOQL query.

E.

Annotate the Apex method with @AuraEnabled(Cacheable=True).

Buy Now
Questions 37

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

Buy Now
Questions 38

Consider the following code snippet:

The Apex method is executed in an environment with a large data volume count for Accounts, and the query is performing poorly.

Which technique should the developer implement to ensure the query performs optimally, while preserving the entire result set?

Options:

A.

Create a formula field to combine the createdDate and RecordType value, then filter based on the formula.

B.

Break down the query into two individual queries and join the two result sets.

C.

Annotate the method with the @Future annotation

D.

Use the Database queryLocator method to retrieve the accounts.

Buy Now
Questions 39

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that user encounter view state errors when using it in production.

What should the developer ensure to correct these errors?

Options:

A.

Ensure queries do net exceed governor limits,

B.

Ensure properties are marked as private,

C.

Ensure variables are marked as transient.

D.

Ensure profiles have access to the Visualforce page.

Buy Now
Questions 40

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

Buy Now
Questions 41

Instead of waiting to send emails to support personnel directly from the finish

method of a batch Apex process, Universal Containers wants to notify an external

system in the event that an unhandled exception occurs.

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

Options:

A.

Publish the error event using the Eventbus. publish () method.

B.

No publishing is necessary. Have the external system subscribe to the BatchapexErrorEvent.

C.

Publish the error event using the addError method.

D.

Publish the error event with a Flow.

Buy Now
Questions 42

An Apex trigger creates a Contract record every time an Opportunity record is

marked as Closed and Won. This trigger is working great, except (due to a recent

acquisition) historical Opportunity records need to be loaded into the Salesforce

instance.

When a test batch of records are loaded, the Apex trigger creates Contract records.

A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created.

‘What is the most extendable way to update the Apex trigger to accomplish this?

Options:

A.

Add the Profile ID of the user who loads the data to the trigger, so the trigger will not fire for this user.

B.

Add a validation rule to the Contract to prevent Contract creation by the user who loads the data.

C.

Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who loads the data.

D.

Use a list custom setting ta disable the trigger for the user who loads the data.

Buy Now
Questions 43

Refer to the Aura component below:

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.

Buy Now
Questions 44

A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow.

What can a developer to do address the issue?

Options:

A.

Turn off triggers, flows, and validations when running tests.

B.

Move the prerequisite reference data setup to a TestDataFactory and call that from each test method,

C.

Move the prerequisite reference data setup to a @testSetup method in the test class.

D.

Move the prerequisite reference data setup to the constructor for the test class.

Buy Now
Questions 45

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?

Options:

A.

Metadata API

B.

Change Sets

C.

Force.com IDE

D.

Salesforce CLI with Salesforce DX

Buy Now
Questions 46

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

Buy Now
Questions 47

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

Buy Now
Questions 48

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.

Buy Now
Questions 49

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.

Buy Now
Questions 50

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.

Buy Now
Exam Code: PDII
Exam Name: Salesforce Certified Platform Developer II (SU24)
Last Update: Nov 21, 2024
Questions: 193
PDII pdf

PDII PDF

$28  $80
PDII Engine

PDII Testing Engine

$33.25  $95
PDII PDF + Engine

PDII PDF + Testing Engine

$45.5  $130