Salesforce-Platform-Developer-II Exam Questions With Explanations

The best Salesforce-Platform-Developer-II practice exam questions with research based explanations of each question will help you Prepare & Pass the exam!

Over 15K Students have given a five star review to SalesforceKing

Why choose our Practice Test

By familiarizing yourself with the Salesforce-Platform-Developer-II exam format and question types, you can reduce test-day anxiety and improve your overall performance.

Up-to-date Content

Ensure you're studying with the latest exam objectives and content.

Unlimited Retakes

We offer unlimited retakes, ensuring you'll prepare each questions properly.

Realistic Exam Questions

Experience exam-like questions designed to mirror the actual Salesforce-Platform-Developer-II test.

Targeted Learning

Detailed explanations help you understand the reasoning behind correct and incorrect answers.

Increased Confidence

The more you practice, the more confident you will become in your knowledge to pass the exam.

Study whenever you want, from any place in the world.

Salesforce Salesforce-Platform-Developer-II Exam Sample Questions 2025

Start practicing today and take the fast track to becoming Salesforce Salesforce-Platform-Developer-II certified.

22024 already prepared
Salesforce Spring 25 Release
202 Questions
4.9/5.0

As part of point-to-point integration, a developer must call an external web service which, due to high demand, takes a long time to provide a response. As part of the request, the developer must collect key Inputs from the end user before making the callout. Which two elements should the developer use to Implement these business requirements?
(Choose 2 answers)

A. Lightning web component

B. Apex method that returns a Continuation object

C. Screen Flow

D. Process Builder

A.   Lightning web component
B.   Apex method that returns a Continuation object

Explanation:

To implement a point-to-point integration where a developer must call an external web service that takes a long time to respond, while collecting key inputs from the end user before making the callout, the solution must handle both user interaction and the asynchronous nature of the long-running callout. The approach should align with Salesforce’s capabilities for user interface design and callout management. Let’s evaluate the options based on their suitability for these business requirements.

Key Considerations:
➡️ The external web service’s long response time requires an asynchronous callout mechanism to avoid exceeding Salesforce’s synchronous callout limit (10 seconds).
➡️ User input collection suggests a front-end interface where the end user provides key inputs before the callout is initiated.
➡️ The solution should integrate seamlessly within Salesforce, likely via a Lightning-based interface.

Evaluation of Options:

A. Lightning web component
A Lightning Web Component (LWC) provides a modern, customizable user interface for collecting key inputs from the end user (e.g., via lightning-input fields). It can be embedded in a Lightning page or app and paired with an Apex method to handle the callout. While LWC itself does not manage long-running callouts, it can initiate them asynchronously, making it a suitable front-end element for user interaction. This is a strong candidate for the first element.

B. Apex method that returns a Continuation object
The Continuation class in Apex supports long-running callouts by allowing asynchronous HTTP requests with a timeout of up to 120 seconds, far exceeding the synchronous limit. An Apex method annotated with @AuraEnabled and returning a Continuation object can be called from a Lightning component, initiating the callout and providing a callback mechanism to handle the response. This is the ideal backend solution for managing the long response time, making it a strong candidate for the second element.

C. Screen Flow
A Screen Flow provides a guided, interactive interface to collect user inputs through screens, which could be used to gather the key inputs. However, Flows are not designed to handle long-running callouts directly; they can invoke Apex, but the callout logic would still need to be managed asynchronously (e.g., via Continuation or Queueable). While feasible, this approach adds complexity compared to a dedicated LWC, and Flows are better suited for process automation rather than custom integration logic, making it less optimal.

D. Process Builder
Process Builder is a declarative tool for automating business processes based on record changes. It cannot collect user inputs in real-time or handle long-running callouts, as it lacks interactive screens and callout capabilities beyond synchronous limits. This option is unsuitable for both requirements (user input collection and long-running callouts).

Correct Answers: A. Lightning web component and B. Apex method that returns a Continuation object
A Lightning Web Component is the optimal front-end element to collect key inputs from the end user, providing a responsive and customizable interface. An Apex method returning a Continuation object is the recommended backend solution to manage the long-running callout, allowing the system to wait for the external web service’s response without hitting governor limits. Together, the LWC can gather inputs, pass them to the Apex method, and handle the asynchronous response, aligning with the Salesforce Platform Developer II exam’s “User Interface” and “Integration” domains.

Reference:
Salesforce LWC Developer Guide - Lightning Web Components, Salesforce Apex Developer Guide - Continuation Class.

Additional Notes:
To implement, create an LWC with input fields to collect user data, use an @wire or imperative Apex call to invoke the Continuation-based method (e.g., @AuraEnabled(continuation=true)), and define a callback in the LWC to process the response. The Apex method would set up the HttpRequest, return a Continuation object with a timeout, and update the record or UI upon response. This ensures a seamless user experience despite the long response time.

A developer sees test failures in the sandbox but not in production. No code or metadata changes have been actively made to either environment since the sandbox was created. Which consideration should be checked to resolve the issue?

A. Ensure that Disable Parallel Apex Testing Is unchecked.

B. Ensure test classes are using SeeAllData = true.

C. Ensure the sandbox Is on the same release as production.

D. Ensure the Apex classes are on the same API version.

C.   Ensure the sandbox Is on the same release as production.

Explanation:

To resolve the issue of test failures occurring in the sandbox but not in production, with no code or metadata changes since the sandbox was created, we need to identify factors that could cause differences in test execution behavior between the two environments. Let’s evaluate the options systematically.

❌ A. Ensure that Disable Parallel Apex Testing is unchecked.
Disabling parallel Apex testing in a sandbox can cause tests to run sequentially rather than concurrently, which might reveal issues related to test data dependencies or governor limits that don’t appear in production, where parallel testing is typically enabled. However, this setting alone is unlikely to cause test failures if no code or metadata changes have occurred, as the test execution logic should remain consistent unless data or configuration differences are at play. This option is less likely to be the root cause without additional context about test dependencies.
➝ Reference: Salesforce Help - Apex Test Execution Options.

❌ B. Ensure test classes are using SeeAllData = true.
Using SeeAllData = true allows test classes to access all data in the org, which can lead to inconsistent test results if the sandbox and production environments have different data sets. For example, if a test relies on specific data that exists in production but not in the sandbox (or vice versa), it could fail in the sandbox. However, best practices discourage using SeeAllData = true unless necessary, and it’s not a default setting that would change without code modifications. Since no code changes have occurred, this is unlikely to be the cause unless the tests were already configured this way and data differences exist.
➝ Reference: Salesforce Apex Developer Guide - Testing with SeeAllData.

✅ C. Ensure the sandbox is on the same release as production.
Salesforce releases (e.g., Winter, Spring, Summer) can introduce changes to platform behavior, such as updates to Apex runtime, governor limits, or standard object behavior. If the sandbox is on a newer release (e.g., a preview sandbox) compared to production, tests that pass in production might fail in the sandbox due to differences in how the platform processes logic, even with identical code and metadata. For instance, a new release might enforce stricter validations or change default behaviors, causing test failures. Since no code or metadata changes have occurred, a release version mismatch is a strong candidate for the issue.
➝ Reference: Salesforce Help - Sandbox Preview Guide.

❌ D. Ensure the Apex classes are on the same API version.
The API version of Apex classes determines how the platform interprets the code, as newer API versions may include changes to functionality, deprecations, or stricter enforcement of rules. However, since the question specifies that no code or metadata changes have been made since the sandbox was created, the API versions of Apex classes in both environments should be identical. This makes this option less relevant unless an external process (e.g., a Salesforce update) altered the API version behavior, which is unlikely without explicit changes.
➝ Reference: Salesforce Apex Developer Guide - API Versioning.

✅ Correct Answer: C. Ensure the sandbox is on the same release as production.
Reason: A mismatch in release versions between the sandbox and production is the most likely cause of test failures when no code or metadata changes have been made. Salesforce releases can introduce subtle differences in platform behavior, affecting test outcomes. For example, a sandbox on a preview release (e.g., Summer ’25) might exhibit different behavior than production (e.g., Spring ’25), causing tests to fail due to changes in validation rules, Apex execution, or system logic. Checking and aligning the release versions by refreshing the sandbox or ensuring it matches production’s release is a critical step to resolve the issue.

Additional Notes: This question aligns with the Salesforce Platform Developer II exam’s focus on “Testing” and “Environment Management.” To verify the release version, check Setup > Company Information in both environments or consult the Salesforce Trust site for release schedules. If the sandbox is on a preview release, consider refreshing it to align with production or running tests in a non-preview sandbox.

Universal Containers is leading a development team that follows the source-driven development approach in Salesforce. As part of their continuous integration and delivery (CL/CD) process, they need to automatically deploy changes to multiple environments, including sandbox and production. ‘Which mechanism or tool would best support their CI/CD pipeline in source-driven development?

A. Salesforce CLI with Salesforce DX

B. Salesforce Extensions for Visual Studio Code

C. Change Sets

D. Ant Migration Tool

A.   Salesforce CLI with Salesforce DX

Explanation:

In a source-driven development model, the development team manages their Salesforce code and metadata in a version control system (like Git) and automates deployments through a CI/CD pipeline. The key requirement here is the ability to automatically deploy changes across multiple environments, which includes sandbox and production. This level of automation and control is best supported by tools that integrate well with version control and provide command-line capabilities for scripting deployments.

✅ A. Salesforce CLI with Salesforce DX is the best option here. Salesforce CLI (sfdx) combined with Salesforce DX enables robust support for source-driven development and continuous integration. It provides commands to retrieve and deploy metadata, manage scratch orgs and sandboxes, run tests, and integrate with CI servers like Jenkins, GitHub Actions, or Azure DevOps. Because it's designed for automation and scriptability, it fits perfectly into CI/CD pipelines and supports best practices like modular deployments and test automation.

❌ B. Salesforce Extensions for Visual Studio Code is a powerful developer tool but is primarily intended for local development. While it provides integration with Salesforce DX, it’s not optimized for automation in CI/CD pipelines. It’s more suitable for developers writing and debugging code rather than for automated deployment across environments.

❌ C. Change Sets are a traditional point-and-click deployment mechanism in Salesforce. While they work for moving changes between orgs, they are manual and not suitable for automation, which disqualifies them from meeting CI/CD needs in a source-driven approach. They also lack version control integration and don’t support advanced scripting or test automation.

❌ D. Ant Migration Tool is an older tool that provides command-line deployment capabilities. Although it can be scripted and supports some automation, it does not support the modern source-tracked development model that Salesforce DX does. It lacks the newer capabilities introduced with Salesforce DX, such as scratch orgs, unlocked packages, and improved metadata handling.

✅ Correct Answer: A. Salesforce CLI with Salesforce DX

Reference:
Salesforce Developer Guide: Salesforce DX Developer Guide
Trailhead: CI/CD for Salesforce

A developer is creating a Lightning web component to display a calendar. The component will be used in multiple countries. In some locales, the first day of the week is a Monday, or a Saturday, or a Sunday. ‘What should the developer do to ensure the calendar displays accurately for users in every locale?

A. Query the FirstDayofweek field from the Locale for the current user.

B. Import the @salesforce/i18n module and use the firstdayofweek internationalization property.

C. Use a custom metadata type to store key/value pairs.

D. Use UserInfo.getLocale() in the component.

B.   Import the @salesforce/i18n module and use the firstdayofweek internationalization property.

Explanation:

A developer is building a Lightning Web Component (LWC) that displays a calendar UI. Because the component is used in multiple countries, the first day of the week (Sunday, Monday, or Saturday) must adapt to the user’s locale. The goal is to ensure correct behavior across regions, without hardcoding or manual configuration.

✅ B. Import the @salesforce/i18n module and use the firstDayOfWeek internationalization property
This is the recommended and native approach provided by Salesforce for locale-sensitive values. The @salesforce/i18n module exposes locale-aware values like:
🧩 locale
🧩 timezone
🧩 currency
🧩 decimalSeparator
🧩 firstDayOfWeek
The firstDayOfWeek property automatically reflects the correct day (e.g., 0 for Sunday, 1 for Monday, etc.) based on the current user’s locale (e.g., en_US, fr_FR). This allows the calendar to dynamically adjust without extra configuration or logic.
This method ensures internationalization (i18n) support is consistent and future-proof across components.

❌ A. Query the FirstDayofWeek field from the Locale for the current user
There is no direct field like FirstDayOfWeek exposed in any standard object or the User object. Salesforce does not allow querying locale-specific calendar settings through SOQL or Apex in this way.
Even if locale is stored (e.g., User.LocaleSidKey), it doesn’t provide granular calendar preferences. Attempting to query this is not supported and not possible in Lightning Web Components directly.

❌ C. Use a custom metadata type to store key/value pairs
While custom metadata can be used to define locale-based settings manually (e.g., Locale: en_US → FirstDay: Sunday), this is not scalable and adds manual maintenance.
It lacks the dynamic nature of the @salesforce/i18n module. If a company adds a new locale or if a user changes their locale, the metadata would need to be updated, which introduces risk and technical debt.
This might be viable only in very custom, static cases, but is a poor choice for a dynamic, globally used component.

❌ D. Use UserInfo.getLocale() in the component
The UserInfo.getLocale() method is only available in Apex, not in Lightning Web Components (JavaScript). Therefore, it cannot be used directly inside the LWC controller.
Even if this locale value could be passed from Apex to the component, you would still need extra logic to map it to the correct first day of the week, which is redundant because Salesforce already provides this via @salesforce/i18n.firstDayOfWeek.

✅ Final Answer:
B. Import the @salesforce/i18n module and use the firstDayOfWeek internationalization property
This is the cleanest, most scalable, and Salesforce-recommended way to respect locale-specific calendar settings in Lightning Web Components.

📚 Reference:
LWC Internationalization
@salesforce/i18n module API

What is the optimal way to fix this?

A. Option A

B. Option B

C. Option C

D. Option D

C.   Option C

Explanation:

To ensure Apex tests properly handle HTTP callouts, Salesforce requires the use of mocking and test boundaries to avoid actual HTTP requests during test execution. The CalloutUtil.sendAccountUpdate method likely contains a callout, and test methods cannot perform real callouts without mocking. Therefore, the optimal solution must involve Test.setMock(), along with Test.startTest() and Test.stopTest() to properly scope the test execution context.

✅ Correct Answer: C. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
This is the correct and optimal approach because it includes everything required for a valid test of a method that performs a callout. Test.setMock() ensures the callout is simulated using a mock response. Placing Test.startTest() before the callout ensures governor limits are reset for accurate testing. Test.stopTest() is necessary after the callout to force the callout to run and return the mocked result. This full structure ensures a proper and complete test of callout functionality.

❌ Option A: Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.
This approach is partially correct but flawed in terms of ordering. It incorrectly places Test.setMock() after the callout, which defeats its purpose. The mock must be set before the method under test executes the callout; otherwise, the test will fail with a System.CalloutException.

❌ Option B: Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.
This is a common but bad practice. Wrapping logic in if (!Test.isRunningTest()) is used to bypass callouts during tests, but it also prevents the test from actually exercising the callout logic. This results in incomplete coverage, failing to validate that the method works correctly under test conditions. It’s a workaround, not a valid test strategy.

❌ Option D: Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.
This is missing the critical step of Test.setMock(), which is mandatory when testing methods that perform HTTP callouts. Without the mock, even with startTest() and stopTest(), the test will fail with a CalloutException because the callout is not simulated.

📚 Reference:
Salesforce Developer Guide – Test.setMock()
Apex Testing Callouts Best Practices
Salesforce Trailhead – Test Apex Callouts

Prep Smart, Pass Easy Your Success Starts Here!

Transform Your Test Prep with Realistic Salesforce-Platform-Developer-II Exam Questions That Build Confidence and Drive Success!

Frequently Asked Questions

The Salesforce Platform Developer II certification validates advanced knowledge in Apex, Lightning components, integration patterns, and deployment. It’s designed for developers with hands-on experience building scalable business applications on the Salesforce Platform.
  • Experienced Salesforce developers
  • Technical consultants and architects
  • Professionals aiming to showcase mastery in Apex, Visualforce, Lightning Web Components (LWC), and integrations
You must first hold the Salesforce Platform Developer I certification. Salesforce recommends 2–3 years of development experience on the platform before attempting PDII.
  • Questions: 60 multiple-choice/multiple-select
  • Time: 120 minutes
  • Passing Score: ~70%
  • Cost: USD $200 (plus taxes)
  • Delivery: Online proctored or Pearson VUE test center
  • Advanced Apex programming (asynchronous operations, exception handling)
  • Security & sharing model considerations
  • Integration techniques (REST, SOAP, external services)
  • Testing & debugging
  • Deployment & packaging best practices
Yes. Expect scenario-based questions that test your problem-solving and coding ability, including debugging, refactoring code, and recommending the best architectural approach.
  • Retake after 1 day for the first attempt
  • Retake after 14 days for further attempts
  • Maximum of 3 attempts per release cycle
  • Platform Developer I (PDI): Focuses on core Apex, SOQL, and declarative development.
  • Platform Developer II (PDII): Tests advanced coding, performance, architecture, and integration skills.
  • REST: Lightweight, modern, mobile/web integrations.
  • SOAP: Legacy or when strict contract/WSDL is required.
  • Platform Events: Real-time, event-driven architecture.
  • Change Data Capture (CDC): Sync Salesforce data with external systems automatically.
In the exam, pick the method that balances governor limits, scalability, and reliability.
  • Writing test classes with >75% coverage that assert actual outcomes.
  • Using dependency injection, stubs, and mocks for isolation.
  • Knowing when to use Unlocked Packages, Change Sets, or SFDX CLI.
  • In practice exams, review every “deployment” question twice — they’re often scenario-based and easy to misread.
  • Update LinkedIn and resume with “Salesforce Platform Developer II Certified” — highly valued by employers.
  • Join Salesforce Developer Community Groups to network.
  • Contribute to open-source Salesforce projects or blogs — recruiters notice active contributors.