Salesforce PDI Online Practice
Questions and Exam Preparation
PDI Exam Details
Exam Code
:PDI
Exam Name
:Salesforce Certification for Platform Developer I (Plat-Dev-201)
Certification
:Salesforce Certifications
Vendor
:Salesforce
Total Questions
:270 Q&As
Last Updated
:Jul 13, 2026
Salesforce PDI Online Questions &
Answers
Question 241:
An org has two custom objects:
1. Plan_c, that has a master-detail relationship to the Account object.
2. Plan_item_c, that has a master-detail relationship to the plan_C object.
What should a developer use to create a Visualforce section in the Account page layout that displays all of the plan.. Account and all of the Plan_item_c records related to those plan_c records.
A. A controller extension with a custom controller B. A standard controller with a custom controller C. A standard controller with a controller extension D. A custom controller by itself
C. A standard controller with a controller extension
Explanation
Question 242:
The Salesforce Administrator created a custom picklist field, Account_status_c, on the a Account object. This picklist has possible values of Inactive'' and Active?
As part of a new business process, management wants to ensure an opportunity record is created only for Accounts marked as "Active". A developer is asked to implement this business requirement.
Which two automation tools should be used to fulfill the business need? Choose 2 answers
A. Salesforce Flow B. Approval Process C. Process Builder D. Workflow Rules
A. Salesforce Flow
Explanation
Question 243:
What should a developer use to script the deployment and unit test execution as part of continuous integration?
A. VS Code B. Execute Anonymous C. Salesforce CLI D. Developer Console
C. Salesforce CLI
Explanation
Salesforce CLI allows developers to automate deployments and run unit tests as part of a continuous integration (CI) pipeline. It is the most efficient tool for scripting these processes.
Question 244:
A custom picklist field, Food_Preference_c, exists on a custom object. The picklist contains the following options: `Vegan', `Kosher', `No Preference'. The developer must ensure a value is populated every time a record is created or updated.
What is the most efficient way to ensure a value is selected every time a record is saved?
A. Set "Use the first value in the list as the default value" to True. B. Write an Apex trigger to ensure a value is selected, C. Mark the field as Required on the object's page layout. D. Mark the field as Required on the field definition.
D. Mark the field as Required on the field definition.
Explanation
Marking the field as required on the field definition ensures that the field is always populated during record creation or update. This enforces the rule at the database level.
Other Options:
Option A: Setting a default value ensures a value is present initially but does not enforce a value during updates.
Option B: Writing a trigger is less efficient and adds unnecessary complexity.
Option C: Marking the field as required on the page layout is UI-specific and does not enforce the rule during API or code-based operations.
Question 245:
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.
D. Declare maxAttempts as a private static variable on a helper class.
Explanation
To preserve the value of maxAttempts for 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 separation of concerns, keeping trigger logic clean and aligned with best practices.
Example Code
Why Other Options Are Incorrect
A: Constants (static final) cannot be modified after initialization.
B: Trigger member variables do not retain values across executions within the same transaction.
C: Non-static variables in a helper class are reinitialized on each trigger execution.
Question 246:
A developer is building custom search functionality that uses SOSL to search account and contact records that match search terms provided by the end user. The feature is exposed through a Lightning web component, and the end user is able to provide a list of terms to search.
Consider the following code snippet:
@AuraEnabled public static List > searchTerms (List termList) { List> result = new List>();
for (String term : termList) { result.addAll ([[FIND :term IN ALL FIELDS RETURNING Account (Name), Contact (Firstname,LastName)]);
} return result;
}
What is the maximum number of search terms the end user can provide to successfully execute the search without exceeding a governor limit?
A. 20 B. 150 C. 200 D. 2,000
D. 2,000
Explanation
Question 247:
A Lightning web component retrieves Account records using an Apex method. Some users report runtime errors because they do not have access to certain fields returned by the query.
Which approach should the developer use to prevent these errors while respecting security?
A. Use WITH SHARING on the Apex class B. Use Security.stripInaccessible on the query results C. Use Lightning Locker Service D. Use a validation rule on the Account object
B. Use Security.stripInaccessible on the query results
Explanation
Security.stripInaccessible is designed specifically to enforce field-level security and object permissions at runtime. When an Apex method returns records to a Lightning web component, users may not have access to every field queried, which can cause runtime exceptions. By calling Security.stripInaccessible with the appropriate access type, Salesforce automatically removes fields that the current user is not allowed to read or update. This ensures that the component receives only the fields the user is permitted to access, preventing errors and maintaining compliance with the platform's security model. Using WITH SHARING enforces record-level access but does not remove restricted fields, which makes it insufficient for this scenario.
Question 248:
What are two benefits of using External IDs? Choose 2 answers
A. An External ID field can be used to reference an ID from another external system. B. An External ID can be a formula field ta help create a unique key from two fields in Salesforce. C. An External ID can be used with Salesforce Mobile to make external data visible. D. An External 1D is indexed and can improve the performance of SOOL queries.
A. An External ID field can be used to reference an ID from another external system. D. An External 1D is indexed and can improve the performance of SOOL queries.
Explanation
A: An External ID field is designed to store an ID from another external system, which can be used to match Salesforce records with data from an external source during data imports or integrations.
D: External ID fields are automatically indexed, which can significantly improve the performance of SOQL queries when filtering based on the External ID.
Why not other options?
B: External IDs cannot be formula fields. Only text, number, email, and auto-number fields can be set as External IDs.
C: While External IDs are useful for integrations, they do not make external data visible within Salesforce Mobile.
References: External IDs Overview
Question 249:
An org has an existing flow that edits an Opportunity with an Update Records element. A developer must update the flow to also create a Contact and store the created Contact's ID on the Opportunity.
Which update must the developer make in the flow?
A. Add a new Update Records element. B. Add a new Roll Back Records element. C. Add a new Create Records element. D. Add a new Get Records element.
C. Add a new Create Records element.
Explanation
Why Create Records Element?
The Create Records element adds the functionality to create a Contact record.
The Contact's ID can then be stored on the Opportunity using a variable or field update.
Why Not Other Options?
A: Update Records is for updating existing records, not creating new ones.
B: Roll Back Records is used for rolling back transactions, not for creating records.
D: Get Records retrieves records but does not create them.
A developer wants to ensure Apex code can be accessed outside a managed package namespace.
Which access modifier should be used?
A. private B. protected C. public D. global
D. global
Explanation
In managed packages, the global access modifier is required for classes and methods that must be accessible outside the package's namespace. Public access limits visibility to within the same namespace, which is insufficient when subscribers need to reference or extend the functionality. Private and protected further restrict access and are not suitable for exposed APIs. Using global ensures that the packaged functionality can be safely and intentionally consumed by external code.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Salesforce exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your PDI exam preparations
and Salesforce certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.