Free Salesforce PDI Exam Actual Questions

The questions for PDI were last updated On Dec 18, 2024

Question No. 1

The Account object in an organization has a master-detail relationship to a child object called Branch. The following automations exist:

Roll-up summary fields

Custom validation rules

Duplicate rules

developer created a trigger on the Account object.

Which two things should the developer consider while testing the trigger code?

Choose 2 answers

Show Answer Hide Answer
Correct Answer: A, D

Option A: Roll-up summary fields can cause the parent record to go through Save.

True.

When a child record changes, roll-up summary fields on the parent object are recalculated.

This causes the parent record to save, which can trigger triggers on the parent object.


Option D: The trigger may fire multiple times during a transaction.

True.

Triggers can fire multiple times due to workflow updates, process builders, or roll-up summary field recalculations.

Developers should design triggers to handle potential recursion and multiple executions.

Option B: The validation rules will cause the trigger to fire again.

False.

Validation rules execute after triggers and do not cause triggers to fire again.

They validate the data before the final commit but do not initiate additional trigger executions.

Option C: Duplicate rules are executed once all DML operations commit to the database.

False.

Duplicate rules are evaluated after triggers but before the DML operations are committed.

They can prevent records from being saved but do not affect trigger execution after commit.

Conclusion:

The developer should consider options A and D while testing the trigger code, as they can impact trigger execution during transactions.

Question No. 2

An Apex method, getAccounts, that returns a list of Accounts given a searchTerm, is available for Lightning Web Components to use.

What is the correct definition of a Lightning Web Component property that uses the getAccounts method?

A)

B)

C)

D)

Show Answer Hide Answer
Correct Answer: D

Question No. 3

What should a developer do to check the code coverage of a class after running all tests?

Show Answer Hide Answer
Correct Answer: B

To check the code coverage of a class after running all tests, a developer can use the Developer Console.

Option B: View the code coverage percentage for the class using the Overall Code Coverage panel in the Developer Console Tests tab.

Correct Method.

In the Developer Console, navigate to the Tests tab.

After running tests, the Overall Code Coverage panel displays code coverage statistics.

You can see the coverage percentage for individual classes.

There is no Class Test Percentage tab on the Apex Class list view in Salesforce Setup.

Code coverage is not displayed there.

Option C: View the Code Coverage column in the list view on the Apex Classes page.

Incorrect.

The Code Coverage column is not displayed by default in the Apex Classes list view.

Code coverage details are accessed via the Developer Console or Apex Test Execution.

Option D: Select and run the class on the Apex Test Execution page in the Developer Console.

Partially Correct but Not the Best Answer.

While you can run tests from the Apex Test Execution page, it doesn't directly show code coverage for individual classes.

The best place to view code coverage is the Overall Code Coverage panel.

Conclusion:

The developer should view the code coverage percentage in the Developer Console's Overall Code Coverage panel, which is Option B.


Checking Code Coverage in the Developer Console

Running and Monitoring Tests

Incorrect Options:

Option A: View the Class Test Percentage tab on the Apex Class list view in Salesforce Setup.

Incorrect.

Question No. 4

A developer created a trigger on the Account object. While testing the trigger, the developer sees the error message 'Maximum trigger depth exceeded'.

What could be the possible causes?

Show Answer Hide Answer
Correct Answer: C

The error message 'Maximum trigger depth exceeded' occurs when a trigger invokes itself recursively more than the allowed limit.

Option C: The trigger is getting executed multiple times.

Correct Answer.

This error indicates that the trigger is recursively calling itself.

This can happen if the trigger performs an update or insert operation that causes the same trigger to fire again, leading to an infinite loop.

Salesforce enforces a limit on the recursion depth to prevent stack overflows.

User permissions do not cause the 'Maximum trigger depth exceeded' error.

Option B: The trigger is too long and should be refactored into a helper class.

*Incorrect, but possible code improvement.

While refactoring code into helper classes is a good practice, it does not directly address the recursion issue causing the error.

Option D: The trigger does not have sufficient code coverage.

Incorrect.

Code coverage issues affect deployment but do not cause runtime errors like 'Maximum trigger depth exceeded'.

Conclusion:

The error is caused because the trigger is getting executed multiple times due to recursion, leading to exceeding the maximum trigger depth.


Triggers and Order of Execution

Preventing Recursive Triggers

Incorrect Options:

Option A: The developer does not have the correct user permission.

Incorrect.

Question No. 5

A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the initial URL.

Which three statements are useful inside the unit test to effectively test the custom controller? Choose 2 answers

A)

B)

C)

D)

E)

Show Answer Hide Answer
Correct Answer: A, B, D