Exam Information
Free practice questions with explanations
Salesforce Plat-Dev-201 Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 14
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Developer Fundamentals
A retail company stores online orders in a custom object Order__c, with a master-detail relationship to Order_Line__c. The integration team loads orders nightly from an external ERP using an upsert keyed on the ERP order number. Some orders are re-sent with the same number, and the team wants the upsert to match existing records without creating duplicates. The ERP order number is unique and stable. The company is on a tight budget and wants to avoid additional licensed add-ons. Which action should the developer take to meet the requirement?
Correct Answer: BExplanationUpsert matches records using an external ID field, and the field must be marked as External ID and unique to prevent duplicates. A standard text field marked External ID and Unique works without extra licenses. A formula field cannot be used as an upsert key because formulas are not writable and cannot be external IDs. Putting the key on Order_Line__c is wrong because the orders themselves are being upserted. An auto-number field generates values in Salesforce, so it cannot carry the ERP's existing identifier.
-
2 Question 2 Single choice Process Automation and Logic
A developer has a before-insert trigger on Invoice__c that calls a utility class to set a default discount. A record-triggered flow on Invoice__c also updates the Discount__c field after the trigger runs. An administrator notices that for some records the discount ends up different from the value the flow sets, even though both run in the same transaction. The developer wants to understand which logic runs when, so they can predict the final value and avoid recursive updates. Which statement correctly describes the save order of execution for this scenario?
Correct Answer: AExplanationIn the save order of execution, system validation runs, then before-triggers, then the record is saved, then after-triggers and after-save flows run. Before-save record-triggered flows run alongside before-triggers in the before phase, and after-save flows run later, so the final value depends on which logic writes last. Option asserting flows run before triggers is wrong because before-save flows and before triggers are both in the before phase with flows ordered differently. After-save flows do not run before after-insert triggers in the documented order. Relying on an unspecified order with a static Boolean does not guarantee ordering and misuses recursion guards.
-
3 Question 3 Single choice Testing, Debugging, and Deployment
A team deploys an Apex trigger on Case that calls a queueable job to recalculate SLA dates. Their unit test inserts 200 cases in one call and asserts that all SLA dates were calculated. The test passes locally, but in a production deployment the code coverage is adequate and the assertion fails intermittently because the queueable job has not finished when the assertion runs. The team must keep the test fast and must not change production behavior. Which change best fixes the test?
Correct Answer: BExplanationTest.startTest() and Test.stopTest() give asynchronous work started between them its own governor limits and force it to complete synchronously before stopTest returns, so assertions after stopTest see the results. Thread.sleep is not supported in Apex, and an arbitrary delay is unreliable anyway. A separate test method would not guarantee the queueable finished, since each test method runs in its own context. SeeAllData=true makes tests depend on org data, which is discouraged and fragile.
-
4 Question 4 Single choice User Interface
A Lightning Web Component on an account record page displays a list of contacts and lets users edit the phone number inline. The component calls an Apex method annotated with @AuraEnabled(cacheable=true) that returns contacts, and a second Apex method that updates contacts. After an inline update, the list still shows the old phone number until the page is refreshed. The developer must keep the implementation simple and must not introduce a separate client-side store. Which change correctly resolves the stale data problem?
Correct Answer: AExplanationA cacheable wire result is not updated when a non-cacheable imperative or DML call changes data, so the component must explicitly refresh the wired data with refreshApex on the stored wire result. Marking the update method cacheable is wrong because cacheable methods must not perform DML. Reloading the whole page is heavy and is not the component-level fix requested. Using localStorage adds a separate client-side store, which the requirement excludes.
-
5 Question 5 Single choice Developer Fundamentals
A financial services company needs to show, on each Account page, the total of Opportunity Amount values for closed-won opportunities. Account has a lookup to a parent account. The team wants the total to update immediately whenever an opportunity is closed, and they do not want custom code that adds to the platform's transaction workload unnecessarily. The org is licensed for standard Salesforce and no managed packages are allowed. Which approach is the most appropriate?
Correct Answer: BExplanationRoll-up summary fields are declarative and recalculate when child records change, but they exist only on master-detail relationships. Here the team needs to roll up Opportunities to Account, which is the standard master-detail parent for Opportunity, so a roll-up summary with a filter on the stage works. A cross-object formula cannot aggregate many child records. A nightly batch job does not update immediately and adds custom code. A roll-up on Opportunity itself makes no sense because it has no child records to aggregate.
-
6 Question 6 Single choice Process Automation and Logic
A developer writes an Apex class that processes a list of Order__c records. Inside a for loop over the list, the code runs a SOQL query to get the related Order_Item__c records for each order and then runs an update statement for each order. A batch of 300 orders in a bulk trigger context causes a LimitException. The developer must redesign the logic so the code stays within governor limits while preserving the same business behavior. Which design best meets the requirement?
Correct Answer: AExplanationRunning SOQL and DML inside loops is the classic cause of the 100 SOQL queries and 150 DML statements limits. Collecting the IDs, querying all child records once, grouping them in a map by parent ID, and then issuing one bulk DML statement keeps the transaction within limits. Calling a helper per order still runs SOQL per iteration. Chunking within one transaction does not reset governor counters. Swapping update for upsert still performs DML inside the loop.
-
7 Question 7 Single choice Testing, Debugging, and Deployment
A company deploys Apex and Lightning components from a scratch org built with Salesforce DX to a production org using a source-driven pipeline. The deployment fails with a message that a referenced custom field does not exist in the target org, even though the field is in the source project. The developer confirms the field metadata file exists in the project's force-app directory. The company requires that production deployments run all local tests and that the pipeline does not use any unsupported org-level workarounds. What should the developer do FIRST to diagnose the problem?
Correct Answer: AExplanationIn Salesforce DX, only metadata under a package directory listed in sfdx-project.json is included when converting or deploying source, so a field file sitting outside a declared directory can be missing from the deployment even though it exists in the project. Checking this is the first diagnostic step. Recreating the scratch org addresses a different problem and does not explain production behavior. NoTestRun is not permitted for production deployments under the company rule. Manually creating the field is an unsupported org-level workaround that the requirement excludes.
-
8 Question 8 Single choice User Interface
A company has an Experience Cloud site where external customers view their own cases through a Lightning Web Component that calls an Apex method returning Case records. The method is declared with with sharing and uses a SOQL query built from a string parameter that the component passes in from the URL. Security review flags the method as vulnerable to SOQL injection and to exposure of other customers' cases. The developer must keep the component's behavior unchanged and fix both issues without granting users additional object permissions. Which change best meets all requirements?
Correct Answer: BExplanationA bind variable in static SOQL removes injection risk entirely, and filtering by the running user's account or contact ties results to that user's own records, which addresses exposure. The with sharing keyword enforces record-level sharing rules for the guest or portal user. Escaping quotes reduces but does not eliminate injection risk and does not address record exposure. Switching to without sharing would expose more data. Filtering in JavaScript is client-side and cannot enforce security.
-
9 Question 9 Multiple choice Process Automation and Logic
A developer is writing an Apex trigger on Contact that must avoid infinite recursion when a contact update fires an update on a related Account, which in turn updates its child contacts again. The developer decides on a design that prevents repeated execution within one transaction without blocking legitimate later updates. Which TWO design choices meet these requirements? (Choose two.)
Correct Answer: A, DExplanationStatic variables persist for the duration of one transaction, so a static flag or a static set of processed IDs prevents a second pass through the same logic while still allowing new records in the same transaction to be processed. A non-static instance variable is recreated on each handler instance and does not persist across the recursive call. Removing the trigger for a flow ignores recursion control and does not solve the design problem. Keying the guard on the list size is unreliable because different records can share the same size.
-
10 Question 10 Single choice Developer Fundamentals
A healthcare company is designing a custom object Patient_Visit__c that must be linked to two different parent objects, Patient__c and Clinic__c. Each visit record must always belong to exactly one patient, and records must be deleted when the patient is deleted. The team wants to report on visits per clinic using rollups as well. The data model must be defined before the team builds Apex and Lightning components. Which relationship design should the developer choose for the Patient_Visit__c object?
Correct Answer: DExplanationA master-detail relationship enforces that the child record always has a parent and cascades deletion from the patient, which satisfies both the mandatory parent and deletion requirements. A custom object can have only one master-detail relationship in the standard sense requested here, while additional relationships are lookups, which still permits rollups from the master side only where applicable. Two lookups with a validation rule do not cascade delete. Making both relationships master-detail would be a junction, which is inappropriate because a visit belongs to one clinic and one patient, not many. Hierarchical relationships apply only to the User object, so this option is invalid.
-
11 Question 11 Single choice Testing, Debugging, and Deployment
A developer must debug intermittent failures in an asynchronous Apex batch job that processes 2 million records overnight in production. The team cannot reproduce the error in a sandbox, and the company's policy forbids enabling verbose logging for all users on production. The developer needs to see which records fail and why without changing the job's business logic and without a long-running manual process. Which approach best meets the requirements?
Correct Answer: DExplanationWriting failure details to a custom log object from within the batch's execute method captures per-record errors across all 2 million records without relying on debug logs, which can be truncated and are subject to size limits. The Apex Jobs page shows job status and failure counts but not per-record reasons. Enabling FINEST logs for an entire night conflicts with the policy and risks truncation. Running manually in the Developer Console is not practical for a 2-million-record overnight job. Changing batch size to 1 changes the job's execution pattern and does not provide per-record diagnostics.
-
12 Question 12 Single choice User Interface
A company is building a Flow screen that collects customer address details and calls an Apex invocable method to validate the address against an external service. The screen must show a custom Lightning component for the address picker and must pass the chosen address back into the flow. The developer must make the custom component work inside Flow with the least custom wiring and without using Visualforce. Which implementation is most appropriate?
Correct Answer: DExplanationLightning web components can be used in Flow by adding the lightning__FlowScreen target in the meta XML and exposing public properties with @api, which Flow binds as input and output values. Visualforce is explicitly excluded by the requirement. An Aura application event is not the supported mechanism for binding values to a flow variable. Storing the address in a custom setting for the next screen is a poor design and does not provide a picker component within the screen.
-
13 Question 13 Multiple choice Process Automation and Logic
A developer is reviewing a class that calls an external web service from inside a trigger when Invoice__c records are inserted. The trigger must not block the save and must not exceed callout limits. The business requires that a callout failure is recorded so support can retry it later, and that the same record is not processed twice even if the trigger fires again. Which TWO changes meet these requirements? (Choose two.)
Correct Answer: A, EExplanationA queueable job runs asynchronously after the save, so the callout does not block the transaction, and passing record IDs avoids serializing sObjects, which is not allowed for future and queueable parameter types in the expected pattern. Catching the failure inside the job and recording a retry record gives support a durable way to reprocess it. A synchronous callout inside the trigger can still block and is unsafe if the callout throws uncaught. A future method with an sObject list parameter is not permitted because sObjects cannot be passed as future parameters. A callout in a before-insert trigger runs in the same transaction and the record does not yet have an ID, so this cannot reliably protect against repeats.
-
14 Question 14 Single choice Developer Fundamentals
An insurance company stores claims in a custom object Claim__c and must find the claim matching a claim number supplied by an external system. The external system sends claim numbers that are not unique across regions, but the combination of region code and claim number is unique. The team needs an upsert integration that uses an external ID and wants to keep the data model simple. Which design is the best choice?
Correct Answer: DExplanationA single text field that stores the combined key and is marked as External ID and Unique gives the upsert a single key that matches the true uniqueness rule, and it is writable by the integration. A claim-number-only external ID would fail to distinguish records across regions. A formula field cannot serve as an upsert key because formula fields are read-only. Salesforce upsert accepts a single external ID field per call, so the two-field composite option is not supported.
These are 14 of the 204 questions in the full Plat-Dev-201 pack.
Get All 204 QuestionsGet all 204 questions & answers
Full access options for Salesforce Plat-Dev-201
Self-study
PDF Version
- 204 actual exam questions
- Compatible with all devices
- Printable PDF format
- No download limits
- 90 days free updates
- 24/7 customer support
Best value
Bundle Pack
- Discounted PDF + online access
- 204 actual exam questions
- Both PDF and online practice test
- Free 90 days updates
- No download or practice limits
- 24/7 customer support
Exam simulation
Online Practice Test
- 204 actual exam questions
- Actual exam environment
- 90 days free updates
- Browser-based software
- 24/7 customer support
100% Money Back Guarantee
Your success comes first
At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the Plat-Dev-201 Exam (Salesforce Certified Platform Developer) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.