PDI Practice Test Questions

237 Questions


Universal Containers has large number of custom applications that were built using a third- party javaScript framework and exposed using Visualforce pages. The Company wants to update these applications to apply styling that resembles the look and feel of Lightning Experience. What should the developer do to fulfill the business request in the quickest and most effective manner?


A. Incorporate the Salesforce Lightning Design System CSS stylesheet into the JavaScript applications.


B. Rewrite all Visualforce pages asLightning components.


C. Set the attribute enableLightning to true in the definition.


D. Enable Available for Lightning Experience, Lightning Communities, and the mobile app on Visualforce pages used by the custom application.





A.
  Incorporate the Salesforce Lightning Design System CSS stylesheet into the JavaScript applications.

Explanation:

Since Universal Containers already has custom JavaScript applications built on Visualforce, the quickest and most effective way to align them with Lightning Experience styling is to:

Use SLDS (Salesforce Lightning Design System):

SLDS provides ready-to-use CSS classes that match Lightning Experience’s look and feel.
Simply include the SLDS stylesheet in the Visualforce page:

< apex : page >
< ! -- -- Add SLDS stylesheet -- -- >
< apex : slds >< / apex : slds >
< !- - Your existing JavaScript / HTML content -->
< / apex : page >

Why Not the Other Options?

B: Rewriting as Lightning components – While ideal long-term, this is time-consuming and not the quickest solution.
C: enableLightning attribute – This is fictional; no such attribute exists for Visualforce.
D: Enabling "Available for Lightning Experience" – This merely makes Visualforce pages accessible in LEX but does not change their styling.

Which action causes a before trigger to fire by default for Accounts?


A. Renaming or replacing picklist


B. Importing data using the Data Loader and the Bulk API


C. Converting Leads to Contact accounts


D. Updating addresses using the Mass Address update tool





B.
  Importing data using the Data Loader and the Bulk API

Explanation:

Before triggers fire when records are inserted, updated, or deleted, before the changes are saved to the database. Here’s why B is correct:

Data Loader/Bulk API:

When importing or updating Account records (e.g., via CSV), before triggers execute for each record in the batch.

This is standard behavior for DML operations (insert/update/delete).

Why Not the Other Options?

A: Renaming/replacing picklist values – This is a metadata change, not a DML operation. Triggers fire on record changes, not schema updates.
C: Converting Leads – While this creates Accounts, the trigger fires on the Lead conversion process, not directly on Account DML.
D: Mass Address Update tool – This tool bypasses triggers by default (uses bulk API with opt-in trigger execution).

A develop completed modification to a customized feature that is comprised of two elements:

Apex trigger Trigger handler Apex class

What are two factors that the developer must take into account to properly deploy the modification to the production environment?


A. Apex classes must have at least 75% code coverage org-wide.


B. At least one line of code must be executed for the Apex trigger.


C. All methods in the test classes must use @isTest.


D. Test methods must be declared with the testMethod keyword.





A.
  Apex classes must have at least 75% code coverage org-wide.

B.
  At least one line of code must be executed for the Apex trigger.

Explanation:

To properly deploy Apex code (including triggers and Apex classes) to a Salesforce production environment, a developer must account for several key factors related to testing and code coverage.

Based on the options provided, here are the two crucial factors:

A. Apex classes must have at least 75% code coverage org-wide.
Salesforce requires that your overall Apex code coverage (including all classes and triggers) across the entire organization must be at least 75% to deploy to a production environment. This is a fundamental deployment requirement.

B. At least one line of code must be executed for the Apex trigger.
While the 75% overall coverage is necessary, for individual Apex triggers to be deployed, their associated test classes must execute at least one line of the trigger's code. This ensures that the trigger itself has been invoked and tested, even if its individual coverage doesn't reach 75% (as long as the overall org coverage does).

Let's look at why the other options are incorrect:

C. All methods in the test classes must use @isTest.
While test methods themselves should be marked as test methods (either by the class being annotated with @isTest and the method being public static void, or by the method itself being annotated with @isTest), not all methods within a test class necessarily need @isTest. Helper methods called by test methods, for example, do not need this annotation. The @isTest annotation is primarily used for the test class itself or individual test methods.

D. Test methods must be declared with the testMethod keyword.
The testMethod keyword is older, deprecated syntax. The current and recommended way to declare a test method is by using the @isTest annotation. While legacy code might still use testMethod, it's not a requirement for modern deployments and is considered outdated.

Therefore, the correct options are A and B.

How can a developer check the test coverage of active Process Builder and Flows deploying them in a Changing Set?


A. Use the Flow properties page.


B. Use the code Coverage Setup page


C. Use the Apex testresult class


D. Use SOQL and the Tooling API





D.
  Use SOQL and the Tooling API

Explanation:

When deploying Process Builder flows or Flows through a Change Set, Salesforce does not provide built-in UI tools to directly show their test coverage like it does for Apex classes. However, ensuring that flows are covered by Apex tests is still important — and can be done using the Tooling API and SOQL.

🔹 Why Option D is Correct:

The Tooling API provides access to metadata and test coverage data not available through the standard UI.
Developers can run SOQL queries (e.g., against FlowCoverage or ApexTestResult objects) to determine which flows have coverage.
This method gives granular and programmatic access to validate that a flow is being tested by Apex code.
It is the only reliable method to track coverage of flows during deployments.

Why the Other Options Are Incorrect:

A. Use the Flow properties page:
This page does not show test coverage information. It’s mainly used for versioning and metadata.

B. Use the Code Coverage Setup page:
This page shows Apex class coverage, not flow or process builder coverage.

C. Use the Apex TestResult class:
This class provides information about Apex test execution but not specifically about Flow coverage.

A developer is asked to prevent anyone other than a user with Sales Manager profile from changing the Opportunity Status to Closed Lost if the lost reason is blank. Which automation allows the developer to satisfy this requirement in the most efficient manner?


A. A record trigger flow on the Opportunity object


B. An Apex trigger on the Opportunity object


C. approval process on the Opportunity object


D. An error condition formula on a validation rule on Opportunity





D.
  An error condition formula on a validation rule on Opportunity

Explanation:

To enforce field-level data quality and conditional logic without code, validation rules are the most efficient and declarative tool available. In this scenario, the goal is to prevent users without a specific profile from changing an Opportunity to “Closed Lost” if a required field (Lost Reason) is blank. This is precisely what validation rules are designed for.

🔹 Why Option D is Correct:

A validation rule can be configured to trigger only when:

The Opportunity Stage = "Closed Lost"
The Lost Reason is blank
The current user does not have the Sales Manager profile
It is lightweight, does not require Apex, and is easy to maintain.
You can use the formula:

AND(
ISPICKVAL(StageName, "Closed Lost"),
ISBLANK(Lost_Reason__c),
$Profile.Name <> "Sales Manager"
)

Why the Other Options Are Less Efficient:

A. Record-triggered Flow:
Flows are powerful but are more complex and less performant than a validation rule for simple field checks.

B. Apex Trigger:
Overkill for this scenario. Triggers are ideal for complex logic, but not necessary for conditional checks based on user profile and field values.

C. Approval Process:
Approval processes are used to manage multi-step record approvals, not enforce conditional field-level validation.

A developer is writing tests for a class and needs to insert records to validate functionality. Which annotation method should be used to create record for every method in the test class?


A. @isTest (SeeAllData-true)


B. @FreTest


C. @TestSetup


D. @StartTest





C.
  @TestSetup

Explanation:

When writing Apex test classes, it’s a best practice to insert test data once and reuse it across multiple test methods. The @TestSetup annotation enables developers to create common test data that runs before every test method in the class — reducing duplication and improving clarity.

🔹 Why Option C is Correct:

@TestSetup marks a method that prepares shared test data used across all @isTest methods in the class.
The method is executed once per test run, but the data it creates is isolated for each test method — ensuring test integrity.
This leads to clean, efficient, and maintainable test classes.
Perfect for inserting accounts, contacts, or custom records used in multiple tests.

Why the Other Options Are Incorrect:

A. @isTest(SeeAllData=true):
This allows access to real org data — but is discouraged for proper unit testing. It doesn't set up fresh data.

B. @FreTest:
This is not a valid Apex annotation — likely a typo or fictitious choice.

D. @StartTest:
Used to reset governor limits during a test method — not for setting up data before test methods run.

Uniersal Containers (UC) is developing a process for their sales teams that requires all sales reps to go through a set of scripted steps with each new customer they create. In the first steps of collecting information, UC’s ERP system must be checked via as a REST endpoint to see if the customerexists. If the customer exists, the data must be presented to the sales rep in Salesforce. Which two should a developer implement to satisfy the requirements? Choose2 answer


A. Flow


B. Future method


C. Trigger


D. Invocable method





A.
  Flow

D.
  Invocable method

Explanation:

Universal Containers needs to build a guided scripted process that includes calling an external REST API to retrieve data. The ideal solution should be declarative for user interaction and programmatic for integration with the ERP system. This requirement can be met by combining Flows with Invocable Apex methods.

🔹 A. Flow (✔ Correct)
Screen Flows are perfect for guiding users through step-by-step processes like a customer onboarding script.
The flow can include screen elements, decisions, and actions like calling Apex code.
It improves the user experience for sales reps by presenting structured and interactive steps.

🔹 D. Invocable Method (✔ Correct)
Invocable Apex methods are callable from Flows, making them the best choice to perform backend logic.
Used here to perform a callout to the ERP REST API to check for existing customer data.
The flow can then display the returned data directly to the user.

Why the Other Options Are Incorrect:

B. Future Method
Future methods are for asynchronous processing and cannot be called from a Flow or return data back to the Flow.
They are not suitable for real-time API responses needed during user interaction.

C. Trigger
Triggers are used for backend automation on record changes, not for interactive UI flows or external API calls initiated by user actions.
Inappropriate here because the call to the ERP system is based on user-driven flow logic, not record insert/update.

What are two ways for a developer to execute tests in an org?


A. Tooling API


B. Developer console


C. Bulk API


D. Matadata API





A.
  Tooling API

B.
  Developer console

Explanation:

Salesforce offers multiple ways to execute Apex tests in an org, supporting both UI-based and programmatic testing. The best options depend on whether you prefer manual test execution or automation as part of CI/CD pipelines.

🔹 A. Tooling API (✔ Correct)
The Tooling API allows developers to run Apex tests programmatically, making it ideal for automated test execution in CI/CD pipelines.
You can execute tests and retrieve test results, code coverage, and debug logs using this API.
Commonly used in integrations with tools like Jenkins, GitHub Actions, or Salesforce DX.

🔹 B. Developer Console (✔ Correct) The Developer Console provides a point-and-click UI to run specific test classes, methods, or all tests in an org.
It also shows code coverage, logs, and test results, which helps in debugging and validation.
Ideal for quick testing and diagnostics during development.

Why Not the Other Options?

C. Bulk API
The Bulk API is meant for handling large data volumes, such as mass imports, updates, or deletions.
It does not support test execution.

D. Metadata API
The Metadata API is used to deploy or retrieve metadata like Apex classes and objects.
It doesn’t offer functionality to run or validate tests directly.

What can be easily developed using the Lightning Component framework?


A. Customized JavaScript buttons


B. Salesforce Classic user Interface pages


C. Lightning Pages


D. Salesforce integrations





C.
  Lightning Pages

Explanation:

The Lightning Component framework (now primarily referring to Lightning Web Components, and previously Aura Components) is the foundational technology for building and customizing the user interface within Salesforce's Lightning Experience.

C. Lightning Pages: This is the primary and most direct use case. Developers create custom Lightning components that can then be easily dragged and dropped onto Lightning Pages (such as Home Pages, Record Pages, and App Pages) using the Lightning App Builder. These components extend the standard Salesforce UI and provide custom functionality.

Let's look at why the other options are less accurate:

A. Customized JavaScript buttons: These are primarily a feature of Salesforce Classic and often rely on specific Classic JavaScript APIs. While Lightning Components use JavaScript, the framework itself is not primarily for building these legacy button types.
B. Salesforce Classic user Interface pages: The Lightning Component framework is designed for the Lightning Experience UI. Salesforce Classic pages are typically built using Visualforce or standard page layouts.
D. Salesforce integrations: Salesforce integrations involve connecting Salesforce with external systems (e.g., via APIs, middleware). While a Lightning component might display data fetched from an integration, the Lightning Component framework itself is a UI framework, not an integration framework. The actual integration logic (making callouts, processing responses) is typically handled by Apex.

As part of new feature development, a developer is asked to build a responsive application capable of responding to touch events, that will be executed on stateful clients. Which two technologies are built on a framework that fully supports the business requirement? Choose 2 answers


A. Aura Components


B. Vlsualforce Components


C. Lightning Web Components


D. Visualforce Pages





A.
  Aura Components

C.
  Lightning Web Components

Explanation:

When building modern, responsive applications that support touch events and are designed for stateful client environments like mobile or desktop browsers, developers should use frameworks designed for rich, client-side interactivity. Both Aura Components and Lightning Web Components (LWC) are purpose-built by Salesforce for this use case.

A. Aura Components
Aura is a component-based framework designed for building responsive UIs.
It supports client-side controllers, event-driven architecture, and touch interactions, making it well-suited for mobile-ready apps.
It maintains state in the browser, supporting stateful client execution.

C. Lightning Web Components (LWC)
LWC is Salesforce’s modern web standards–based framework.
It supports full event handling, touch interaction, and responsive layouts, ideal for mobile and desktop experiences.
It's also lightweight and more performant compared to Aura.

Why Not the Other Options?

❌ B. Visualforce Components
Visualforce is server-rendered and doesn’t natively support client-side responsiveness or touch event handling.
It lacks the real-time client interactivity that Aura and LWC provide.

❌ D. Visualforce Pages
Like Visualforce Components, these pages rely on page reloads and are not stateful on the client side.
You would need significant custom JavaScript to mimic responsive and touch-capable behavior, which is not efficient or scalable.

A developer is creating a page that allows users to create multiple Opportunities. The developer is asked to verify the current user's default } |
Opportunity record type, and set certain default values based on the record type before inserting the record.
How can the developer find the current user's default record type? ns


A. Query the Profile where the ID equals userInfo.getProfileID() and then use the profile.Opportunity.getDefaultRecordType() | |method. ] |


B. Use Opportunity. SObjectType.getDescribe().getRecordTypelnfos() to get a list of record types, and iterate through them until [ J isDefaultRecordTypeMapping() is true. Pencil & Paper |


C. Use the Schema.userlnfo.Opportunity.getDefaultRecordType() method. < Create the opportunity and check the opportunity.recordType before inserting, which will have the record ID of the current Dal user's default record type.





B.
  Use Opportunity. SObjectType.getDescribe().getRecordTypelnfos() to get a list of record types, and iterate through them until [ J isDefaultRecordTypeMapping() is true. Pencil & Paper |

Explanation:

When working with record types in Apex, especially to determine the default record type for the current user on a specific object (like Opportunity), the correct approach is to use the Describe metadata capabilities provided by Salesforce.

Why Option B is Correct:
Opportunity.SObjectType.getDescribe() gets the describe result for the Opportunity object.
.getRecordTypeInfos() returns a list of RecordTypeInfo objects.
Each RecordTypeInfo has a method .isDefaultRecordTypeMapping() that returns true for the current user's default record type.
This approach dynamically respects user-specific profile and permission settings.

Why Not the Other Options?

❌ A. Query the Profile and use profile.Opportunity.getDefaultRecordType()
This syntax is invalid. The Profile object cannot directly return the default record type for an object.
Record type visibility and defaults are managed at the Profile + Object level, and not directly queryable this way in Apex.

❌ C. Use Schema.userInfo.Opportunity.getDefaultRecordType()
There is no such method or class as Schema.userInfo.Opportunity.getDefaultRecordType() in Apex.
This is an incorrect reference to metadata methods.

❌ D. Create the Opportunity and check opportunity.recordType
This approach is not reliable because the record type field will be null unless explicitly set.
It’s also inefficient—you shouldn’t create a record just to check what the default type would have been.

A developer needs to prevent the creation of Request c records when certain coVraitions exist in the system. A RequeatLogic class exists that checks the conditions. What is the correct implementation?


A. Option A


B. Option B


C. Option C


D. Option D





B.
  Option B

Explanation:

Why Option B?

Trigger + Handler Pattern:

The most scalable and maintainable approach is to:

Create a trigger on the Request__c object.
Call the existing RequestLogic class from the trigger to enforce business rules.
Example Implementation:

// Trigger
trigger RequestTrigger on Request__c (before insert) {
if (Trigger.isBefore && Trigger.isInsert) {
RequestLogic.preventInvalidRequests(Trigger.new);
}
}

// RequestLogic.cls
public class RequestLogic {
public static void preventInvalidRequests(List newRequests) {
for (Request__c req : newRequests) {
if (/* invalid conditions */) {
req.addError('Creation not allowed due to system conditions.');
}
}
}
}


Page 8 out of 20 Pages
Previous