Salesforce pdi practice test

Exam Title: Salesforce Certified Platform Developer

Last update: Dec 25 ,2025
Question 1

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

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 2

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,
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.

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 3

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

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 4

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

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 5

(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 */ } }
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.

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 6

A developer is creating a Lightning web component to show a list of sales records.
The Sales Representative user should be able to see the commission field on each record. The Sales
Assistant user should be able to see all fields on the record except the commission field.
How should this be enforced so that the component works for both users without showing any
errors?

  • A. Use WITH SECURITY_ENFORCED In the SOQL that fetches the data for the component,
  • B. Use Security.stripInaccessible Le to remove fields inaccessible to the current user.
  • C. Use Lightning Locker Service to enforce sharing rules and field-level security.
  • D. Use Lightning Data Service to get the collection of sales records.
Answer:

B


Explanation:
UsingSecurity.stripInaccessibleensures compliance with field-level security (FLS) and prevents users
from accessing fields they do not have permission to view. In this scenario:
The commission field is inaccessible to Sales Assistants, andSecurity.stripInaccessiblewill
automatically remove this field from the result set.
It prevents runtime errors when a user without proper access attempts to retrieve restricted fields.
Reference:Apex Developer Guide: Security.stripInaccessible

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 7

The following code snippet is executed by a Lightning web component in an environment with more
than 2,000 lead records:

Which governor limit will likely be exceeded within the Apex transaction?

  • A. Total number of SOOL quires issued
  • B. Total number of DML statements issued
  • C. Total number of records processed as a result of DML statements
Answer:

C


Explanation:
The provided code attempts to update allLeadrecords in an environment with more than 2,000
records. This will likely exceed the governor limit for the total number of records processed in DML
statements, which is 10,000 per transaction. To avoid this, the developer can
useDatabase.updatewith batching logic.
Reference:Governor Limits for DML Rows

vote your answer:
A
B
C
A 0 B 0 C 0
Comments
Question 8

A developer is asked to write helper methods that create test data for unit tests.

What should be changed in the TestUtils class so that its methods are only usable by unit test
methods?

  • A. @isTest above line 03.
  • B. Add @istest above line 01.
  • C. Change public to private on line 01.
  • D. Remove static from line 03.
Answer:

B


Explanation:
To ensure that the TestUtils class and its methods are only accessible by unit test methods, the class
must be annotated with the @isTest annotation. This annotation limits the scope of the class and its
methods to test contexts only.
Why @isTest?
Purpose of @isTest:
The @isTest annotation marks a class or method for use exclusively within test scenarios. It prevents
the methods from being accidentally invoked in production code.
This ensures better test isolation and prevents misuse.
Static Test Data Methods:
Marking helper methods for test data creation as @isTest ensures they do not interfere with
production code and are strictly for testing purposes.
Analysis of Options:
Option A: @isTest above line 03:
Incorrect. Applying @isTest only to the createAccount method would work, but the other methods in
the class would still be accessible. This does not satisfy the requirement of restricting the entire class.
Option B: Add @isTest above line 01:
Correct. Annotating the class ensures all methods within the class are accessible only in the context
of tests.
Option C: Change public to private on line 01:
Incorrect. Changing the class to private would cause a compilation error, as top-level classes in
Salesforce cannot be declared private.
Option D: Remove static from line 03:
Incorrect. Removing static does not affect the test scope of the class or its methods. Static methods
can still be invoked, and this does not restrict access to test contexts.
Correct Implementation:
The corrected code would look like this:
@isTest
public class TestUtils {
public static Account createAccount() {
Account acct = new Account();
// Set some fields on acct
return acct;
}
// Other methods...
}
Reference:
Apex Testing: Test Classes and Methods
Trailhead Module on Apex Testing

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 9

(Full question statement)
Universal Containers recently transitioned fromClassic to Lightning Experience. One of its business
processes requirescertain values from the Opportunity objectto be sent via anHTTP REST calloutto
itsexternal order management systemwhen the user presses a custom button on the Opportunity
detail page.
Example fields:
Name
Amount
Account
Which two methods should the developer implement to fulfill the business requirement?
Choose 2 answers.

  • A. Create a customVisualforce quick actionthat performs the HTTP REST callout and use it on the Opportunity detail page.
  • B. Create anafter update triggeron the Opportunity object that calls a helper method using @future(callout=true) to perform the HTTP REST callout.
  • C. Create aLightning component quick actionthat performs the HTTP REST callout and use it on the Opportunity detail page.
  • D. Create aRemote Actionon the Opportunity object that executes an Apex immediate action to perform the HTTP REST callout whenever the Opportunity is updated.
Answer:

A,C


Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
A (Correct):AVisualforce quick actioncan include Apex logic for a callout, and Visualforce is still valid
in Lightning Experience.
C (Correct):ALightning Web Component (or Aura component)exposed as aquick actioncan perform
callouts via Apex when the user clicks a button. This supports a more modern UI experience.
Incorrect options:
B:@future(callout=true) works but cannot be triggeredsynchronously by a button press. It’s for
background/automated processes.
D:Remote Actionis legacy functionality used with Visualforce/Aura and doesn't suit modern Lightning
and button-driven synchronous actions.
Reference:Salesforce Developer Guide – Callouts from ApexSalesforce Lightning Developer Guide –
Quick Actions
This is part ofUser Interface (25%)andProcess Automation and Logic (30%), involvingintegration
techniques and callouts.

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 10

A developer has an integer variable called maxAttempts. The developer needs to ensure that once
maxAttempts is initialized, it preserves its value for the length of the Apex transaction; while being
able to share the variable's state between trigger executions.
How should the developer declare maxAttempts to meet these requirements?

  • A. Declare maxattempts as a constant using the static and final keywords.
  • B. Declare maxattempts as a member variable on the trigger definition.
  • C. Declare maxattempts as a variable on a helper class.
  • D. Declare maxAttempts as a private static variable on a helper class.
Answer:

D


Explanation:
To preserve the value ofmaxAttemptsfor the length of the Apex transaction and share its state
between trigger executions:
Static Variable:
Static variables are initialized once per transaction and retain their value throughout the transaction.
They can be accessed without instantiating the class.
Private Scope:
Declaring it as private ensures encapsulation and prevents unintended external modification.
Helper Class:
Using a helper class ensures the separation of concerns, keeping trigger logic clean and adhering to
best practices.
Example Code:public class HelperClass {
private static Integer maxAttempts = 5; // Default value
public static Integer getMaxAttempts() {
return maxAttempts;
}
public static void setMaxAttempts(Integer attempts) {
maxAttempts = attempts;
}
}
A:Constants (static + final) cannot be modified after initialization.
B:Trigger member variables cannot retain values across executions within the same transaction.
C:Declaring it as a non-static variable in a helper class would reset its value during each trigger
execution.
Why Not the Other Options?

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Page 1 out of 20
Viewing questions 1-10 out of 201
Go To
page 2