Courseiva

SF-PD2 · topic practice

Scenario practice questions

Practise Salesforce Certified Platform Developer II Scenario practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Editorial oversight:Johnson Ajibi· MSc IT Security, IEEE Senior Member
16 questionsDomain: Scenario

What the exam tests

What to know about Scenario

Scenario questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Scenario exam traps

  • ▸Answering from memory before reading the full scenario.
  • ▸Missing a constraint such as cost, availability, security, scope or command context.
  • ▸Choosing a broad answer when the question asks for the most specific fix.
  • ▸Ignoring why the wrong options are tempting.

Practice set

Scenario questions

16 questions · select your answer, then reveal the explanation

Question 1mediummultiple choice
Read the full Scenario explanation →

A developer is building a Lightning Web Component for a Lightning Experience app. The component contains a form with an <input> for a search term and a list of results. When the user types into the input, the component must call an Apex method that returns matching records. The developer observes that the Apex method is being invoked on every keystroke, causing excessive server calls. Which technique should the developer use to limit the number of Apex calls while still updating the results as the user types?

Question 2mediummultiple choice
Read the full Scenario explanation →

A developer is designing a solution where an external system must be notified in near real-time when a custom object record is created or updated. The external system exposes a REST endpoint that accepts JSON payloads. The solution must be scalable and minimize Salesforce governor limit consumption. Which approach is most appropriate?

Question 3mediummultiple choice
Read the full Scenario explanation →

A developer is building an Apex REST resource that must accept an inbound JSON payload from a third-party system. The payload contains a nested structure with a list of order line items, each having its own nested product object. The developer wants to deserialize the payload directly into typed Apex classes without writing manual parsing logic. Which approach should the developer use?

Question 4hardmultiple choice
Read the full Scenario explanation →

A developer is writing a unit test for an Apex service class that calls an external REST endpoint using HttpRequest and Http. The test needs to verify that the class correctly parses a successful JSON response and also handles a 500 error response. The class uses a named credential for authentication. Which approach should the developer use to test both scenarios without making real callouts?

Question 5mediummultiple choice
Read the full Scenario explanation →

A developer is writing a test class for an Apex trigger that creates a related record when an Account is inserted. The test must verify that the related record is created and that a validation rule prevents creation when the Account's AnnualRevenue is null. What is the best practice to ensure the test covers both scenarios?

Question 6mediummultiple choice
Read the full Scenario explanation →

A developer has a Lightning Web Component named accountTile that exposes a public property accountName decorated with @api. A parent Aura component includes accountTile using <c:accountTile accountName="Acme"/>. During testing, the account name never appears. The developer confirms the property is set in the LWC constructor. What is the cause?

Question 7mediummultiple choice
Read the full Scenario explanation →

A developer needs to write an Apex test class for a service that makes a callout to an external REST API. The test must simulate different HTTP response codes, including 200, 404, and 500. Which approach should the developer use to ensure the test covers all scenarios without making actual callouts?

Question 8mediummultiple choice
Read the full Scenario explanation →

A developer is building an Apex batch job that processes 50,000 Account records. The batch class uses `Database.executeBatch` with a batch size of 200. After running the job, the developer notices that the job takes significantly longer than expected and sometimes fails with `UNABLE_TO_LOCK_ROW` errors on the Account object. What is the most likely cause of the performance degradation?

Question 9mediummulti select
Read the full Scenario explanation →

A developer is deploying a new Lightning web component that calls an Apex controller method. The deployment to production fails because the Apex class is not covered by tests. The developer needs to ensure the Apex class meets the 75% test coverage requirement and that the tests are robust. Which two actions should the developer take to achieve this? (Choose two.)

Question 10easymultiple choice
Read the full Scenario explanation →

A developer is writing a test class for a service that performs a callout to an external web service. The developer needs to mock the callout response to test different scenarios without making actual HTTP requests. Which interface should the developer implement to mock the callout?

Question 11mediummultiple choice
Read the full Scenario explanation →

When designing a unit test for a class that makes callouts, which pattern is the industry standard for ensuring the test does not actually send requests?

Question 12hardmultiple choice
Read the full Scenario explanation →

Refer to the exhibit. A developer attempts a deployment using Salesforce CLI. The deployment fails with the circular dependency error shown. What is the root cause of this failure?

Exhibit

{
  "status": "failed",
  "errorCode": "CIRCULAR_DEPENDENCY_DETECTED",
  "message": "Apex Class A refers to Class B, and Class B refers to Class A.",
  "deployment_id": "0Af123456789"
}
Question 13mediummultiple choice
Read the full Scenario explanation →

A developer is writing a test class for an integration service. Which approach is required to test HTTP callouts without actually making a request to the external system?

Question 14mediummultiple choice
Read the full Scenario explanation →

During a deployment, a developer notices that existing Apex tests are failing, even though the new code changes are unrelated to the failing tests. What is the most likely cause?

Question 15mediummultiple choice
Read the full Scenario explanation →

A developer wants to use Platform Cache to improve the performance of a high-traffic Visualforce page that performs expensive SOQL queries and calculations. The data is specific to each user and should persist across multiple requests within the same session. Which type of cache should the developer use?

Question 16mediummultiple choice
Read the full Scenario explanation →

A developer is building a high-performance REST API integration. Which of the following is the most important practice for ensuring the integration handles high throughput?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Scenario sessions

Start a Scenario only practice session

Every question in these sessions is drawn from the Scenario domain — nothing else.

Related practice questions

Related SF-PD2 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the SF-PD2 exam test about Scenario?
Scenario questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Scenario questions in a focused session?
Yes — the session launcher on this page draws every question from the Scenario domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other SF-PD2 topics?
Use the topic links above to move to related areas, or go back to the SF-PD2 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the SF-PD2 exam covers. They are not copied from any real exam or dump site.