PDI Practice Test Questions

Total 237 Questions


Last Updated On : 2-Jun-2025



Preparing with PDI practice test is essential to ensure success on the exam. This Salesforce SP25 test allows you to familiarize yourself with the PDI exam questions format and identify your strengths and weaknesses. By practicing thoroughly, you can maximize your chances of passing the Salesforce certification spring 2025 release exam on your first attempt.

Surveys from different platforms and user-reported pass rates suggest PDI practice exam users are ~30-40% more likely to pass.

Consider the following code snippet for a Visualforce page that is launched using a Custom Button on the Account detail page layout.


When the Save button is pressed the developer must perform a complex validation that involves multiple objects and, upon success, redirect the user to another Visualforce page. What can the developer use to meet this business requirement?



A. Custom controller


B. Controller extension


C. Validation rule


D. Apex trigger





B.
  Controller extension

Explanation:

The Visualforce page is using a standard controller for the Account object:


However, you need to:

Perform complex validation logic involving multiple objects
Redirect the user to a different Visualforce page upon success
A controller extension is the correct approach because it allows you to:

Extend the standard controller
Add custom Apex logic
Still leverage the standard controller’s built-in actions (like save()), while overriding or supplementing them

✔️ Why Controller Extension is best:

Access to the standard controller’s context (Account record)
Ability to add custom logic before or after the save()
Supports redirecting to other pages via Page Reference

Why the other options are incorrect:

A. Custom controller
❌ Would replace the standard controller entirely
You'd need to re-implement all standard logic, including save() — more work than needed

C. Validation rule
❌ Limited to single-object field validation
Can’t handle multi-object logic or perform redirects

D. Apex trigger
❌ Triggers are backend-only logic
Cannot redirect or provide user-facing feedback
Not intended for complex UI control or flow logic

Which annotation exposes an Apex class as a RESTful web service?



A.


B.


C.


D.





C.
  

Explanation:

The @RestResource annotation is used to expose an Apex class as a RESTful web service in Salesforce.
It allows you to define a custom REST endpoint
You can handle HTTP methods like GET, POST, PUT, and DELETE
You specify the URL path using urlMapping

🔍 Example:

@RestResource(urlMapping='/myService/*')
global with sharing class MyRestService {
@HttpGet
global static String doGet() {
return 'Hello from REST!';
}
}

Why the other options are incorrect:

A. @AuraEnabled(cacheable=true)
❌ Used to expose methods to Lightning components (LWC, Aura), not RESTful services

B. @RemoteAction
❌ Used to expose Apex methods to Visualforce + JavaScript remoting, not REST

D. @HttpInvocable
❌ Not a valid Apex annotation (possibly confused with @InvocableMethod, which is used for Flows)

Which Apex class contains methods to return the amount of resources that have been used for a particular governor, such as the number of DML statements?



A. Exception


B. Messaging


C. OrgLimits


D. Limits





D.
  Limits

Explanation:

The Limits Apex class provides methods to monitor and retrieve the governor limits that apply to the current execution context in Salesforce.
It helps developers write efficient code by allowing them to check how many resources (like DML statements, SOQL queries, etc.) have been used or are remaining.

🔍 Example methods from Limits class:

Limits.getDmlStatements() → Returns the number of DML statements used so far.
Limits.getLimitDmlStatements() → Returns the maximum allowed DML statements (usually 150).
Limits.getQueries() → Number of SOQL queries used.
Limits.getLimitQueries() → SOQL query limit.

Incorrect Options:

A. Exception
Used for handling runtime errors, not governor limits.

B. Messaging
Used for email services, like sending emails, not monitoring system limits.

C. OrgLimits
Deals with org-wide limits (e.g., total API calls per org), not per-transaction governor limits.

A development team wants to use a deployment script lo automatically deploy lo a sandbox during their development cycles. Which two tools can they use to run a script that deploys to a sandbox? Choose 2 answers



A. VS Code


B. SFDX CLI


C. Change Sets


D. Developer Console





A.
  VS Code

B.
  SFDX CLI

Explanation:

To automatically deploy code to a sandbox using a script, the development team needs tools that support automation and scripting. The correct tools are:

✔️ A. VS Code (Visual Studio Code)

✅ Used with the Salesforce Extension Pack
Allows running SFDX CLI commands directly from the terminal
Supports automated development workflows when combined with scripts

✔️ B. SFDX CLI (Salesforce CLI)

✅ The core tool for automated deployments in Salesforce
Enables scripting of deployments with commands like:

sfdx force:source:deploy -u SandboxAlias

Works seamlessly in CI/CD pipelines

Incorrect Answers:

C. Change Sets
❌ Manual deployment tool
Not scriptable or automatable
Requires point-and-click actions in the UI

D. Developer Console
❌ Used for manual development and debugging
Cannot deploy code or run deployment scripts

Which two are phases in the Aura application event propagation framework? Choose 2 answers



A. Emit


B. Control


C. Default


D. Bubble





C.
  Default

D.
  Bubble

Explanation:

In the Aura component framework, when an application event is fired, it goes through two main phases in the event propagation lifecycle:

✔️ C. Default Phase
This is the first phase.
Components that register for the event using handler="APPLICATION" can handle the event.
This phase is where default handlers respond to the event.

✔️ D. Bubble Phase
This is the second phase.
The event bubbles up the component hierarchy.
Components can handle or stop propagation during this phase.

Incorrect Options:

A. Emit
❌ Not a valid phase in Aura’s event framework.
"Emit" is terminology often used in JavaScript event systems, not Aura.

B. Control
❌ Control phase is specific to component events, not application events.
Application events only go through Default and Bubble phases.

What writing an Apex class, a developer warts to make sure thai all functionality being developed Is handled as specified by the requirements. Which approach should the developer use to be sure that the Apex class is working according tospecification?



A. Create a test class to execute the business logic and run the test in the Developer Console.


B. Include a savepoint and Database,rollback.


C. Include a try/catch block to the Apex class.


D. Run the code in an Execute Anonymous block n the Deceloper Consider.





A.
  Create a test class to execute the business logic and run the test in the Developer Console.

Explanation:

To ensure that an Apex class works according to the requirements, the best and most reliable approach is to:

✅ Write a test class that includes unit tests for each piece of functionality.

This approach allows the developer to:

Automatically verify that the code behaves as expected
Catch any regressions or logic errors
Achieve code coverage requirements for deployment
Simulate different input and edge cases using System.assert() statements

Why the other options are not sufficient:

B. Include a savepoint and Database.rollback
❌ Useful for managing data changes during testing, but does not validate business logic on its own.

C. Include a try/catch block to the Apex class
❌ Helps with error handling, but does not confirm correctness or validate logic per requirements.

D. Run the code in an Execute Anonymous block in the Developer Console
❌ Useful for manual testing, but:
Not repeatable or automated
Not a good long-term validation strategy
Does not support System.assert() validation

A Salesforce Administrator used Flow Builder to create a flow named ‘’accountOnboarding’’. The flow must be used inside an Aura component. Which tag should a developer use to display the flow in the component?



A. Lightning-flow


B. Aura:flow


C. Lightning:flow


D. Aura:flow





C.
  Lightning:flow

Explanation:

To embed a Flow (like accountOnboarding) in an Aura component, the correct tag to use is:


This component is part of the Lightning Base Components and is specifically designed to embed Flow Builder flows in Aura components.

🔍 Example Usage in Aura:

< aura : component > < br > < lightning : flow aura : id = "flow " > < / lightning : flow >


You can then start the flow using JavaScript in the controller:

var flow = component.find("flow");
flow.startFlow("accountOnboarding");

❌ Incorrect Options:

A. lightning-flow
❌ Incorrect syntax — this is used in LWC, not Aura.

B/D. aura:flow / Aura:flow
❌ These are invalid component names — no such tag exists.

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 override void makePayment(Decimal amount) { /*implementation*/ }


B. Public class CreditCardPayment implements Payment { public virtual void makePayment(Decimal amount) { /*implementation*/ }


C. Public class CreditCardPayment extends Payment { public virtual void makePayment(Decimal amount) { /*implementation*/ } }


D. Public class CreditCardPayment implements Payment { public override void makePayment(Decimal amount) { /*Implementation*/ } }





A.
  Public class CreditcardPayment extends Payment { public override void makePayment(Decimal amount) { /*implementation*/ }

Explanation:

Given the base class:

public virtual class Payment {
public virtual void makePayment(Decimal amount) {
// implementation
}
}

The class Payment is a virtual class, which means it can be extended.
The method makePayment is also marked as virtual, meaning it can be overridden in a subclass.
To override a method, use the **override** keyword in the subclass.

🔍 Why Option A is correct:
CreditcardPayment extends Payment → ✅ Correct way to inherit a class.
public override void makePayment(...) → ✅ Correct way to override a virtual method.

❌ Why other options are incorrect:

B. implements Payment
❌ Invalid: Payment is a class, not an interface — you can't use implements with a class.
C. public virtual void makePayment(...) in subclass
❌ Invalid: You must use override, not virtual, when overriding a method.

D. implements Payment with override
❌ Invalid: Again, implements is only for interfaces, not classes.

Ursa Major Solar has a custom object, serviceJob-o, with an optional Lookup field to Account called partner-service-Provider_c. The TotalJobs-o field on Account tracks the total number of serviceJob-o records to which a partner service provider Account is related. What is the most efficient way to ensure that the Total job_o field kept up to data?



A. Change TotalJob_o to a roll-up summary field.


B. Create a record-triggered flow on ServiceJob_o.


C. Create an Apex trigger on ServiceJob_o.


D. Create a schedule-triggered flow on ServiceJob_o.





B.
  Create a record-triggered flow on ServiceJob_o.

Explanation:

Ursa Major Solar needs to keep the TotalJobs__c field on Account up to date with the number of ServiceJob__c records related via an optional Lookup field (Partner_Service_Provider__c).
Because this is an optional lookup, not a master-detail relationship, you cannot use a roll-up summary field. Instead, you need to calculate and update the total using automation.

✔️ Why B. Record-Triggered Flow is the best option:

✅ Declarative, no code required
✅ Supports logic based on lookup relationships
✅ Can handle create, update, and delete events
✅ Easily maintainable and more efficient than Apex for simple logic
✅ Most efficient non-code approach that satisfies the requirement

Why other options are not ideal:

A. Change TotalJob__c to a roll-up summary field
❌ Not possible: roll-up summary fields only work with master-detail relationships, and Partner_Service_Provider__c is a lookup.

C. Create an Apex trigger on ServiceJob__c
❌ Functional, but unnecessary unless the logic is complex.
More maintenance-heavy and requires unit tests.

D. Create a schedule-triggered flow on ServiceJob__c
❌ Not efficient for real-time updates.
Delays data consistency and is resource-intensive.

Assuming that naze is 8 String obtained by an tag on 8 Visualforce page, which two SOQL queries performed are safe from SOQL injection? Choose 2 answers



A. Option A


B. Option B


C. Option C


D. Option D





C.
  Option C

D.
  Option D

Explanation:

Option C: String.escapeSingleQuotes()

String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + String.escapeSingleQuotes(name) + '%\'';
List results = Database.query(query);

Why Safe?

String.escapeSingleQuotes() sanitizes the input by escaping single quotes (' → \').
Prevents attackers from breaking the query with malicious input (e.g., name = "test' OR Name != ''").

Option D: Bind Variable

String query = '%' + name + '%';
List results = [SELECT Id FROM Account WHERE Name LIKE :query];

Why Safe?
Bind variables (:query) are automatically escaped by Salesforce.
No string concatenation = no injection risk.

Why Not the Others?

Option A: Unsafe Concatenation

String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + name + '%\'';

Risk: Direct concatenation allows SOQL injection (e.g., if name = "test' OR Name != ''").

Option B: noQuotes() (Invalid Method)
String query = 'SELECT Id FROM Account WHERE Name LIKE \'%' + name.noQuotes() + '%\'';

Risk: noQuotes() doesn’t exist in Apex. Even if it did, it wouldn’t escape quotes.

Page 5 out of 24 Pages
PDI Practice Test Home Previous