Practice questions · Salesforce & CRM
Salesforce Platform Developer I: Practice Questions
Original practice questions for the Salesforce Platform Developer I (PD1) exam. Each answer is explained, including why each other option is wrong. Filter by section or difficulty. These are concept checks - not questions from the certification.
Answered 0 · Correct 0
-
Why does the Salesforce platform enforce governor limits on Apex code?
Correct answer: B. Salesforce is multitenant: many orgs run on shared infrastructure, so per-transaction limits on queries, DML and CPU keep one org's code from starving the others. The limits are not a sales mechanism, so the capacity option is wrong. Loops are perfectly legal - the limits just force you to keep queries and DML out of them. And the interpretation claim is both inaccurate and irrelevant: limits exist because of shared resources, not because of how Apex executes. -
A developer needs a field on a parent record that automatically sums a currency field from its child records, without writing code. What does this require?
Correct answer: D. A roll-up summary field counts, sums or aggregates detail records onto the master, and it is only available when the objects are joined by a master-detail relationship. A lookup relationship alone cannot host roll-up summaries, which is exactly why it is the trap option. A formula field on the child cannot aggregate its siblings - formulas read fields on or above their own record. A validation rule only blocks bad saves; it computes nothing. -
Which statement correctly describes a master-detail relationship?
Correct answer: A. Master-detail is an ownership relationship: the detail record requires its master, inherits its sharing, and is cascade-deleted with it. Detail records existing independently describes a lookup relationship, not master-detail. The standard-objects claim is wrong - master-detail is commonly created on custom objects (a custom object can be the detail side). And many-to-many needs a junction object with two master-detail relationships; a single master-detail is one-to-many. -
A team loads customer data nightly from an external ERP system and must match existing Salesforce records using the ERP's own account number. Which platform feature supports this directly?
Correct answer: C. A custom field flagged as an External ID lets an upsert match incoming rows against an outside system's key, so the nightly load can insert-or-update in one operation. A roll-up summary aggregates child records and has nothing to do with matching. A junction object models many-to-many relationships, which is not the problem here. A formula field is read-only and computed, so it cannot serve as a stable matching key for data loads. -
In the Model-View-Controller (MVC) pattern as applied to the Salesforce platform, which element plays the role of the model?
Correct answer: B. In platform MVC, the model is the data layer: objects, fields and relationships. Visualforce pages and Lightning components are the view - they present data rather than store it. Apex controllers and extensions are the controller layer, holding the logic that connects view to model. The browser is just the rendering environment for the view and is not part of the platform's MVC split at all. -
A requirement can be met either with a record-triggered flow or with an Apex trigger of similar complexity. Following Salesforce's recommended approach, what should the developer usually consider first?
Correct answer: A. The platform's long-standing guidance is declarative first where the tools genuinely fit: flows are more accessible to maintain, upgrade and hand over than code of equal complexity. The blanket performance claim for Apex is false - and even where code is faster, that alone does not decide the design. A Visualforce page is a UI technology, not an automation tool. Running the same logic in both a flow and a trigger is a classic anti-pattern that causes duplicate updates and recursion, not safety. -
A developer is evaluating Agentforce for a customer-service scenario. Which statement best reflects how developers should approach it?
Correct answer: D. The current outline expects developers to know Agentforce's use cases and its limits, and the key developer-facing fact is that agent actions can call into custom logic, including Apex. It does not replace Apex and Flow - agents orchestrate work that still needs that logic underneath. It is an AI agent layer, not a rebranded development tool. And it is not admin-only: the developer angle exists precisely because agents can be extended with code. -
A company needs to relate many candidate records to many job-position records. What is the standard way to model this many-to-many relationship?
Correct answer: C. The standard many-to-many pattern is a junction object: a custom object carrying two master-detail relationships, one to each parent, so each junction record represents one candidate-position pairing. Lookup fields on each object would only give two independent one-to-many links, not a many-to-many bridge. A formula field displays derived values and creates no relationship. A hierarchical relationship is a special lookup on the User object, unrelated to this modelling problem. -
What is an sObject in Apex?
Correct answer: B. sObject is the Apex type representing any Salesforce database object, and an sObject variable (like Account or a custom object type) holds a single record. It is a server-side Apex concept, not a JavaScript wrapper - LWC has its own data mechanisms. Test data uses ordinary sObjects created inside tests, so there is no test-only object type. And metadata exports are files produced by deployment tooling, which has nothing to do with the sObject type. -
Which statement about formula fields is accurate?
Correct answer: A. A formula field is computed each time it is viewed, based on other fields, and its result is not stored or directly editable. Aggregating child values is the job of roll-up summary fields, and even those work only on master-detail relationships - no field type aggregates across any relationship. Formula fields are read-only for every user regardless of profile. And they need no relationship at all; they can be built from fields on the record itself. -
How does the Salesforce platform's metadata-driven architecture affect custom applications?
Correct answer: C. Customisations - objects, fields, layouts, code - are stored as metadata, and the shared multitenant runtime interprets that metadata per org. That is what lets thousands of differently customised orgs run on common infrastructure. Dedicated database servers per org is the opposite of multitenancy. Per-org native compilation misdescribes the model. And the platform's three annual releases upgrade everyone in place - metadata-driven design is precisely why nothing needs reinstalling. -
Which of these is a declarative (point-and-click) customisation rather than a programmatic one?
Correct answer: D. A validation rule is built in Setup with clicks and a formula expression, making it declarative even though the formula resembles code. An Apex trigger is written in Apex, the definition of programmatic. A Lightning web component involves JavaScript and HTML authored by a developer. An Apex class implementing an interface is likewise pure code. The formula inside a validation rule does not change its declarative nature - it is configuration, not deployed source code. -
A developer must find every account whose name contains a text fragment, and also search the same term across contacts and leads in one operation. Which query language fits the multi-object text search?
Correct answer: B. SOSL is Salesforce's text-search language and can search a term across multiple objects - accounts, contacts and leads - in one operation. SOQL queries one object at a time (with its related records), so the claim that it searches every object at once is exactly backwards. DML is data manipulation (insert, update, delete), not a query language. A roll-up summary is a field type that aggregates detail records and has nothing to do with searching. -
What does the upsert DML operation do?
Correct answer: A. Upsert combines insert and update: rows that match an existing record (by ID or a designated external ID field) are updated, and the rest are inserted, all in one statement - which is why it is the backbone of integration loads. Delete-then-restore describes delete and undelete, two separate operations. Combining records into one survivor is the merge operation. And record locking is a platform concurrency behaviour, not something a DML verb performs on request. -
A trigger contains a SOQL query inside a for loop that iterates over Trigger.new. Why is this a problem?
Correct answer: C. Triggers process up to 200 records per batch, so a query inside the loop can run up to 200 times and blow through the per-transaction SOQL limit - the classic bulkification failure. The fix is to query once outside the loop, typically into a Map. SOQL is perfectly legal in triggers; the issue is placement, not permission. For loops iterate over Trigger.new routinely. And query results are not discarded - they are returned normally, which is exactly how the limit gets consumed. -
In a before update trigger, what does Trigger.new contain?
Correct answer: B. Trigger.new holds the incoming versions of the records, and in a before context those values can still be changed directly, without extra DML - the core reason before triggers exist. The prior values live in Trigger.old and Trigger.oldMap, so the first option describes the wrong variable (and Trigger.new is a list, not a map). Records failing validation are not what the list filters on. User and session details come from classes like UserInfo, not from trigger context. -
When should a developer choose a before trigger rather than an after trigger?
Correct answer: D. A before trigger can modify the records in Trigger.new directly and the changes are saved with the record - no additional DML, no recursion risk. Sending records to an external system belongs after the save, asynchronously, so the data is committed first. A record's ID does not exist until the save, so reading it requires an after trigger. Creating child records that reference the new record also needs the parent's ID, again pointing to an after trigger. -
Which Apex collection should a developer use to associate each account ID with its account record for fast lookup?
Correct answer: A. A Map<Id, Account> pairs each unique ID key with its record and retrieves by key in one step, which is why maps are the workhorse of bulkified code. A List keeps an ordered sequence but finding a record by ID means scanning it. A Set holds unique values with no key-to-value pairing, so it can tell you whether an ID is present but cannot hand back the record. An Enum is a fixed collection of named constants, not a data structure for records at all. -
During the save order of execution for an updated record, which sequence is correct?
Correct answer: C. The save order runs before triggers, then enforces validation rules, then saves the record and fires after triggers, with assignment rules and further automation later still. After triggers cannot come first - they need a saved record. The claim that all validation always precedes triggers is the common misconception this topic tests: custom validation rules run after before triggers. And assignment rules sit well after the trigger phases, not before them. -
An update trigger performs a DML update on the same records, causing the trigger to fire again. What is a common pattern to prevent unbounded recursion?
Correct answer: B. A static variable keeps its value for the whole transaction, so the trigger can check it and skip re-execution the second time - the standard recursion guard (a static Set of processed IDs is the refined version). Try-catch handles exceptions; it does not stop the trigger from firing again. Changing the event to before delete abandons the requirement rather than fixing the bug. And governor limits cannot be raised on request - the design must respect them. -
Which Apex construct lets a developer handle a DML failure gracefully instead of letting an unhandled exception end the transaction?
Correct answer: A. Wrapping DML in try-catch lets the code catch a DmlException and respond deliberately - log it, surface a friendly error, or take a fallback path - instead of the whole transaction dying. An endless retry loop would hit CPU and limit ceilings and never addresses the underlying failure. A SOSL search is a text query and cannot influence DML error handling. And @isTest marks test code; it changes nothing about how exceptions behave in production logic. -
A requirement involves complex branching logic, callouts to an external web service and heavy data transformation, with no screen needed. Which implementation is most appropriate?
Correct answer: D. Declarative-first has limits, and this requirement sits past them: intricate branching, callouts and heavy transformation are exactly where Apex is the honest choice. A screen flow is built around user interaction, which the requirement explicitly excludes. A validation rule can only evaluate a condition and block a save - it performs no transformation and no callouts. A roll-up summary just aggregates child records on a master-detail relationship, nowhere near this scope. -
What does an Apex interface provide?
Correct answer: C. An interface declares method signatures without bodies; any class that implements it commits to providing those methods, which enables polymorphism and patterns like Batchable and Queueable (both are interfaces you implement). Storing field values is what objects and fields do, not interfaces. UI layouts are page layouts and Lightning pages, a different concept entirely. And nothing about an interface generates tests - test classes are always written by the developer. -
A developer declares an Apex class using the with sharing keyword. What is the effect?
Correct answer: B. with sharing makes the class honour the running user's record-level sharing, so queries and DML see and touch only records that user can access. Reusability between classes exists regardless of sharing keywords. The permissions option confuses layers: sharing keywords govern record visibility, while object and field permissions (CRUD/FLS) are a separate concern that Apex must enforce explicitly either way. Guest access is controlled by profiles and site configuration, not by this keyword. -
An org must process millions of records nightly with logic too complex for declarative tools. Which asynchronous option is designed for this volume?
Correct answer: A. Batch Apex exists precisely for very large volumes: it splits the workload into chunks, each processed in its own transaction with its own governor limits. A future method is fire-and-forget for small jobs - stuffing millions of IDs into one call would breach limits immediately. A before insert trigger only fires when records are being inserted and runs synchronously inside someone's transaction. A screen flow needs a human clicking through it, which is no way to run a nightly job. -
For building a brand-new custom user interface component on the Lightning Platform, which framework does Salesforce position as the modern default?
Correct answer: D. Lightning Web Components is the current default for new UI work: it is built on web standards, so the browser natively handles much of what older frameworks did in JavaScript abstraction layers. Visualforce remains supported and examined but is the older page-centric model, not the default for new components. JavaServer Pages are not a platform UI technology at all. Aura still runs and interoperates with LWC, but it is the predecessor framework rather than the recommended starting point. -
A Lightning web component needs data that only an Apex method can provide. What must be true of the Apex method for the component to call it?
Correct answer: C. Apex methods exposed to Lightning components must be static and carry the @AuraEnabled annotation; for @wire usage the method must additionally be cacheable. Private instance methods in controller extensions are the Visualforce pattern and are not visible to LWC. Returning a page reference has nothing to do with exposing data to components. And triggers cannot contain callable service methods - they run on data events, not on requests from components. -
When a Lightning web component uses the @wire decorator to call an Apex method, how does the data arrive?
Correct answer: A. The wire service is reactive: it provisions data to the decorated property or function and re-runs the wire automatically when a reactive parameter (like a tracked field value) changes. Firing only on a button click describes an imperative Apex call, the explicit alternative to @wire. No Visualforce page is involved in LWC data plumbing. And there is no default polling loop - re-invocation is driven by parameter changes, not timers. -
Inside a Lightning web component hierarchy, how does a child component typically send information up to its parent?
Correct answer: B. The standard LWC pattern is child-to-parent communication through events: the child dispatches a CustomEvent and the parent listens with an event handler. Children cannot and should not reach into a parent's internals - data flows down through public properties, events flow up. Cookies are unrelated browser storage and no part of the component communication model. And SOSL is a server-side search language with no role in passing values between components on a page. -
A developer must display and edit a single record in a Lightning web component without writing any Apex. Which approach achieves this?
Correct answer: C. The record form base components sit on Lightning Data Service, which reads and writes single records with caching and sharing enforcement built in - no Apex, no SOQL. An Apex controller contradicts the no-Apex requirement outright. Batch Apex is for large asynchronous data jobs and has nothing to do with rendering a record in a UI. A REST callout from the component to the org's own API adds authentication and complexity for something the platform gives away free. -
Which statement best describes Visualforce today?
Correct answer: D. Visualforce is the veteran page-centric framework: it still works, orgs still run plenty of it, and the exam still touches it, but Lightning Web Components is the default for new development. It is the oldest of the UI options, not the newest. It has always displayed record data - standard controllers exist for exactly that. And it has not been removed; treating it as gone is as wrong as treating it as the recommended starting point. -
An Apex method serves data to a custom component, and some users must not see certain fields. What is the developer's responsibility?
Correct answer: B. Apex runs in system mode by default, so code serving a UI must enforce CRUD and field-level security itself - WITH SECURITY_ENFORCED in SOQL and Security.stripInaccessible on results are the standard tools. The automatic-enforcement claim is precisely the misconception this topic exists to correct. Hiding fields with CSS still sends the data to the browser, where anyone can inspect it. And hoping users do not look is not a security control by any definition. -
Which declarative tool can present a multi-step, wizard-style user interface that collects input from users without custom code?
Correct answer: A. A screen flow presents a sequence of screens that collect and process user input, built entirely in Flow Builder - the declarative answer to wizard-style UI. A trigger has no user interface at all; it reacts to data changes on the server. A roll-up summary field aggregates child records and displays a number. The Developer Console's query editor is a developer tool for running SOQL while debugging, never something end users see. -
Compared with the Aura framework, what is a key architectural advantage of Lightning Web Components?
Correct answer: C. LWC's defining advantage is standards alignment: custom elements, modules and modern JavaScript let the browser do natively what Aura implemented in a heavy framework layer, which improves performance and transferable skills. LWC is not confined to Visualforce - it runs across Lightning Experience surfaces. It is written in JavaScript, not without it. And each component's view is defined in an HTML template file, so the no-templates claim is the opposite of how LWC works. -
Two components in different parts of a Lightning page, not in the same component hierarchy, need to exchange messages. Which feature is designed for this?
Correct answer: D. Lightning Message Service is built for cross-DOM communication: components anywhere on the page - LWC, Aura, even Visualforce iframes - can publish and subscribe on a message channel. Custom events only propagate within a containment hierarchy, so they cannot bridge unrelated components, which is the trap in the first option. Page layout assignment controls which layout users see, not messaging. A formula field computes a display value and carries no messages anywhere. -
How can a developer extend an AI agent's abilities so it can take actions specific to their org, such as running custom business logic?
Correct answer: B. The developer-facing model for Agentforce is building actions: an agent's capabilities are extended by wiring actions to logic the team implements, including Apex, which is why the outline pairs Agentforce with Apex skills. Editing model weights is not something platform developers do or need. Granting an agent System Administrator access is a security anti-pattern, not an extension mechanism. And governor limits cannot be switched off for anyone - agent-invoked logic must respect them like all Apex. -
What is the minimum overall Apex test coverage required to deploy code to a production org?
Correct answer: A. Production deployments require at least 75% overall coverage of Apex code, and every trigger must have some coverage. The 50% figure is simply wrong. 100% on every class overstates the rule - 75% is measured overall, though aiming higher is healthy. And tests are not optional for production: the deployment itself runs them and enforces the threshold, which is exactly why the exam also stresses that assertions, not just executed lines, are what make those tests worth anything. -
By default, what data can an Apex test method see when it runs?
Correct answer: C. Tests are isolated from org data by default: they must create the records they need, which keeps them repeatable in any environment (certain setup objects such as User remain visible, and the seeAllData option can override the isolation but is best avoided). Seeing all org records is exactly what the default prevents. Ownership by the administrator has nothing to do with test visibility. And there is no read-only snapshot mechanism - the test simply does not see existing records. -
What is the main purpose of calling Test.startTest() and Test.stopTest() in a test method?
Correct answer: D. startTest and stopTest bracket the code under test: it receives its own fresh governor limits, separate from the test's setup consumption, and queued asynchronous work (future methods, queueables) executes synchronously by stopTest so results can be asserted. Validation rules keep running - nothing is disabled. Test data isolation is unchanged; production data stays invisible by default. And limits are reset for the block, never skipped: exceeding them still fails the test. -
A test class achieves high code coverage but contains no assertions. What is the problem?
Correct answer: B. Coverage measures which lines ran, nothing more; a test without assertions would pass even if the code produced wrong results. Assertions (System.assertEquals and friends) pin the expected outcomes, which is what makes a test a test. Assertion-free tests compile fine, which is precisely why they are dangerous. Trigger compilation never depends on assertions. And treating coverage as the goal is the mindset the exam explicitly punishes - the 75% gate is a floor, not the purpose. -
What distinguishes a scratch org from a sandbox?
Correct answer: A. A scratch org is ephemeral and source-driven: created on demand from a definition file, used for development or CI, then discarded - the heart of the Salesforce DX model. A sandbox is the opposite of configuration-free: it is refreshed from production and carries its configuration (and, in fuller types, its data). The permanent-copy description fits certain sandboxes, not scratch orgs. And sandboxes are a standard feature of many editions, not an ISV-partner exclusive. -
Which tool provides command-line operations for creating orgs, deploying source, and running tests in a Salesforce DX workflow?
Correct answer: C. The Salesforce CLI is the command-line backbone of DX: it creates and manages scratch orgs, pushes and pulls source, deploys, and runs tests, which makes it scriptable for CI pipelines. The Data Import Wizard loads data records and does not touch metadata deployment despite what the option claims. The Lightning App Builder assembles pages with clicks. Schema Builder visualises and edits the data model. Neither of those Setup tools offers any command-line capability. -
A developer wants to inspect the debug log of an Apex execution directly in the browser, without installing anything. Which tool fits?
Correct answer: D. The Developer Console is the browser-based development environment: it opens from Setup with no installation and shows debug logs, along with a query editor and code editing. Visual Studio Code is powerful but is exactly what the question rules out - a desktop install. Data Loader is an installed client for moving data records, with no log-viewing role. A change set is a deployment mechanism between related orgs and has nothing to do with inspecting execution logs. -
Which deployment option moves customisations between related orgs, such as a sandbox and its production org, using point-and-click setup rather than the command line?
Correct answer: B. Change sets are the declarative deployment path: build an outbound change set in one org, upload it to a related org (sandbox to production, for example) and deploy it there through Setup. A scratch org definition file describes an org's shape for Salesforce DX - it deploys nothing between orgs. Debug log filters control what gets logged during execution. And @isTest marks test code; annotations do not move customisations anywhere. -
A developer must verify that a user with a restricted profile cannot access certain records in Apex logic. How can a test simulate that user's record access?
Correct answer: A. System.runAs, available only in tests, executes a code block as a specified user and enforces that user's record sharing, which is exactly how access behaviour is verified (note it enforces sharing, not object or field permissions). Logging into production to observe logs is not automated testing at all. Org-wide defaults are org configuration, not something a test method can toggle. And seeAllData widens data visibility for the test - the opposite of proving a restriction works.
Practice questions FAQ
- Are these real PD1 exam questions?
- No. These are original study questions written to test understanding. They are not real exam questions, exam dumps, or copied from any provider.
- How should I use these practice questions?
- Answer each one, read the explanation (including why the wrong options are wrong), and use the per-domain score below to focus your revision on weak areas. Revisit before exam day.
- How many questions should I do before the exam?
- Enough to score consistently across every domain, alongside full-length practice from official or reputable providers. Understanding why each answer is right matters more than raw volume.
- What score means I am ready?
- A good signal is consistently scoring around 80% or higher across all domains on questions you have not seen before, and being able to explain why the wrong options are wrong.
- Should I use exam dumps?
- No. Dumps (real or leaked questions) breach provider policy, can void your certification, and do not build the understanding the exam actually tests.