Skip to content

PDI Practice Questions

Prepare for PDI with more than an answer.

200 questions in the full set20 sample questionsUpdated Mar 12, 2026

Unlock the full exam and previous versions

  • v1Salesforce Certified Platform Developer I 166 questions Locked
  • DEV-450Legacy Salesforce Certified Platform Developer I 169 questions Locked
  • PDILegacy Salesforce Certified Platform Developer I 200 questions Current
Exam fee
$200 USD
Level
Professional
Valid for
Must complete maintenance modules annually
Domains covered on the exam 4
  1. Process Automation and Logic30%
  2. User Interface25%
  3. Developer Fundamentals23%
  4. Testing, Debugging, and Deployment22%
  1. 1

    Case Study: Universal Containers (UC) is implementing a new quality assurance (QA) process. They have a custom object, QA_Review__c, which has a lookup relationship to the Case object. The QA team needs a central place to view all Cases with their associated QA Reviews.

    The business has provided the following requirements:

    1. A Visualforce page must be created to display a list of all Cases.
    2. For each Case in the list, the user should be able to see the Status__c and Score__c from the most recent related QA_Review__c record.
    3. The solution must be performant and not exceed governor limits, even with thousands of Cases.
    4. The page should be accessible via a custom tab.

    A developer needs to design the Apex controller to support this Visualforce page. Which approach for fetching and structuring the data is most efficient and scalable?

    Show answer details

    Correct answer: D

    The most efficient approach is to offload as much processing as possible to the database. A single aggregate SOQL query can retrieve all the necessary information in one database round trip. By querying QA_Review__c, grouping by the Case__c lookup, and selecting the relevant fields, you can efficiently get the data for the most recent review for each case. This result can then be used to populate a Map or a list of wrapper classes, avoiding loops with SOQL queries and ensuring the solution is scalable and performant. This minimizes Apex CPU time and avoids hitting the SOQL query limit.

  2. 2

    A developer needs to deploy a new Apex class and a new custom field on the Account object from a sandbox to production. They are using a change set. Which steps must be taken to ensure a successful deployment? (Select THREE)

    Show answer details

    Correct answer: A, B, D

    For a successful deployment to production, all components (the Apex class and the custom field) must be in the change set. The Apex class must have an accompanying test class (which also must be in the change set) that provides at least 75% code coverage for the class being deployed. The overall code coverage in the production org must also be at least 75% after the deployment. Field-level security for profiles can be included in the change set and does not have to be configured manually.

  3. 3

    The Model-View-Controller (MVC) architectural pattern is fundamental to the Lightning Platform. Which Salesforce feature correctly corresponds to the 'Model' component of the MVC pattern?

    Show answer details

    Correct answer: C

    In the Salesforce MVC pattern, the 'Model' represents the data structure and database. This corresponds directly to the Standard and Custom Objects, along with their fields and relationships, which define the schema and how data is stored in the Salesforce database. The 'View' is the user interface (Visualforce, Lightning Components), and the 'Controller' is the business logic (Apex).

  4. 4

    A developer needs to prevent recursive execution in an Opportunity trigger. The trigger updates a field on related Account records, which in turn causes the Account trigger to fire and update the original Opportunity, creating a loop. What is the standard, best-practice technique to prevent this recursion?

    Show answer details

    Correct answer: B

    The standard and most efficient way to prevent trigger recursion within a single transaction is to use a static boolean variable. Static variables retain their value for the duration of the transaction. A common pattern is to have a helper class with a static boolean hasRun variable, initialized to false. The trigger checks this variable upon entry. If it's false, it sets it to true and executes the logic. If it's true, it bypasses the logic, thus breaking the recursive loop. This is more performant than querying a custom setting.

  5. 5

    An architect is designing a data model for a recruiting application. There are three custom objects: Position__c, Candidate__c, and Application__c. A candidate can apply for multiple positions, and a position can have multiple candidates. The Application__c object represents a single candidate's application for a specific position. If a Position__c record is deleted, all related Application__c records must also be deleted. However, deleting a Candidate__c should not delete their Application__c records; instead, it should prevent the deletion if applications exist.

    How should the relationships for the Application__c object be configured?

    graph TD Position -- "Master-Detail" --> Application Candidate -- "Lookup" --> Application

    Show answer details

    Correct answer: C

    The correct data model is a Master-Detail relationship to Position__c and a Lookup relationship to Candidate__c. The requirement for cascading deletion (deleting a Position deletes its Applications) directly points to a Master-Detail relationship, where Position__c is the master. The requirement that deleting a Candidate__c should be prevented if applications exist (but not cascade delete them) points to a Lookup relationship. A standard lookup relationship with the "Don't allow deletion of the lookup record that's part of a lookup relationship" option selected will enforce this behavior. An object can have at most two master-detail relationships, but the behavior described for the Candidate__c object perfectly matches a lookup.

  6. 6

    A financial services company has a requirement to prevent the deletion of any Opportunity record with a 'Closed Won' status by any user except those with a 'System Administrator' profile. A junior developer suggests creating a validation rule. As the senior developer, what is the most robust and secure approach to meet this requirement?

    Show answer details

    Correct answer: B

    The most robust solution is an Apex trigger on the 'before delete' event. Validation rules do not fire on delete operations, so they cannot be used to prevent record deletion. A 'before delete' trigger can inspect the records being deleted, check the user's profile, and use the .addError() method on the records that should not be deleted, effectively blocking the DML operation. This approach is secure and directly addresses the requirement which cannot be met by declarative tools.

  7. 7

    A developer needs to create a Visualforce page that displays a list of Contact records. The page should allow users to select multiple contacts via checkboxes and then perform a bulk update on a custom field, Status__c, for all selected records. Which combination of Visualforce components and controller logic is best suited for this requirement?

    Show answer details

    Correct answer: A

    The best approach is to use a wrapper (or inner) class within a custom controller. The wrapper class will contain the Contact sObject and a boolean property to track the checkbox state. The Visualforce page will iterate over a list of these wrapper objects in an or . This pattern allows the controller to easily identify which records were selected when the user submits the form, enabling efficient bulk processing.

  8. 8

    A developer is writing a test class for an Apex trigger that fires on after update of Account records. The trigger makes a callout to an external service. The test method fails with an System.CalloutException: You have uncommitted work pending. error. The developer has already implemented a mock callout. What is the cause of this error in a test context?

    Show answer details

    Correct answer: B

    Salesforce prevents performing a callout after a DML operation within the same transaction to avoid data integrity issues. Even in a test context with mock callouts, this rule is enforced. The DML statement (update account;) starts a transaction that is not committed until the test method finishes. The after update trigger attempts the callout within this transaction, causing the 'uncommitted work pending' error. To resolve this, the callout logic must be moved to an asynchronous method (like a @future method), and the test must use Test.startTest() and Test.stopTest() to ensure the DML is committed before the asynchronous logic executes.

  9. 9

    A university is building a student management application. They have custom objects for Student__c, Course__c, and Enrollment__c. A student can enroll in many courses, and a course can have many students. The Enrollment__c object represents a student's enrollment in a specific course and contains details like Grade__c and Semester__c. When a Student__c record is deleted, all their related Enrollment__c records must also be deleted. Which data model correctly represents this relationship?

    Show answer details

    Correct answer: C

    This scenario describes a many-to-many relationship between Student and Course, implemented with Enrollment__c as the junction object. The requirement that enrollments are deleted when a student is deleted indicates a cascading delete behavior, which is a key feature of a Master-Detail relationship. Therefore, Enrollment__c must have a Master-Detail relationship to Student__c. The relationship to Course__c can be a Lookup, as there's no stated requirement for cascading deletion when a course is deleted. An object can have at most two master-detail relationships, but in this case, only one is strictly required by the prompt, making this the most appropriate and common configuration.

    erDiagram STUDENT ||--|{ ENROLLMENT : has COURSE ||..|{ ENROLLMENT : has STUDENT { string Id PK string Name } COURSE { string Id PK string CourseName } ENROLLMENT { string Id PK string StudentId FK "Master-Detail" string CourseId FK "Lookup" string Grade__c }

  10. 10

    A developer is tasked with creating a nightly batch job that processes all Order__c records marked as 'Pending Fulfillment'. The job must aggregate line items for each order, calculate a total shipping weight, and update a Total_Weight__c field on the Order__c record. The org contains millions of Order__c records. Which Apex features are essential for building a scalable and efficient solution? (Select THREE)

    Show answer details

    Correct answer: A, D, E

    To process millions of records, Batch Apex (using the Database.Batchable interface) is the correct choice as it processes records in manageable chunks, respecting governor limits. To run the job nightly, the class must also implement the Schedulable interface. Within the start method of the batch class, a Database.QueryLocator must be used to build the scope of records to process. A QueryLocator can handle up to 50 million records, making it essential for large data volumes.

Create an account to continue.