Salesforce certification · Exam Salesforce-Platform-Developer

Salesforce-Platform-Developer Mock Exam

Salesforce Platform Developer - Plat-Dev-201

Free Salesforce-Platform-Developer questions on Process Automation and Logic, each with the answer and an explanation.

20 questions · 35 minutes · free, no sign-up

Process Automation and Logic questions

1–2 of 2 free
Question 1 Choose 1

When the code executes, a DML exception is thrown. How should a developer modify the code to ensure exceptions are handled gracefully?
Show answerHide answer

Correct answer: C Implement a try/catch block for the DML.

Explanation

Explanation:

In the code shown:

public static void insertAccounts(List theseAccounts){
for(Account thisAccount : theseAccounts){
if(thisAccount.website == null){
thisAccount.website = 'https://www.demo.com';
}
}
update theseAccounts;
}

The method always calls update theseAccounts.
If even one record in theseAccounts causes an error (for example, a validation rule, required field missing, or duplicate rule), the entire DML operation fails and throws a DmlException.
To handle such errors gracefully, a developer should wrap the DML statement in a try/catch block. This allows you to catch the exception, log it, and maybe handle records individually if needed.

Corrected Example with try/catch:
public static void insertAccounts(List theseAccounts){
for(Account thisAccount : theseAccounts){
if(thisAccount.website == null){
thisAccount.website = 'https://www.demo.com';
}
}
try {
update theseAccounts;
} catch (DmlException e) {
// Handle gracefully: log error or take corrective action
System.debug('Update failed: ' + e.getMessage());
}
}

Why not the other options?

A. Upsert → Wouldn’t solve the exception problem. Upsert only helps when you want to insert or update based on an external ID. Errors like validation failures would still throw exceptions.

B. Change Data Capture → This is for event-driven integration, not error handling.

D. Remove null items → That prevents null pointer issues but doesn’t stop DML exceptions (e.g., validation rules or required fields).

Reference:
Salesforce Apex Developer Guide – Exception Handling
Question 2 Choose 2
A developer created a trigger on the Account object and wants to test if the trigger is properly bulklfield. The developer team decided that the trigger should be tested with 200 account records with unique names. What two things should be done to create the test data within the unit test with the least amount of code? Choose 2 answers
Show answerHide answer

Correct answer: B, D Use Test.loadData to populate data in your test methods.Create a static resource containing test data.

Explanation

Explanation:

When testing a bulkified trigger, you need to generate or load a large set of test records (like 200 Accounts). The goal is to do this efficiently and maintainably, without writing repetitive code. Both Test.loadData and static resources help you achieve this.

🔹 B. Use Test.loadData

This method allows you to load test records from a static CSV file into your test method.
Reduces the amount of boilerplate Apex code needed.
Ideal for creating large volumes of test data, such as the 200 unique Account records required.

🔹 D. Create a static resource containing test data

A CSV file can be uploaded as a static resource, which Test.loadData can then consume.
Maintains clean and reusable test data that's easy to modify without touching code.
Encouraged for bulk testing across classes and teams.

❌ Why Not the Other Options?

A. @isTest(isParallel=true)

This annotation is used to run test classes in parallel, which helps improve test execution time.
It does not help generate test data, so it's unrelated to the question's goal.

C. @isTest(seeAllData=true)
Allows access to existing org data, but Salesforce discourages this in most test cases.
Not reliable for bulk testing and does not ensure unique names or proper isolation for test scenarios.

That's the last free question in Process Automation and Logic

You've seen the free 30% (2 of 7 questions). Full access unlocks every question and full-length Salesforce-Platform-Developer mock exams (60 questions, 105 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the Salesforce-Platform-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Salesforce-Platform-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Salesforce-Platform-Developer mock exam
  • 60questions per mock
  • 105 mintime limit
  • 184questions in the bank
  • Newmock on every attempt