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

Home > Salesforce > Developers > PDII

PDII Salesforce Certified Platform Developer II ( Plat-Dev-301 ) Question and Answers

Question # 4

A developer implemented a custom data table in a Lightning web component with filter functionality. However, users are submitting support tickets about long load times when the filters are changed. The component uses an Apex method that is called to query for records based on the selected filters. What should the developer do to improve performance of the component?

A.

Use SOSL to query the records on filter change.1

B.

Use setStorable() in the Apex method to store the response in the client-side cache.2

C.

Return all records into a list when the component is created and filter the array in JavaScript.3

D.

Use a4 selective SOQL query with a custom index.

Full Access
Question # 5

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?

A.

Use an Apex trigger with Batch Apex.

B.

Use an Email Alert with Flow Builder.

C.

Use MassEmailMessage() with an Apex trigger.

D.

Use SingleEmailMessage() with an Apex trigger.

Full Access
Question # 6

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

Java

public static Account[] searchTestAccounts() {

List> searchList = [FIND 'test' IN ALL FIELDS RETURNING Account(Name)];

return (Account[]) searchList[0];

}

However, the test method below fails.

Java

@isTest

public static void testSearchTestAccounts() {

Account a = new Account(name='test');

insert a;

Account [] accounts = TestAccountFinder.searchTestAccounts();

System.assert(accounts.size() == 1);

}

What should be used to fix this failing test?

A.

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

B.

Test.loadData to set up expected data10

C.

Test.setFixedSearchResults() method to set up expected data11

D.

@testSetup method to set up expected data12

Full Access
Question # 7

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?

A.

Apex managed sharing23

B.

Sharing sets24

C.

Role hierarchy25

D.

Criteria-based sharing rules26

Full Access
Question # 8

Universal Containers uses Salesforce to track orders in an Order__c object. The Order__c object has private organization-wide defaults. The Order__c 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__c. What should be used to automatically give read only access to the User set in the Quality_Controller__c field?

A.

User managed sharing

B.

Record ownership

C.

Apex managed sharing

D.

Criteria-based sharing

Full Access
Question # 9

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

A.

B.

C.

D.

Full Access
Question # 10

A developer needs a Lightning web component to display in one column on phones and two columns on tablets/desktops. Which should the developer add to the code?

A.

Add size="12" medium-device-size="6" to the elements

B.

Add size="6" small-device-size="12" to the elements

C.

Add small-device-size="12" to the elements

D.

Add medium-device-size="6" to the elements

Full Access
Question # 11

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?

A.

Salesforce Lightning Inspector Storage tab12

B.

Salesforce Lightning Inspector Event Log tab34

C.

Salesforce Lightning Inspector Actions tab56

D.

Salesforce Lightning Inspector Transactions tab78

Full Access
Question # 12

Refer to the code snippet below:

Java

public static void updateCreditMemo(String customerId, Decimal newAmount){

List toUpdate = new List();

for(Credit_Memo__c creditMemo : [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50]) {

creditMemo.Amount__c = newAmount;

toUpdate.add(creditMemo);

}

Database.update(toUpdate,false);

}

A custom object called Credit_Memo__c exists in a Salesforce environment. As part of a new feature development, the developer needs to ensure race conditions are prevented when a set of records are mod1ified within an Apex transaction. In the preceding Apex code, how can the developer alter the que2ry statement to use SOQL features to prevent race conditions within a tr3ansaction?4

A.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR UPDATE]

B.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId USING SCOPE LIMIT 50]

C.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR REFERENCE]

D.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR VIEW]

Full Access
Question # 13

A developer is tasked with creating a Lightning web component that is responsive on various devices. Which two components should help accomplish this goal?

A.

Lightning-input-location

B.

Lightning-layout

C.

Lightning-navigation

D.

Lightning-layout-item

Full Access
Question # 14

Universal Containers implements a private sharing model for Convention_Attendee__c. A lookup field Event_Reviewer__c was created. Management wants the event reviewer to automatically gain Read/Write access to every record they are assigned to. What is the best approach?

A.

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

B.

Create a before 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.

Full Access
Question # 15

Universal Containers develops a Visualforce page that requires the inclusion of external JavaScript and CSS files. They want to ensure efficient loading and caching of the page. Which feature should be utilized to achieve this goal?

A.

Static resources

B.

@RemoteAction

C.

D.

Full Access
Question # 16

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.

Savepoints are not limited by DML statement governor limits.

D.

Reference to savepoints can cross trigger invocations.

Full Access
Question # 17

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 th23e Accounts and 10,000 Campaign Member records across the contacts. What will happen when the mass update occurs?24252627

A.

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

B.

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

C.

The mass update will fail, since the two triggers fire in the same35 context, thus exceeding the number of records.36

Full Access
Question # 18

Consider the following code snippet:

HTML

Users of this Visualforce page complain that the page does a full refresh every time the Search button is pressed. What should the developer do to ensure that a partial refresh is made so that only t13he section identified with opportunityList is re-drawn on the screen?1415

A.

Enclose the DAT16A table within the tag.1718

B.

Implement the tag with immediate = true.

C.

Ensure the action method search returns null.19

D.

Implement the reRender attribute on the tag.

Full Access
Question # 19

A developer wrote an Apex class to make several callouts to an external system. If the URLs used in these callouts will change often, which feature should the developer use to minimize changes needed to the Apex class?

A.

Named Credentials

B.

Connected Apps

C.

Remote Site Settings

D.

Session Id

Full Access
Question # 20

A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called jsUtils 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?

A.

import jsUtilities from '@salesforce/resourceUrl/jsUtils';

B.

import {jsUtilities} from '@salesforce/resourceUrl/jsUtils';

C.

const jsUtility = $A.get('$Resource.jsUtils');

D.

Full Access
Question # 21

A large company uses Salesforce across several departments. Each department has its own Salesforce Administrator. It was agreed that each Administrator would have their own sandbox in which to test changes. 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?3637

A.

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

B.

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

C.

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

D.

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

Full Access
Question # 22

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

Java

global with sharing class MyRemoter {

public String accountName { get; set; }

public static Account account { get; set; }

public MyRemoter() {}

@RemoteAction

global static Account getAccount(String accountName) {

account = [SELECT Id, Name, NumberOfEmployees FROM Account WHERE Name = :accountName];

return account;

}

}

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

A.

Java

MyRemoter remote = new MyRemoter();

Account a = remote.getAccount('TestAccount');

System.assertEquals( 'TestAccount', a.Name );

B.

Java

MyRemoter remote = new MyRemoter('TestAccount');

Account a = remote.getAccount();

System.assertEquals( 'TestAccount' , a.Name );

C.

Java

Account a = controller.getAccount('TestAccount');

System.assertEquals( 'TestAccount', a.Name );

D.

Java

Account a = MyRemoter.getAccount('TestAccount');

System.assertEquals( 'TestAccount', a.Name );

Full Access
Question # 23

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.

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

C.

Use UserInfo.getLocale() in the component.

D.

Import the @salesforce/i18n module and use the firstDayOfWeek internationalization property.

Full Access
Question # 24

Universal Containers wants to use a Customer Community with Customer Community Plus licenses. UC uses a Private sharing model for External users. 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. Which solution solves these requirements?

A.

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

B.

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

C.

A Visualforce page that uses a custom controller that specifies without sharing to expose the records.

D.

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

Full Access
Question # 25

An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed and Won. A developer is tasked with preventing Contract records from being created when mass loading historical Opportunities, but the daily users still need the logic to fire. What is the most extendable way to update the Apex trigger to accomplish this?

A.

Add the Profile ID of the user who loads the data to the trigger.

B.

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

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 to disable the trigger for the user who loads the data.

Full Access
Question # 26

Consider the following code snippet:78

Java

trigger OpportunityTrigger on Opportunity (before insert, before update) {

for(Opportunity opp : Trigger.new){

OpportunityHandler.setPricingStructure(Opp);

}

}

public class OpportunityHandler{

public static void setPricingStructure(Opportunity thisOpp){

Pricing_Structure_c ps = [Select Type_c FROM Pricing_Structure_c WHERE industry_c = :thisOpp.Account_Industry_c];

thisOpp.Pricing_Structure_c = ps.Type_c;

update thisOpp;

}

}

Which two best practices should the developer implement to optimize this code?

A.

Remove the DML statement.

B.

Change the trigger context to after update, after insert.

C.

Query the Pricing_Structure_c records outside of the loop.

D.

Use a collection for the DML statement.

Full Access
Question # 27

Which three actions must be completed in a Lightning web component for a JavaScript file in a static resource to be loaded?

A.

Call loadScript.

B.

Import the static resource.

C.

Import a method from the platformResourceLoader.

D.

Reference the static resource in a