PDI Sample Questions

PDI Sample Questions & Answers

Declarative automation and Apex fundamentals take the biggest share, followed by Visualforce pages and Lightning components, core platform and data modeling knowledge, and how you test, debug and deploy changes.

Launch the full PDI simulator →

Showing 10 of 20 free samples.

  1. Question 1Beginner

    User Interface · Lightning Component Framework

    A developer is building a custom Aura component that needs to display a list of related Case records on an Account record page. To optimize performance, the developer wants to fetch the data from the server only when the component is first rendered. Where should the developer place the call to the Apex controller method to fetch the case data?

    Show answer & explanation

    Correct answer: B

    The standard practice for fetching data when an Aura component initializes is to use the aura:handler for the init event. The handler, typically named doInit, is defined in the component markup: . The corresponding doInit function in the component's JavaScript controller should then call a function in the helper to make the server-side call to the Apex method. Placing logic in the helper promotes code reuse and better organization.

  2. Question 2Beginner

    Testing, Debugging, and Deployment · Developer Console and SOQL Limits

    A developer uses the Developer Console to execute a SOQL query. The query returns 50,001 rows from the Account object. What will be the outcome?

    Show answer & explanation

    Correct answer: B

    The total number of records that can be retrieved by a single SOQL query is 50,000. This is a hard governor limit enforced by the platform. Attempting to retrieve 50,001 rows in a single query, whether in Apex, the Developer Console, or another tool, will result in a System.LimitException indicating that the query has retrieved too many rows.

  3. Question 3Intermediate

    Process Automation and Logic · Apex Security and Sharing

    True or False: Using the with sharing keyword on an Apex class guarantees that a user can only see records they have explicit access to via sharing rules, regardless of their object-level permissions.

    Show answer & explanation

    Correct answer: B

    False. The with sharing keyword enforces the sharing rules for the current user, but it does NOT enforce object-level or field-level security. A user must have at least 'Read' permission on the object to see any records at all. If a user has 'Read' permission on the object, with sharing will then filter the records returned by a query based on the user's record-level access (sharing rules, role hierarchy, etc.).

  4. Question 4Beginner

    Process Automation and Logic · SOQL Relationship Queries

    A developer needs to write a SOQL query to retrieve Account records along with all of their related Contact records. The query should be executed within an Apex class. What is the correct syntax for this parent-to-child query?

    Show answer & explanation

    Correct answer: B

    The correct syntax for a parent-to-child subquery uses the plural child relationship name. For standard objects, this is typically the plural of the child object name (e.g., Contacts, Opportunities). For custom objects, the relationship name is the plural of the child object name appended with __r (e.g., My_Custom_Objects__r).

  5. Question 5Beginner

    Developer Fundamentals · Declarative Features

    A retail company uses a custom Shipment__c object that has a Master-Detail relationship with the standard Account object. A developer needs to create a field on the Account object that displays the date of the most recent Shipment__c record. What is the most efficient way to implement this without writing any Apex code?

    Show answer & explanation

    Correct answer: A

    Roll-Up Summary Fields are a declarative feature that can perform calculations like COUNT, SUM, MIN, and MAX on records in a detail relationship. Since Shipment__c has a Master-Detail relationship to Account, a Roll-Up Summary Field can be created on the Account object. Using the MAX function on the shipment date field will efficiently find and display the date of the most recent shipment without needing Apex.

  6. Question 6Advanced

    Process Automation and Logic · Execution Context

    A developer is writing an Apex trigger on the Case object. The trigger needs to execute different logic based on whether the record was created from the UI or through a data load via the API. Which Apex method can be used within the trigger to determine the execution context?

    Show answer & explanation

    Correct answer: D

    The getQuiddity() method on the Request class can be used to determine the origin of the transaction. It returns an enum value from System.Quiddity. For example, Quiddity.UI indicates the request originated from the standard Salesforce UI, while Quiddity.API indicates an API call. This allows the developer to conditionally execute logic based on the request's source.

  7. Question 7Intermediate

    Testing, Debugging, and Deployment · Test Data Management

    A consultant is deploying a change set from a Developer Sandbox to a Full Sandbox for user acceptance testing (UAT). The change set contains Apex classes, triggers, and a custom object. The deployment fails due to test failures. Upon investigation, the developer finds that the failing tests rely on specific Account and Contact records that exist in the Developer Sandbox but not in the Full Sandbox. What is the best practice for resolving this issue?

    Show answer & explanation

    Correct answer: C

    The best practice is for Apex test classes to be self-contained and create their own test data. This ensures they can run in any environment without dependencies on existing data. Using an @testSetup method is the most efficient way to create common test records that can be used by all test methods in the class. This approach makes deployments more reliable and predictable.

  8. Question 8Intermediate

    User Interface · Lightning Component Framework

    A developer needs to create a custom user interface that allows sales reps to quickly create a new Opportunity and its related Opportunity Contact Roles on a single screen. The solution must be available within the Salesforce mobile app. Which technology provides the most modern, responsive, and performant solution for this requirement?

    Show answer & explanation

    Correct answer: C

    Lightning Web Components (LWC) are the current standard for building custom user interfaces on the Salesforce platform. They are built on modern web standards, are inherently mobile-friendly, and offer superior performance compared to Visualforce or Aura components due to their lightweight framework and client-side rendering. For a new custom UI, especially one intended for the mobile app, LWC is the recommended and best choice.

  9. Question 9Beginner

    Developer Fundamentals · Declarative Customization

    An organization has a business rule that an Account's BillingCountry must be 'USA' if its Industry is 'Government'. Which is the simplest and most efficient tool to enforce this data integrity rule?

    Show answer & explanation

    Correct answer: B

    This is a classic use case for a Validation Rule. Validation rules are declarative tools designed to enforce data integrity by preventing records from being saved if they do not meet defined criteria. The formula ISPICKVAL(Industry, 'Government') && BillingCountry 'USA' would effectively enforce this rule without requiring any code, making it the simplest and most maintainable solution.

  10. Question 10IntermediateSelect 2

    Process Automation and Logic · Governor Limits and Bulkification

    A developer has the following Apex code snippet intended to update the description of 250 accounts:

    List accountsToUpdate = [SELECT Id FROM Account LIMIT 250];
    for (Account acc : accountsToUpdate) {
    Account updatedAcc = [SELECT Id, Description FROM Account WHERE Id = :acc.Id];
    updatedAcc.Description = 'Updated by Apex';
    update updatedAcc;
    }
    

    What are the primary issues with this code? (Select TWO)

    Show answer & explanation

    Correct answers: B, D

    This code violates two fundamental bulkification principles. It has a SOQL query inside the loop, which will quickly exceed the governor limit of 100 SOQL queries per transaction. It also has a DML update statement inside the loop, which will exceed the governor limit of 150 DML statements per transaction. Both of these are critical anti-patterns that must be avoided in Apex development.

Ready for the real thing?

The full PDI simulator has every exam-style question, timed mode, and instant scoring.

Go to the PDI simulator →