Salesforce pdi practice test

Salesforce Certified Platform Developer

Last exam update: Nov 27 ,2025
Page 1 out of 14. Viewing questions 1-15 out of 201

Question 1

A company's engineering department is conducting a month-long test on the scalability of an in-
house-developed software that requires a cluster of 100 or more servers. Which of the following
models is the best to use?

  • A. PaaS
  • B. SaaS
  • C. BaaS
  • D. laaS
Mark Question:
Answer:

D


Explanation:
Infrastructure as a Service (IaaS)is the best model for the scenario described because it provides on-
demand access to compute, storage, and networking resources that are ideal for a scalable server
cluster. IaaS allows the engineering team to rent infrastructure resources without having to invest in
physical hardware, making it perfect for temporary or fluctuating workloads, such as scalability
testing.
Key Characteristics of IaaS:
Full control over the operating systems and applications running on the servers.
Flexible resource allocation to support high scalability.
Ideal for custom software testing where specific server configurations may be needed.
Why not the other options?
PaaS (Platform as a Service):While PaaS is excellent for application development and deployment, it
abstracts the infrastructure layer, which would limit the engineering team's control over the cluster's
configuration.
SaaS (Software as a Service):SaaS delivers fully managed applications, not infrastructure or testing
environments. It’s irrelevant for this use case.
BaaS (Backend as a Service):BaaS is tailored to mobile or web application backend development,
providing APIs and pre-built services, not infrastructure for a server cluster.
Platform Developer Reference:
While this question is broader than Salesforce-specific concepts, understandingIaaS vs. PaaSis
relevant when working with Salesforce development. For example:
Salesforce operates as aPaaS(e.g., Force.com platform), allowing developers to build and deploy
applications without managing underlying servers.
Testing scalability and performance at an infrastructure level (as in the question) would fall
underIaaSconcepts, which Salesforce developers might encounter when integrating external services
or infrastructure like AWS, Azure, or Google Cloud.
This foundational knowledge complements your understanding of cloud services in the Salesforce
ecosystem.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 2

What are three characteristics of change set deployments?
Choose 3 answers Sending a change set between two orgs requires a deployment connection.

  • A. Change sets can deploy custom settings data.
  • B. Change sets can only be used between related organizations.
  • C. Deployment is done in a one-way, single transaction.
  • D. Sending a change set between two orgs requires a deployment connection.
  • E. Change sets can be used to transfer records.
Mark Question:
Answer:

B,C,D


Explanation:
Change sets can only be used between related organizations:
Change sets require a relationship between the source and target Salesforce orgs, such as a
production org and its sandboxes. You cannot use change sets between unrelated Salesforce orgs.
Reference:Salesforce Change Set Overview
Deployment is done in a one-way, single transaction:
When a change set is deployed, it is applied to the target org as a single transaction. If there are any
errors in the deployment, the entire transaction is rolled back.
Reference:Apex Development Guide
Sending a change set between two orgs requires a deployment connection:
Before sending or deploying a change set, a deployment connection must be established between
the source and target orgs. This connection is configured in the setup menu under "Deployment
Connections."
Reference:Trailhead: Deployment Connections
Incorrect Options:
A . Change sets can deploy custom settings data:
Change sets cannot deploy data, including custom settings data. They only move metadata.
E . Change sets can be used to transfer records:
Records (data) are not supported by change sets; they only facilitate metadata migration.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 3

Universal Containers wants to ensure that all new leads created in the system have a valid email
address. They have already created a validation rule to enforce this requirement, but want to add an
additional layer of validation using automation.
What would be the best solution for this requirement?

  • A. Submit a REST API Callout with a JSON payload and validate the fields on a third party system
  • B. Use a before-save Apex trigger on the Lead object to validate the email address and display an error message if it is invalid
  • C. Use a custom Lightning Web component to make a callout to validate the fields on a third party system.
  • D. Use an Approval Process to enforce the completion of a valid email address using an outbound message action.
Mark Question:
Answer:

B


Explanation:
Before-save Apex Trigger:
This is the best solution because abefore-save triggerruns before the record is saved to the database,
providing an opportunity to validate or modify the data.
In this case, the Apex trigger can validate the email address using a regular expression or a third-
party API call to ensure the email address is valid. If the email is invalid, an error message can be
displayed using addError().
Why not the other options?
A . Submit a REST API Callout with a JSON payload:
REST callouts are more complex and generally not recommended for simple validation tasks like
email format validation. Additionally, callouts cannot be performed directly in a before-save trigger.
C . Use a custom Lightning Web Component (LWC):
LWCs are primarily for UI interactions and should not be used to enforce data validations that are
server-side requirements.
D . Use an Approval Process:
Approval Processes are for managing the approval flow of records, not for real-time validations. They
cannot enforce email validation directly.
Reference:
Apex Triggers Documentation
Trigger Context Variables

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 4

Which statement should be used to allow some of the records in a list of records to be inserted if
others fail to be inserted?

  • A. Database. insert (records, true)
  • B. insert records
  • C. insert (records, false)
  • D. Database. insert (records, false)
Mark Question:
Answer:

D


Explanation:
Database.insert(records, false):
The Database.insert() method with the allOrNone parameter set to false allows for partial success.
If some records in the list fail due to validation rules, triggers, or other errors, the method will still
attempt to insert the remaining valid records.
The false parameter ensures that records that fail will not roll back the transaction for the others.
Why not the other options?
A . Database.insert(records, true):
The true parameter makes the operation transactional (all or none). If any record fails, all records will
roll back.
B . insert records:
The insert DML statement behaves like Database.insert(records, true) by default and rolls back all
records if any error occurs.
C . insert(records, false):
This syntax is invalid in Apex.
Reference:
Apex DML Operations Documentation
Database Methods

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 5

A developer identifies the following triggers on the Expense _c object:

The triggers process before delete, before insert, and before update events respectively.
Which two techniques should the developer implement to ensure trigger best practices are
followed?
Choose 2 answers

  • A. Unity all three triggers In a single trigger on the Expense__c object that Includes all events.
  • B. Unify the before insert and before update triggers and use Flow for the delete action.
  • C. Create helper classes to execute the appropriate logic when a record is saved.
  • D. Maintain all three triggers on the Expense __c object, but move the Apex logic out of the trigger definition.
Mark Question:
Answer:

A,C


Explanation:
A . Unify all three triggers in a single trigger on the Expense__c object that includes all events:
Salesforce best practices recommend having only one trigger per object to avoid redundancy and
conflicts.
By combining all the events (before delete, before insert, and before update) into a single trigger, the
developer can manage the logic in an organized and maintainable manner.
This also simplifies debugging and ensures that the trigger logic executes in a predictable order.
C . Create helper classes to execute the appropriate logic when a record is saved:
Using helper classes allows for a clean separation of concerns. The trigger becomes a dispatcher that
delegates logic to dedicated classes.
For example, you can create methods like applyDefaultsToExpense(), validateExpenseUpdate(), and
deleteExpense() in a helper class and invoke them from the trigger.
This improves reusability, readability, and testability of the code.
Why not the other options?
B . Unify the before insert and before update triggers and use Flow for the delete action:
While Flow is a powerful tool, it is not ideal for deleting records or replacing Apex trigger
functionality, especially when triggers already exist for other events.
D . Maintain all three triggers on the Expense__c object but move the Apex logic out of the trigger
definition:
Maintaining multiple triggers on the same object can lead to conflicts and execution order issues,
even if the logic is moved to helper classes.
Reference:
Trigger Best Practices
Trigger Design Patterns

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 6

(Full question statement)
Which statement generates a list ofLeadsandContactsthat have a field containing the phrase
"ACME"?

  • A. List<SObject> searchList = [FIND '*ACME*' IN FIELDS RETURNING Contact, Lead];
  • B. List<List<SObject>> searchList = [SELECT Name, Id FROM Contact, Lead WHERE Name LIKE '%ACME%'];
  • C. List<List<SObject>> searchList = [FIND '*ACME*' IN ALL FIELDS RETURNING Contact, Lead];
  • D. List<SObject> searchList = [find 'acme' in all fields returning Contact, Lead];
Mark Question:
Answer:

C


Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
C (Correct):This is the correctSOSL (Salesforce Object Search Language)syntax. It performs a full-text
search across multiple objects and fields.
The format FIND '*ACME*' IN ALL FIELDS RETURNING Contact, Lead is thestandard and
correctapproach for cross-object keyword searches.
Incorrect options:
A:Incorrect syntax; needs ALL FIELDS or NAME FIELDS, and proper result typing.
B:SOQL does not support searching across multiple objects in a single query.
D:Incorrect casing and structure; missing proper list handling.
Reference:Apex Developer Guide – SOSL Syntax
This relates toDeveloper Fundamentals (23%), specificallySOSL vs. SOQL use cases and syntax.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 7

A developer creates a Lightning web component that imports a method within an Apex class. When a
Validate button is pressed, the method runs to execute complex validations.
In this implementation scenario, which two options are.. of the Controller according to the MVC
architecture?
Choose 2 answers

  • A. HTML file
  • B. Apex class
  • C. JavaScript file
  • D. XML file
Mark Question:
Answer:

B,C


Explanation:
In the context of the MVC (Model-View-Controller) architecture for a Lightning Web Component
(LWC), the Apex class and JavaScript file are responsible for handling the controller's role:
Apex Class (Controller):
Acts as the server-side controller.
Executes business logic, such as the complex validations mentioned in the scenario.
Exposes methods for the LWC to call using@AuraEnabled.
Reference:https://developer.salesforce.com/docs/component-
library/documentation/en/lwc/lwc.apex
JavaScript File (Controller):
Acts as the client-side controller.
Manages the interaction between the HTML (View) and Apex methods.
Executes functions triggered by user actions, such as clicking the "Validate" button.
Reference:https://developer.salesforce.com/docs/component-
library/documentation/en/lwc/lwc.js_props_methods
Why Not the Other Options?A. HTML file: Represents the "View" in MVC, focusing on UI rendering.
D . XML file: Used for metadata configuration and is not part of the controller functionality.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 8

What are two use cases for executing Anonymous Apex code?
Choose 2 answers

  • A. schedule an Apex class to run periodically
  • B. To delete 15,000 inactive Accounts in a single transaction after a deployment
  • C. To run a batch Apex class to update all Contacts
  • D. To add unit test code coverage to an org
Mark Question:
Answer:

B,C


Explanation:
Anonymous Apex allows developers to execute ad hoc code snippets without creating a permanent
class or trigger. It is useful for tasks like bulk data manipulation or testing.
B . Deleting 15,000 inactive Accounts:
Anonymous Apex can perform ad hoc bulk operations to clean up data after a deployment.
Example:
Use Cases:List<Account> inactiveAccounts = [SELECT Id FROM Account WHERE IsActive__c = false
LIMIT 15000];
delete inactiveAccounts;
C . Running a batch Apex class:
Anonymous Apex can execute batch jobs for data processing.
Example:
apex
Copy code
Database.executeBatch(new UpdateContactBatch());
A . Schedule an Apex class to run periodically: This requires a scheduled job, not Anonymous Apex.
D . Add unit test code coverage: Unit tests must be written in test classes and cannot be added using
Anonymous Apex.
Reference:Anonymous Apex:https://developer.salesforce.com/docs/atlas.en-
us.apexcode.meta/apexcode/apex_execute_anonymous.htm

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 9

A developer created a Lightning web component called statuscomponent to be Inserted into the
Account record page.
Which two things should the developer do to make this component available?
Choose 2 answers

  • A. Add <targer>lightning_Recordpage</target> to the statuscomponent. js file,
  • B. Add <target>lightning RecordPage</target> to the statusComp .js-meta.xml file.
  • C. Set is Exposes to true In the statuscomponent.js-meta.xml file.
  • D. Add <mastertabel>Account </masterLabel> to the statusComponent. js-meta.xm1 file.
Mark Question:
Answer:

B,C


Explanation:
To make an LWC available for use on a record page:
Target Configuration:
Add<target>lightning__RecordPage</target>in the component's.js-meta.xmlfile to specify where the
component can be used.
Expose the Component:
SetisExposedtotruein the.js-meta.xmlfile to make the component available for use.
Example.js-meta.xmlFile:<?xml version="1.0"encoding="UTF-8"?>
<LightningComponentBundlexmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>57.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>
A: Incorrect placement. The<target>tag must be in the.js-meta.xmlfile, not the JavaScript file.
D: The<masterLabel>tag is used for metadata labeling, not for exposing or targeting a component.
Reference:LWC Metadata Configuration:https://developer.salesforce.com/docs/component-
library/documentation/en/lwc/lwc.create_metadata_config_file

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 10

A developer creates a batch Apex job to update a large number of records, and receives reports of
the job timing out and not completing.
What is the first step towards troubleshooting the issue?

  • A. Check the asynchronous job monitoring page to view the job status and logs.
  • B. Check the debug logs for the batch job.
  • C. Disable the batch job and recreate it with a smaller number of records.
  • D. Decrease the batch size to reduce the load on the system.
Mark Question:
Answer:

A


Explanation:
When troubleshooting batch Apex jobs:
Asynchronous Job Monitoring:
Navigate toSetup > Apex Jobsto view the status of the batch job.
Provides information such as success, errors, and total execution time.
This step is crucial to diagnose whether the issue is with system limits, batch size, or specific records.
Debug Logs:
After identifying the issue in the job monitoring page, use debug logs to pinpoint specific errors or
bottlenecks.
B . Check the debug logs for the batch job: Debug logs are a secondary step after checking the job
status.
C . Disable and recreate with fewer records: Premature without investigating the root cause.
D . Decrease the batch size: Adjusting batch size is a solution but only after identifying the cause of
the timeout.
Reference:Asynchronous Job
Monitoring:https://help.salesforce.com/s/articleView?id=000331217&type=1
Debugging Apex:https://developer.salesforce.com/docs/atlas.en-
us.apexcode.meta/apexcode/apex_debugging.htm

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 11

What are two benefits of using declarative customizations over code?
Choose 2 answer

  • A. Declarative customizations automatically update with each Salesforce release.
  • B. Declarative customizations automatically generate test classes.
  • C. Declarative customizations cannot generate run time errors
  • D. Declarative customizations generally require less maintenance
Mark Question:
Answer:

A,D


Explanation:
Declarative customizations, such as workflows, process builder, validation rules, and flows, offer a
no-code approach to customizing Salesforce. Below are the key benefits:
Declarative customizations automatically update with each Salesforce release (A):Salesforce ensures
that declarative tools are automatically updated during new releases, eliminating the need for
manual intervention or code refactoring.
Reference:Salesforce Release Updates
Declarative customizations generally require less maintenance (D):Because declarative tools use
configurations rather than custom code, they are simpler tomanage, troubleshoot, and update. This
significantly reduces the maintenance overhead compared to custom code.
Reference:Trailhead: Build Declarative Applications
Incorrect Options:
B:Declarative tools do not automatically generate test classes. This is specific to Apex code.
C:Declarative customizations can still result in runtime errors, such as invalid field updates or logic
conflicts.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 12

Given the following Anonymous block:

What should a developer consider for an environment that has over 10,000 Case records?

What should a developer consider for an environment that has over 10,000 Case records?

  • A. The transaction will succeed and changes will be committed.
  • B. The try-catch block will handle exceptions thrown by governor limits.
  • C. The transaction will fail due to exceeding the governor limit.
  • D. The try-catch block will handle any DML exceptions thrown,
Mark Question:
Answer:

C


Explanation:
The code provided processes allCaserecords in a single transaction. Since it attempts to process over
10,000 records, it exceeds the Salesforce governor limit of 50,000 DML rows per transaction, causing
the transaction to fail.
Governor Limits on DML Rows (C):Salesforce enforces a governor limit of 50,000 rows for DML
operations per transaction. In this case, if theSELECTquery retrieves over 50,000 records,
theDatabase.updatecall will hit this limit and throw aSystem.LimitException.
Reference:Apex Governor Limits
Why the Try-Catch Block Fails to Handle Limits (B & D):Governor limit exceptions
(System.LimitException) cannot be caught by try-catch blocks. Therefore, the exception cannot be
handled, and the transaction will fail.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 13

A developer is tasked with building a custom Lightning web component to collect Contact
information.
The form will be shared among many different types of users in the org. There are security
requirements that only certain fields should be edited and viewed by certain groups of users.
What should the developer use in their Lightning Web Component to support the security
requirements?

  • A. aura-input-failed
  • B. force-input-failed
  • C. ui-input-failed
  • D. lightning-input-failed
Mark Question:
Answer:

D


Explanation:
When building a Lightning Web Component (LWC) to collect and manage data, developers must
ensure compliance with Salesforce's security model, including field-level security (FLS) and object-
level security (OLS). To meet the requirement of respecting security controls,lightning-input-fieldis
the correct choice.
Why lightning-input-field?
Field-Level Security (FLS):lightning-input-field respects the user’s field-level security settings. This
means users can only view or edit fields that they have permissions for, ensuring compliance with
the organization’s security model.
Object-Level Security (OLS):It respects object-level security, ensuring users cannot access objects
they are restricted from accessing.
Simplified Development:It is part of the Lightning Data Service (LDS), which eliminates the need to
write custom Apex or SOQL queries for CRUD operations, reducing the potential for security gaps.
Dynamic Rendering:Since the component dynamically renders fields based on the user’s
permissions, developers can share the component across various user groups without additional
customization.
Declarative Syntax:lightning-input-field simplifies form creation in LWC by using declarative syntax to
bind to record fields directly.
Example Code Implementation:
<template>
<lightning-record-edit-form
object-api-name="Contact"
record-id={contactId}>
<lightning-messages></lightning-messages>
<lightning-input-field field-name="FirstName"></lightning-input-field>
<lightning-input-field field-name="LastName"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<lightning-button class="slds-m-top_small" variant="brand" type="submit" name="update"
label="Save"></lightning-button>
</lightning-record-edit-form>
</template>
Reference:
LWC Documentation for lightning-input-field
Field-Level Security and Object-Level Security
Best Practices for Lightning Data Service
By using lightning-input-field, the developer ensures adherence to Salesforce's security standards
while providing a reusable and secure solution for capturing and displaying Contact information.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000

Question 14

Which three Salesforce resources can be accessed from a Lightning web component?
Choose 3 answers

  • A. Static resources
  • B. All external libraries
  • C. SVG resources
  • D. Third-party web components
  • E. Content asset files
Mark Question:
Answer:

A,C,E


Explanation:
Lightning Web Components (LWCs) have access to a variety of resources in Salesforce. Below are the
supported resources:
Static Resources (A):You can use static resources to reference JavaScript libraries, images, and other
files needed in an LWC.
Reference:Static Resources in LWC
SVG Resources (C):LWCs can use custom SVG files for icons or other visual elements.
Reference:SVG Resources in LWC
Content Asset Files (E):Content asset files, like images or videos, stored in Salesforce can be accessed
and used in LWC.
Reference:Using Content Assets in LWC
Incorrect Options:
B . All external libraries:Only libraries uploaded as static resources are supported, not directly
external libraries.
D . Third-party web components:While supported, additional configuration is needed to use them
effectively.

User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
vote your answer:
A
B
C
D
E
0 / 1000

Question 15

(Full question statement)
A developer must create a CreditCardPayment class that provides an implementation of an existing
Payment class.
public virtual class Payment {
public virtual void makePayment(Decimal amount) {
// implementation
}
}
Which is the correct implementation?

  • A. public class CreditCardPayment extends Payment { public virtual void makePayment(Decimal amount) { /* implementation */ } }
  • B. public class CreditCardPayment implements Payment { public virtual void makePayment(Decimal amount) { /* implementation */ } }
  • C. public class CreditCardPayment implements Payment { public override void makePayment(Decimal amount) { /* implementation */ } }
  • D. public class CreditCardPayment extends Payment { public override void makePayment(Decimal amount) { /* implementation */ } }
Mark Question:
Answer:

D


Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
D (Correct):Since Payment is avirtual class, it can beextended(not implemented like an interface),
and its makePayment method is also virtual, which allows it to be overridden using the override
keyword.
The use of override is required to redefine a virtual or abstract method from the parent class.
Reference:Apex Developer Guide – Inheritance and Polymorphism
This maps to"Developer Fundamentals"in the PD1 exam, specifically aroundobject-oriented
programming principles.

User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
vote your answer:
A
B
C
D
0 / 1000
To page 2