Salesforce pdii practice test

Platform Developer II Exam

Last exam update: Feb 21 ,2024
Page 1 out of 27. Viewing questions 1-15 out of 396

Question 1

A developer is creating a page in App Builder that will be used in the Salesforce mobile app.
Which two practices should the developer follow to ensure the page operates with optimal
performance?
Choose 2 answers

  • A. Limit five visible components on the page.
  • B. Limit 25 fields on the record detail page.
  • C. Limit the number of Tabs and Accordion components.
  • D. Analyze the page with Performance Analysis for App Builder.
Answer:

B, D

User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D 2 votes
50%

Explanation:

Discussions
vote your answer:
A
B
C
D
0 / 1000
isirbu
4 months, 3 weeks ago

CD https://help.salesforce.com/s/articleView?id=sf.lightning_page_performance.htm&type=5

2 months ago

BD

If a page has more than 5 related lists or more than 25 fields in the record detail, users can encounter performance issues when viewing the page in the Salesforce mobile app.
In the Performance Analysis for App Builder tool:
Components that are restricted to the desktop form factor via a visibility rule aren’t included in the phone form factor performance assessment.
Analysis of page performance on a phone is available only on pages whose template supports the phone form factor.
Components aren't the only factors influencing page load time, so the numbers in the component impact chart don't add up to 100% of the predicted page load time.
Analysis of pages for the desktop form factor is measured in seconds. For the phone form factor, the page is scored based on the components that are visible when the page loads on a phone.
User metrics are org-specific or page-specific data. Previously activated pages display metrics from visits to that page. New pages display metrics from visits


Question 2

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?

  • A. Annotate the method with the @Future annotation.
  • B. Create a formula field to combine the CreatedDate and RecardType value, then filter based on the formula.
  • C. Use the Database.queryLocator method to retrieve the accounts.
  • D. Break down the query into two individual queries and Join the two result sets.
Answer:

D

User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000
isirbu
4 months, 3 weeks ago

wtf is D? C is the right answer

[email protected] (replied to isirbu)
2 months ago

yea, I think you are correct

2 months ago

https://salesforce.stackexchange.com/questions/239868/database-query-locator-vs-simple-query


Question 3

A company uses Salesforce to sell products to customers. They also have an external product
information management (PIM) system that is the system of record for products.
A developer received these requirements:
Whenever a product is created or updated in the PIM, a product must be created or updated as a
Product2 record in Salesforce and a PricebookEntry record must be created or updated automatically
by Salesforce.
The PricebookEntry should be created In a Pricebook2 that is specified In a custom setting.
What should the developer use to satisfy these requirements?

  • A. Apex REST
  • B. Event Monitoring
  • C. Invocable Action
  • D. SObJect Tree
Answer:

A

User Votes:
A 1 votes
50%
B
50%
C
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 4

A Salesforce org has more than 50,000 contacts. A new business process requires a calculation that
aggregates data from all of these contact records. This calculation needs to run once a day after
business hours.
Which two steps should a developer take to accomplish this?
Choose 2 answers

  • A. Use the @future annotation on the method that performs the aggregate calculation.
  • B. Implement the schedulable Interface In the class that contains the aggregate calculation method.
  • C. Use the areadOnly annotation on the method that performs the aggregate calculation.
  • D. Implement the Queuable Interface in the class that contains the aggregate calculation method.
Answer:

B, D

User Votes:
A
50%
B 1 votes
50%
C
50%
D 1 votes
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 5

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 SI,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 prevent the business logic that obtains the high
value opportunities from being repeated in more than one place?
Choose 2 answers

  • A. Use custom metadata to hold the high value amount.
  • B. Call the trigger from the Lightning web component.
  • C. Leave the business logic code Inside the trigger for efficiency.
  • D. Create a helper class that fetches the high value opportunities.
Answer:

A, D

User Votes:
A 1 votes
50%
B
50%
C
50%
D 1 votes
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

Universal Containers requested the addition of a third-party Map widget to an existing Lightning web
component.
Which two actions should the developer take to implement this requirement?
Choose 2 answers

  • A. Import the third-party JavaScript module directly Into the component.
  • B. Use a content distribution network and Include <script> <script> tags In the component.
  • C. Import loadscript from lightning platformResourceLoader.
  • D. Upload the third-party JavaScript library as a static resource that Imports Into the component.
Answer:

C, D

User Votes:
A
50%
B
50%
C 1 votes
50%
D 1 votes
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 7

Consider the following code snippet:

Which two steps should the developer take to add flexibility to change the endpolnt and credentials
without needing to modify code?
Choose 2 answers

  • A. Create a Named Credential, endPoint_NC, to store the endpoint and credentials.
  • B. Store the URL of the endpoint in a custom Label named endPointURL.
  • C. Use req.setEndpoint(,callcut:endPoint_NC,); within the callout request.
  • D. Use req.setEndpoint(Label.endPointURL);.
Answer:

A, C

User Votes:
A 1 votes
50%
B
50%
C 1 votes
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 8

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

What should be used to fix this falling test?

  • A. Test. loaddata to set up expected data
  • B. Test. fixedSearchResults ( ) method to set up expected data
  • C. @isTest (See AllData=true) to access org data for the test
  • D. @testSetup method to set up expected data
Answer:

B

User Votes:
A
50%
B 1 votes
50%
C
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 9

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. Set a cookie in the browser for use upon return to the page.
  • B. Decorate the server-side method with @AuraEnabled(storagele=true).
  • C. Decorate the server-side method with @AuraEnabled(caccheable-true).
  • D. Call the setstoreable () method on the action in the JavaScript client-side code.
Answer:

C

User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

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. Add the @track decorator to the data variable.
  • B. Create a new variable to store the result and annotate it with @tracx.
  • C. Call refereshApex () on this.data
  • D. Create a variable to store the result and call refreshApex ().
Answer:

D

User Votes:
A
50%
B
50%
C 1 votes
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 11

Which two best practices should the developer Implement to optimize this code?
Choose 2 answers

  • A. Use a collection for the DML statement.
  • B. Query the Pricing_structure__c records outside of the loop.
  • C. Change the trigger context to after update, after insert.
  • D. Remove the DML statement.
Answer:

B, D

User Votes:
A
50%
B
50%
C
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000
2 months ago

It is missing the code snippet.


Question 12

A developer wrote an Apex method that makes an HTTP callout to an external system to get
specialized data when a button is clicked from a custom Lightning web component on the Account
record page.
Recently, users have complained that it takes longer than desired for the data to appear on the page
after clicking the button.
What should the developer use to troubleshoot this issue?

  • A. Lightning Inspector
  • B. Devdoper Console
  • C. Salesforce CU
  • D. Event Logs
Answer:

C

User Votes:
A
50%
B
50%
C
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000
bojana_b
7 months, 3 weeks ago

Right answer is A Lightning Inspector


Question 13

A business currently has a process to manually upload orders from its external Order Management
System (OMS) into Salesforce.
This is a labor intensive process since accounts must be exported out of Salesforce to get the IDs. The
upload file must be updated with the correct account IDs to relate the orders to the corresponding
accounts.
Which two recommendations should make this process more efficient?
Choose 2 answers

  • A. Ensure the data in the file is sorted by the order ID.
  • B. Use the upsert wizard in the Data Loader to import the data.
  • C. Identify unique fields on Order and Account and set them as External IDs.
  • D. Use the Insert wizard In the Data Loader to Import the data.
Answer:

B, C

User Votes:
A
50%
B 1 votes
50%
C 1 votes
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 14

Consider the following code snippet:

Choose 2 answers

  • A. import getOrders from ,@salesforce/apex/OrderController.getAvailableOrders';
  • B. import ( LightningElement—apt ) from 'lwc*.-
  • C. import getOrders from @salesforc/apex/c.OrderController.getAvailablOrd#r»';
  • D. import { LightningElement, wire ) from 'lwc';
Answer:

A, D

User Votes:
A 1 votes
50%
B
50%
C
50%
D 1 votes
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 15

Users upload .csv files in an external system to create account and contact records in Salesforce. Up
to 200 records can be created at a time. The users need to wait for a response from Salesforce in the
external system, but the data does not need to synchronize between the two systems.
Based on these requirements, which method should a developer use to create the records in
Salesforce?

  • A. REST API request using composite/vbatch/
  • B. REST API request using composite/tree/
  • C. Apex web services
  • D. Bulk API 2.0
Answer:

D

User Votes:
A
50%
B
50%
C
50%
D
50%

Discussions
vote your answer:
A
B
C
D
0 / 1000
To page 2