wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Salesforce PD2 - Review 1

Total questions: 56

Worksheet time: 30mins

Name
Class
Date
1.

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

Which strategy can a developer use to improve the performance?

a)

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

b)

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

c)

Use an <apex:actionPoller> in the page to load all of the data asynchronously.

d)

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

2.

After a Platform Event is defined in a Salesforce org, events can be published via which two mechanisms ?

Choose 2 answers

a)

Internal Apps can use Outbound Messages

b)

Internal Apps can use Process Builder

c)

External Apps require the standard Streaming API.

d)

External Apps use an API to publish event messages.

3.

A lead developer for a Salesforce organization needs to develop a page-centric application that allows the user to interact with multiple objects related to a Contact. The application needs to implement a third-party JavaScript framework such as Angular, and must be made available in both Classic and Lightning Experience.
Given these requirements, what is the recommended solution to develop the application ?

a)

Aura Components

b)

Lightning Web Components

c)

Visualforce

d)

Lightning Experience Builder

4.

Universal Containers wants to use an external Web Service provided by a third-party vendor to validate the shipping and billing addresses are correct. The current vendor uses basic password authentication, but Universal Containers might switch to a different vendor who uses OAuth.
Which approach follows best practices and allows Universal Containers to switch vendors without updating the code to handle authentication?

a)

Custom Setting (List)

b)

Named Credential

c)

Custom Metadata

d)

Dynamic Endpoint

5.

Which code statement includes an Apex method named updateAccounts in the class AccountController for use in a Lightning Web component?

a)

import updateAccounts from '@salesforce/apex/AccountController';

b)

import updateAccounts from 'AccountController';

c)

import updateAccounts from 'AccountController.updateAccounts';

d)

import updateAccounts from '@salesforce/apex/AccountController.updateAccounts';

6.

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)

Perform all DML operations from within a Future Method.

c)

Instead of DML statements, use the Database methods with allOrNone set to False.

d)

Add LIMIT 50000 to every SOQL statement,

7.

Universal Containers has an existing automation where a custom record called Account Plan is created upon an Account being marked as a Customer. Recently, a Workflow Rule was added so that whenever an Account is marked as a Customer, a 'Customer Since' date field is update with today's date.

Now, since the addition of the Workflow Rule, two Account Plan records are created whenever the Account is marked as a Customer.

What might cause this to happen ?

a)

The Apex Trigger responsible for the record creation does not use a static variable to ensure it only fires once.

b)

The Process Builder responsible for the record creation fires before and after the Workflow rule.

c)

The Workflow Rule responsible for the record creation fires twice because the 'Customer Since' field Update is marked as 'Re-evaluate Workflow Rules After Field Change'.

d)

The Apex Trigger responsible for the record creation is not bulk safe and calls Insert of a for loop

8.

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

a)

Use Test.currentPage.getParameters.put(MyTestPage);

b)

Use Test.setCurrrentPage(Page.MyTestPage);

c)

Use Test.setCurrentPage.MyTestPage;

d)

Use controller.currentPage.setPage(MyTestPage);

9.

A company has a custom object, Order__c, that has a custom picklist field, Status__c, with values of 'New', 'In Progress', or 'Fulfilled' and a lookup field, Contact__c, to Contact.

Which SOQL query will return a unique list of all Contact records that have no 'Fulfilled' Orders?

a)

SELECT Contact__c FROM Order__c WHERE Id NOT IN (SELECT Id FFROM Order__c WHERE Status__c = 'Fulfilled')

b)

SELECT Contact__c FROM Order__c WHERE Status__c <> 'Fulfilled'

c)

SELECT Id FROM Contact WHERE Id NOT IN (SELECT Id FROM Order__c WHERE Status__c = 'Fulfilled' )

d)

SELECT Id FROM Contact WHERE Id NOT IN (SELECT Contact__c FROM Order__C WHERE Status__c = 'Fulfilled' )

10.

A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users wants to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page.

Which Apex code feature is required to facilitate this solution?

a)

SOSL queries

b)

Report API

c)

Dynamic Schema binding

d)

describeSObjects()

11.

As part of an integration development effort, a developer is tasked to create an Apex method that solely relies on the use of foreign identifiers in order to relate new contact records to existing Accounts in Salesforce. The account object contains a field marked as an external ID, the API Name of this field is Legacy_Id__c.

What is the most efficient way to instantiate the parentAccount variable on the line 02 to ensure the newly created contact is properly related to the Account?

a)

Account parentAccount = [SELECT Id FROM Account WHERE Legacy_Id__c = :externalIdentifier].Id;

b)

Account parentAccount = new Account (Legacy_Id__c = externalIdentifier);

c)

Account parentAccount = [SELECT Id FROM Account WHERE Legacy_Id_c = :externalIdentifier];

d)

Account parentAccount = new Account();
parentAccount.Id = externalIdentifier;

12.

The use of the transient keyword in Visualforce Page Controllers helps with which common performance issue?

a)

Improves Query Performance

b)

Improves Page Transfers

c)

Reduces Load Times

d)

Reduces View State

13.

A company wants to implement a new call center process for handling customer service calls. It requires service reps to ask for the caller's account number before proceeding with the rest of their call script.
Following best practices, what should a developer use to meet this requirement?

a)

Approvals

b)

Flow Builder

c)

Apex Trigger

d)

Process Builder

14.

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)

Remote Site Settings

b)

Connected Apps

c)

Named Credentials

d)

Session Id

15.

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 a batch Apex process to run every day that queries and deletes records older than seven years

b)

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

c)

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

d)

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

16.

A developer needs to send Account records to an external system for backup purposes. The process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web service. The web service can only receive, at most, one record per call.
Which feature should be used to implement these requirements?

a)

Workflow

b)

Process Builder

c)

@future

d)

Queueable

17.

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 Tab

b)

Salesforce Lightning Inspector Transactions Tab

c)

Salesforce Lightning Inspector Actions Tab

d)

Salesforce Lightning Inspector Event Log Tab

18.

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

Which two setting should the developer configure within the xml resource file

Choose 2 Answers

a)

Set the IsVisible attribute to True

b)

Set the IsExposed attribute to True

c)

Specify the target to be lightning__AppPage

d)

Specify the target to be lightning__RecordPage

19.

Which statement is true regarding savepoints?

a)

You can rollback to any savepoint variable created in any order.

b)

Reference to savepoints can cross trigger invocations

c)

Savepoints are not limited by DML statement governor limits.

d)

Static variables are not reverted during rollback.

20.

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 update records.

The CalloutUtil.makeRestCalloutfails with a 'You have uncommitted work pending Please commit or rollback before calling out' error.

What should be done to address the problem?

a)

Change the CalloutUtil.makeRestCallout to an @InvocableMethod method.

b)

Move the Callout.makeRestCallout method call below the catch block.

c)

Change the CalloutUtil.makeRestCallout toan @future method.

d)

Remove the Database.setSavepoint and Database.rollback.

21.

A custom object called Credit_Memo__c exists in a Salesforce environment. As part of a new feature development that retrieves and manipulates this type of record, the developer needs to ensure race conditions are prevented when a set of records are modified within an Apex transaction.

In the preceding Apex code, how can the developer alter the query statement to use SOQL features to prevent race conditions within a transaction?

a)

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

b)

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

c)

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

d)

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

22.

A company wants to build a custom Aura components that displays a specified Account Field Set and that can only be added to the Account record page.

Which design resource configuration should be used?

a)

b)

c)

d)

23.

A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field.

<apex:selectList value="{!selectedIndustry}">

<apex:selectOptions values="{!industries}"/>

</apex:selectList>

When a user changes the value on the industry select list, the table of Accounts should be automatically updated to shown the Accounts associated with the selected industry.

What is the optimal way to implement this?

a)

Add an <apex:actionFunction> within <apex:selectList>.

b)

Add an <apex:actionSupport> within <apex:selectList>.

c)

Add an <apex:actionFunction> within <apex:selectOptions>.

d)

Add an <apex:actionSupport> within <apex:selectOptions>.

24.

Which scenario requires a developer to use an Apex callout instead of Outbound Messaging?

a)

The target system uses a REST API.

b)

The callout needs to be Invoked from a Workflow Rule

c)

The target system uses a SOAP API.

d)

The callout needs to be asynchronous.

25.

Which two relationship queries use the proper syntax?

a)

SELECT Name, (SELECT LastName FROM Contacts__r) FROM Account

b)

SELECT Name, (SELECT LastName FROM Contacts) FROM Account

c)

SELECT Id, Name, Account.Name FROM Contact WHERE Account.Industry = 'Media'

d)

SELECT Id , Name, Account__r.Name FROM Contact WHERE Account__r.Industry = 'Media'

26.

As part of a custom development, a developer creates a Lightning Component to show how a particular opportunity progresses over time. The component must display the date stamp when any of the following fields change:

Amount, Probability, Stage, or Close Date

What is the most efficient way to query such information?

a)

b)

c)

d)

27.

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. Also, Workflows that once sent emails and created task no longer do so.

Which two statements are true regarding these issues and resolution?

Choose 2 answers.

a)

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

b)

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

c)

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

d)

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

28.

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 is 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?

a)

Use a List Custom Setting to disable the trigger for the user who loads the data.

b)

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

c)

Use the Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data.

d)

Add a Validation Rule to Contract to prevent Contract creation by the user who loads the data.

29.

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

a)

b)

c)

d)

30.

Assuming the CreateOneAccount class creates one account and implements the Queueable interface, which syntax tests the Apex code?

a)

b)

c)

d)

31.

A company uses custom-built enterprise resource planning (ERP) system to handle order management. The company want Sales reps to know the status of orders so that if a customer calls to ask about their shipment, the Sales Rep can advise the customer about the order's status and tracking number if it is already shipped.

Which two methods can make this ERP order data visible in Salesforce?

Choose 2 answers

a)

Have the ERP system push the data into Salesforce using the SOAP API

b)

Use Salesforce Connect to view real-time Order data in the ERP system.

c)

Write a cron job in Salesforce to poll the ERP system for order updates.

d)

Ensure real-time order data is in Salesforce using the Streaming API

32.

Refer to the code segment above.

When following best practices for writing Apex triggers, which two lines are wrong or cause for concern?

Choose 2 answers

a)

Line 6

b)

Line 11

c)

Line 16

d)

Line 20

33.

A developer is integrating with a legacy on-premise SQL database.

What should the developer use to ensure the data being integrated is matched to the right records in Salesforce?

a)

External Id field

b)

Lookup field

c)

Formula field

d)

External Object

34.

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.

<lightning:layout multipleRows="false">

<lightning:layoutItem size="6"> {!v.rec.Name} </lightning:layoutItem>

<lightning:layoutItem size="6"> {!v.rec.Description__c} </lightning:layoutItem>

</lightning:layout>

Which option has the changes to make the component responsive for mobile and tablet devices?

a)

b)

c)

d)

35.

Universal Containers stores user preferences in a Hierarchy Custom Setting, User_Prefs__c, with a Checkbox field, Show_Help__c. 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?

a)

Boolean show = User_Prefs__c.getInstance().Show_Help__c;

b)

Boolean show = User_Prefs__c.getValues().Show_Help__c;

c)

Boolean show = User_Prefs__c.Show_Help__c;

d)

Boolean show = User_Prefs__c.getValues(UserInfo.getUserId()).Show_Help__c;

36.

Users complain that a page is very slow to respond. Upon investigation, the query below is found to perform slowly.

SELECT Id, Name FROM Contact WHERE CustomField__c = null;

Which two actions can a developer take to improve performance?

Choose 2 answers

a)

Add a LIMIT clause to the query to reduce the number of records returned.

b)

Contact Salesforce customer support to create a custom index to include null values.

c)

Make the CustomField__c field an External ID

d)

Make the field CustomField__c required because Salesforce field indexes do not include nulls.

37.

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 will be stored in a custom object for ease of maintenance by users. Note that 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 an Apex trigger on Contact and also implement the logic within the Custom Visualforce page controller.

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 a Validation Rule on the Contact and a Validation Rule on the Survey_Response__c object.

d)

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

38.

How should a developer verify that a specific Account record is being tested in a test class for a Visualforce controller?

a)

Instantiate the page reference in the test class, Insert the Account in the test class, then use System.setParentRecordId().get() to set the Account ID.

b)

Instantiate the page reference in the test class, insert the Account in the test class, then use seeAllData=true to view the Account.

c)

Insert the Account into Salesforce, instantiate the page reference in the test class, then use System.setParentRecordId().get() to set the Account ID.

d)

Insert the Account in the test class, instantiate the page reference in the test class, then use System.currentPageReference().getParameters().put() to set the Account ID

39.

A developer has a Batch Apex process, Batch_Account_Sales, that updates the sales amount for 10,000 Accounts on a nightly basis. The Batch Apex works as designed in the sandbox. However, the developer cannot get code coverage on the Batch Apex class.

The test class below:

What is causing the code coverage problem?

a)

The batch process will not recognize new accounts created in the same session

b)

The account creation already sets the sates amount to 0.

c)

The executeBatch must fail within test. startTest ( ) and test. stopTest().

d)

The batch needs more than one account record created.

40.

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)

Call the Apex class method from the a testMethod instead of the testSetup method.

b)

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

c)

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

d)

Add @testVisible to the method in the class the developer is testing

41.

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?

a)

A Continuation for both the billing callout and the tax callout.

b)

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

c)

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

d)

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

42.

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

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

a)

The callouts will be made in an Apex Test class

b)

The callout could take longer than 60 seconds to complete

c)

The callout will be made in an Apex Trigger

d)

Over 10 callouts will be made in a single transaction

43.

Users report that a button on a custom Lightning web component is not working. However, there are no other details provided.

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

a)

Use the Database method with allOrNone set to false.

b)

Add JavaScript and HTML to display an error message.

c)

Add the <apex:message/> tag to the component

d)

Add a try-catch block surrounding the DML statement.

44.

A company represents their customers as Accounts in Salesforce. All customers have a unique Customer_Number__c that is unique across all of the company's systems. They also have a custom Invoice__c object, with a Lookup to Account, to represent invoices that are sent out from their external system. This company wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer is paying their bills on time.
What is the optimal way to implement this?

a)

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

b)

Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an External ID and Upsert invoice data nightly.

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.

45.

A developer wishes to improve runtime performance of Apex calls by caching results on the client.

What is the most efficient way to implement this?

a)

Decorate the server-side method with @AuraEnabled(cacheable=true)

b)

Decorate the server-side method with @AuraEnabled(storable=true)

c)

Set a cookie in the browser for use upon return to the page.

d)

Call the setStorable() method on the action in the JavaScript client-side code

46.

The Contact object in an org is configured with the workflow rules that trigger field updates. The fields are not updating, even though the end user expects them to. The developer creates a debug log to troubleshoot the problem.

What should the developer specify in the debug log to see the values of the workflow rule conditions and debug the problem?

a)

ERROR level for the Workflow log category

b)

INFO level for the Workflow log category

c)

INFO level for the Database log category

d)

ERROR level for the Database log category

47.

A developer is building a Lightning web component to get data from an Apex method called getData that takes a parameter, name. The data should be retrieved when the user clicks the Load Data button.

What must be added to get the data?

a)

Add @wire(getData, (name: $name’)} to the account field and this, account = getData ( ) ; to t loadData ( ) function.

b)

Add this, account = getData (this,name); to the loadData ( ) function

c)

Add getData ({ name; this,name}) , then (result=> { this.account = result}) to the LeadData ( ) function

d)

Add @wire(getData, {name: $name’}) to the account field and delete loadData ( ) because it is not needed

48.

Universal Containers needs to integrate with a Heroku service that resizes product images submitted by users.

What are two alternatives to implement the integration and protect against malicious calls to the Heroku app's extension?

Choose 2 answers

a)

Create a Workflow Rule with an Outbound Message allowing the Heroku app to automatically store the resized images in Salesforce

b)

Create a Workflow Rule with an Outbound Message and select Send Session ID so that the Heroku app can use it to send the resized images back to Salesforce.

c)

Create a trigger that uses an ©future Apex HTTP callout passing JSON serialized data; therefore the Heroku app can automatically reply back to the callout with the resized images in Salesforce.

d)

Create a trigger that uses an ©future Apex HTTP callout passing JSON serialized data and some form of pre-shared secret key, so that the Heroku app can authenticate requests and store the resized images in Salesforce.

49.

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

What may have cause this problem?

a)

The event is fired from a custom renderer

b)

An event is fired 'ontouchend' and is unhandled.

c)

The event has multiple handlers registered in the project

d)

The event handler calls a trigger

50.

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

a)

Use JavaScript remoting the script tags

b)

Use CDNs with scripts attributes

c)

Join multiple assets from a static resource

d)

Implement the libraries in a separate helper files

51.

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?

a)

The test class not implemented seeAllData=true in the test method.

b)

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

c)

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

d)

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

52.

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

a)

Does not require any Apex code

b)

Allows for specified re-render targets

c)

Does not require any JavaScript code

d)

Support complex server-side application logic

53.

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 all Workflow Rules have fired.
What is the optimal way to accomplish this?

a)

Use a MassEmailMessage() with an Apex Trigger.

b)

Use a Workflow Email Alert.

c)

Use an Email Alert with Process Builder.

d)

Use a SingleEmailMessage() with an Apex Trigger.

54.

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users are encountering ViewState errors when using it in Production.
What should the developer ensure to correct these errors?

a)

Ensure queries do not exceed governor limits.

b)

Ensure properties are marked as Transient.

c)

Ensure properties are marked as private.

d)

Ensure profiles have access to the Visualforce page.

55.

A developer created an Apex class that makes outbound RESTful callout. The following was created to send a fake response in Apex test methods.

Which method can be called to return this fake response in the test methods?

a)

testSetup

b)

Test.createSub

c)

Test.setMock

d)

Test.setTestData

56.

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

a)

Use an aura:handler "init" event to call a function

b)

Use the renderedCallback() method.

c)

Call $A.enqueueAction passing in the method to call.

d)

Use the connectedCallback() method.