Exam Information
Free practice questions with explanations
Salesforce Plat-Dev-301 Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 15
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Advanced Developer Fundamentals
A global consulting firm runs a Salesforce org where Opportunity Amount is stored in multiple currencies (multi-currency enabled). A developer writes an Apex method that sums opportunity values for a dashboard and compares them with a hard-coded threshold of 100000. Users in Japan report that totals are wrong when opportunities are in JPY. The firm needs the totals reported in the corporate currency (USD) with correct conversion at the current exchange rate, and the code must remain bulk-safe. Which change should the developer make?
Correct Answer: DExplanationIn a multi-currency org, Amount is stored in the record's own currency, so summing it directly mixes currencies. The SOQL convertCurrency() function (referenced in SOQL as convertCurrency(Amount) in aggregate expressions such as SUM(convertCurrency(Amount))) converts each value to the user's default currency at the current exchange rate, and it keeps the aggregation in the database, which is bulk-safe. Summing raw Amount and multiplying by a custom-setting rate ignores per-record rates. Dividing by ConversionRate from CurrencyType in a loop is inefficient and fails because CurrencyType does not hold the record's values in the required form. Calling convertCurrency() as an Apex method on individual records does not exist as a per-record method and would not aggregate efficiently.
-
2 Question 2 Single choice Performance
A retail company's Apex trigger on OrderItem updates a parent Order's total whenever line items change. During a nightly bulk load of 200,000 items, the trigger hits the 100 SOQL query limit and the load fails. The business requires that every line item change still updates the parent total within the same transaction, and that the load completes without custom bulk-load tooling. Which change best resolves the issue?
Correct Answer: DExplanationThe root cause is querying inside a loop or per-record, which consumes one SOQL query per iteration. Collecting parent Ids once, aggregating with a single GROUP BY query, and performing one DML update keeps the transaction within limits and remains synchronous, so the total is correct at commit. A @future method changes the timing of updates and is not a synchronous guarantee, and it still runs queries inside a loop if written naively. A Flow loop over OrderItems reproduces the per-record query pattern and will exceed limits at volume. Governor limits cannot be raised by a setting, and OFFSET paging does not reduce the number of queries within one trigger execution.
-
3 Question 3 Single choice Process Automation, Logic, and Integration
A financial services org has a record-triggered Flow on Account that updates a related Contact's status, and an Apex before-update trigger on Account that also modifies the same Contacts. After a deployment, the Contact status is sometimes overwritten with an unexpected value. The company must keep both automations, must not disable any existing logic, and needs a durable fix that gives a single owner for the Contact status decision. What should the developer do first?
Correct Answer: BExplanationSalesforce runs record-triggered Flows and Apex triggers within the same order of execution, so unplanned overwrites come from two automations setting the same field without a single owner. Mapping the execution sequence and consolidating the decision into one place, with the Flow calling an invocable Apex method, meets the requirement that existing logic is kept and gives one owner. A static Boolean flag only prevents recursion within the Apex layer and does not control Flow-versus-trigger conflicts. Converting the Flow to Apex discards declarative logic the company wants to keep and does not by itself assign ownership. Changing the Flow to run in system context does not change which automation writes last.
-
4 Question 4 Single choice Testing, Debugging, and Deployment
A developer's Apex test class for a Stripe-like payment callout service must verify retry behavior without contacting the external endpoint. The test currently fails with a CalloutException because the code under test performs an HTTP callout. The team wants the test to run in a sandbox and in production deployments without network access and without changing the production service signature. Which technique should the developer apply?
Correct Answer: CExplanationApex provides HttpCalloutMock with Test.setMock, which lets tests register a mock response for HTTP callouts and verify behavior without network access; Test.startTest and Test.stopTest give the callout a fresh governor context. This keeps the production service signature unchanged. A Test.isRunningTest() branch puts test-only logic in production code and skips the real path being tested. SeeAllData=true depends on org data and an external network, which fails in production deployments. Asserting that a CalloutException is thrown only proves the callout failed and does not verify retry behavior.
-
5 Question 5 Single choice User Interface
A field service Lightning web component displays a list of work orders fetched by an Apex method annotated with @AuraEnabled(cacheable=true). Technicians on mobile devices report that after they update a work order status through a separate imperative Apex call, the list does not refresh until they reload the page. The component must refresh the list after the update, remain performant on large lists, and keep the cacheable method. Which change best meets these requirements?
Correct Answer: DExplanationA wired method marked cacheable=true returns data from the Lightning Data Service or client cache, so a status change made through an imperative call will not appear until the wire is refreshed. Calling refreshApex with the wired result re-executes the method and updates the displayed data while keeping cacheable performance benefits. Removing cacheable changes the caching strategy and adds unnecessary server load on large lists. Recreating the child component is a heavy workaround that does not invalidate the cache. Cache timeout is not a component metadata setting, so that option does not exist.
-
6 Question 6 Single choice Advanced Developer Fundamentals
A healthcare company stores patient referral records in a custom object with an org-wide default of Private. A regional manager needs access to referrals owned by users in her region, but only for referrals flagged as active, and the access must be granted and revoked automatically by a nightly calculation based on a region field on the referral. Sharing rules based on criteria cannot express the region-plus-status logic cleanly. Which mechanism should the developer implement?
Correct Answer: DExplanationApex managed sharing lets developers programmatically write rows to the object's Share table using a custom Rowcause, which is the right tool when sharing depends on logic that declarative sharing cannot express, such as region combined with a changing status. Criteria-based sharing rules cannot combine these conditions with a nightly recalculation and they cannot revoke access per the custom rule. Granting Modify All Data gives far more access than required and violates least privilege. Sharing sets are a feature for Experience Cloud community users and do not apply to internal manager access on a custom object.
-
7 Question 7 Single choice Performance
A logistics company has an Apex batch job processing 3 million Shipment records to recalculate a risk score. The job's execute method queries child Package records one Shipment at a time inside the loop and calls a callout service for each package. Runs now take over 14 hours and frequently exceed the 100 callouts-per-transaction limit. The company must finish within a 4-hour window and cannot increase the external service's rate limit. Which change best improves performance?
Correct Answer: DExplanationQuerying all packages for the batch scope once and mapping them by Shipment Id removes the per-record SOQL pattern, and moving callouts into asynchronous work (Queueable) keeps each transaction within the callout limit while respecting the external rate limit that cannot change. Simply enlarging the scope still makes one callout per package and does not respect the callout cap. A synchronous Visualforce-driven controller cannot process 3 million records within a page transaction. Publishing platform events requires the external service to be a subscriber and changes the integration contract, which the scenario does not support.
-
8 Question 8 Single choice Process Automation, Logic, and Integration
A utilities company must notify an external billing system whenever a Service Request is closed. The billing system is only reachable on weekdays and can take up to 10 minutes to respond. The Service Request close action must not wait for the billing system, and a failed notification must be retried without losing the event. The team wants the integration to be decoupled from the transaction. Which approach should the developer implement?
Correct Answer: CExplanationPublishing a platform event from the trigger decouples the close transaction from the external system: the event is committed with the transaction, and subscribers process it asynchronously. Subscriber-side retry logic handles the weekday-only and slow endpoint without blocking the user. A synchronous callout from a trigger blocks the close action for up to 10 minutes and a savepoint rollback would undo the user's close. An @future method is not automatically re-queued on failure and does not guarantee delivery. Outbound messages fire on workflow rule criteria, lack built-in retry control for the stated constraint, and do not satisfy the decoupling requirement as cleanly.
-
9 Question 9 Single choice Testing, Debugging, and Deployment
A deployment through change sets to production fails. The Apex test class asserts that an account's billing country is reset by a trigger, but the test passes in a developer sandbox and fails in the production validation run with a message that the expected value was null. Logs show the trigger was skipped because a custom setting used to disable triggers was enabled in production. The team needs to identify the root cause and make the test reliable in every environment without changing the custom setting values in production. What should the developer do?
Correct Answer: CExplanationCustom settings in tests are not populated from the org's data, so a test that relies on the production value of a hierarchy or list custom setting is environment-dependent. Inserting the setting within the test and setting the disable flag explicitly makes the test deterministic in any org. SeeAllData=true does not solve the dependency and is discouraged. Deleting the assertion removes coverage of real behavior. Running tests in a full sandbox is not a reliable fix and still depends on the configuration present at that moment.
-
10 Question 10 Single choice User Interface
A company's Visualforce page lets sales reps submit a quote discount request. The page uses an action method that performs DML and then reloads the entire page, which is slow on a large quote with many line items. The company wants only the quote summary section to update after submission, without a full page reload, and wants any validation errors shown next to the field that caused them. Which approach best meets these needs?
Correct Answer: CExplanationVisualforce supports partial page refreshes through the reRender attribute on commandButton, commandLink, or actionFunction, so only the summary panel is replaced. Validation messages are shown through apex:message components tied to specific input fields, which keeps errors near the offending field. Setting immediate to true changes validation order, not refresh scope, and does not improve the reload behavior. Calling window.location.reload is a full page reload, which is the behavior the company wants removed. Injecting error text directly into the DOM bypasses the framework's error handling and breaks the component model.
-
11 Question 11 Single choice Performance
A developer reviews a Lightning web component that loads an account dashboard. The wired Apex method runs a SOQL query inside a for loop over Account records returned from an earlier query, and the component also re-runs the same query on every property change. The dashboard is slow for accounts with thousands of related Opportunity records. The developer must keep the data fresh within one minute and cannot exceed the 100 SOQL query limit per transaction. Which change best resolves the inefficiency?
Correct Answer: DExplanationA single SOQL query with a relationship subquery returns Accounts with their Opportunities in one round trip, removing the per-record query inside the loop and keeping the count within the 100-query limit. Keying the wire on the record Id stops unrelated property changes from re-triggering the query. Browser local storage would serve stale data beyond the one-minute freshness requirement and is not a platform data cache for this purpose. Fetching an unbounded list and filtering in JavaScript on every rerender is slower and can exceed heap and row limits. Database.getQueryLocator is for batch Apex and cannot be used to stream results to a wired component.
-
12 Question 12 Multiple choice Process Automation, Logic, and Integration
A developer is building an Apex trigger on Case that must keep a Case's related Account rating in sync and log failures without rolling back successful updates. Several Cases in the same batch may fail validation. The trigger must follow Apex trigger best practices and maintain transactional integrity for all other records. Which TWO actions should the developer take? (Choose two.)
Correct Answer: C, EExplanationA single trigger per object that delegates to a handler, with no SOQL or DML inside loops, is the standard trigger best practice that keeps governor limits safe and logic maintainable. Database.update with allOrNone set to false processes the valid records and returns SaveResult objects, which let the developer log each failure without a full rollback. A try-catch around each DML inside a loop still creates a DML statement per record and is inefficient. Rethrowing the exception rolls back all updates, which violates the requirement. A savepoint per record followed by a full rollback on any failure undoes successful work and breaks transactional integrity for the other records.
-
13 Question 13 Multiple choice Testing, Debugging, and Deployment
A developer's Apex unit test for a class that calls an external service and writes results to a custom object fails intermittently in a shared sandbox. Investigation shows the test depends on existing records and on the order of asynchronous job completion. The team wants to isolate the root cause and make the test deterministic in every environment and in source-driven deployments. Which TWO actions should the developer take? (Choose two.)
Correct Answer: C, EExplanationCreating test data inside the test ensures the test does not depend on org state that differs between sandboxes and production, which removes the source of intermittent failures. Test.startTest and Test.stopTest force asynchronous work such as Queueable or future jobs to execute before Test.stopTest returns, making the assertions deterministic. SeeAllData=true reintroduces the dependency on org data. Thread.sleep is not supported in Apex and would not solve the problem. API version has no effect on asynchronous job execution timing in tests.
-
14 Question 14 Multiple choice User Interface
A team is building a Lightning web component to display a product catalog on desktop and mobile. The layout must show a two-column grid on large screens and a single column on phones, and the component must communicate a selected product to a sibling component on the same page without coupling them directly. Which TWO implementations meet these requirements? (Choose two.)
Correct Answer: C, EExplanationSLDS responsive grid classes such as slds-large-size_1-of-2 and slds-small-size_1-of-1 let the same markup adapt across breakpoints, which is the platform-supported way to respond to form factor. Lightning Message Service is designed for communication between components that are not in a parent-child relationship, so it avoids coupling. A matchMedia check is a custom approach that works but is not the recommended responsive mechanism here, and bubbling events from a child do not reach a sibling. The FORM_FACTOR value provider is an Aura-only feature and its usage does not map to this LWC requirement.
-
15 Question 15 Multiple choice Advanced Developer Fundamentals
A company uses Custom Metadata Types to store routing rules and Custom Settings to store per-user feature toggles. The team plans to deploy these through source-driven development and needs changes to routing rules to be deployable without data loss in production. Which TWO statements describe correct best practices for these choices? (Choose two.)
Correct Answer: C, EExplanationCustom Metadata Type records are metadata, so they can be packaged and deployed through source-driven tools or change sets, which fits routing rules managed in source. Hierarchy Custom Settings support values at the org, profile, and user level, which suits per-user toggles. Custom Settings data is not deployed by change sets in the same way as metadata, so the claim that they always deploy with code is incorrect. Custom Metadata records cannot be created in test context as data that rolls back, because they are metadata and their DML behavior in tests is not the same as ordinary records. Apex can read Custom Metadata Types through the __mdt SOQL and the getInstance methods, so the claim that they cannot be referenced is false.
These are 15 of the 161 questions in the full Plat-Dev-301 pack.
Get All 161 QuestionsGet all 161 questions & answers
Full access options for Salesforce Plat-Dev-301
Self-study
PDF Version
- 161 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
- 161 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
- 161 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-301 Exam (Salesforce Certified Platform Developer II) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.