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 2026
Start practicing today and take the fast track to becoming Salesforce Salesforce-Platform-Developer-II certified.
21614 already prepared
Salesforce 2026 Release161 Questions
4.9/5.0
Which use case can be performed only by using asynchronous Apex?
A. Querying tens of thousands of records
B. Making a call to schedule a batch process to complete in the future
C. Calling a web service from an Apex trigger
D. Updating a record after the completion of an insert
Explanation:
To determine which use case can only be performed using asynchronous Apex in Salesforce, let's evaluate each option based on the nature of synchronous and asynchronous processing in Apex.
Asynchronous Apex refers to operations that are executed in the background, separate from the main transaction, allowing time-consuming tasks to run without delaying the user experience or hitting governor limits. Examples include Batch Apex, Queueable Apex, Scheduled Apex, and Future methods. Synchronous Apex, on the other hand, executes immediately within the current transaction, such as in triggers or standard controller actions.
Option A: Querying tens of thousands of records
In Salesforce, SOQL queries in a synchronous context can retrieve up to 50,000 records within a single transaction, subject to governor limits. For example, you can use a SOQL query in a trigger or Visualforce controller to fetch tens of thousands of records synchronously, as long as the limit isn't exceeded. However, if the dataset exceeds 50,000 records or requires processing that might hit other limits (e.g., CPU time), asynchronous methods like Batch Apex, which uses a QueryLocator, become necessary. Since querying tens of thousands of records (assuming within the 50,000 limit) can be done synchronously, this use case does not require asynchronous Apex.
Option B: Making a call to schedule a batch process to complete in the future
Scheduling a batch process to run at a future time involves using the System.schedule method or implementing the Schedulable interface in Apex. This allows you to define a job that executes at a specified time, such as running a batch process overnight. By definition, scheduling a task to occur later is an asynchronous operation—there’s no way to "schedule" something to run in the future within a synchronous context, as synchronous code executes immediately. Other mechanisms, like time-based workflows, can’t schedule Apex batch processes; they are limited to actions like field updates or emails. Thus, this use case can only be performed using asynchronous Apex.
Option C: Calling a web service from an Apex trigger
Apex triggers are synchronous by default, executing immediately before or after a database operation. You can make a synchronous web service callout from a trigger using HTTP classes (e.g., HttpRequest), provided the callout completes within the transaction’s governor limits (e.g., 10 seconds of callout time). However, because callouts can be slow or unreliable, best practices recommend using asynchronous Apex (e.g., a Future method or Queueable Apex) to handle them, avoiding delays in the trigger. Despite this, synchronous callouts are technically allowed and possible, so this use case does not require asynchronous Apex.
Option D: Updating a record after the completion of an insert
This is a common scenario handled by an after insert trigger. When a record is inserted, an after insert trigger can execute synchronously to update the same record or related records within the same transaction. For example:
trigger MyTrigger on Account (after insert) {
List
for (Account a : Trigger.new) {
a.Description = 'Updated after insert';
accountsToUpdate.add(a);
}
update accountsToUpdate;
}
This operation is immediate and synchronous, completing before the transaction ends. Asynchronous Apex isn’t needed, as the update can occur in real-time within the trigger.
Conclusion:
A: Can be done synchronously up to 50,000 records, so asynchronous Apex isn’t required.
B: Scheduling a future batch process is inherently asynchronous and cannot be done synchronously.
C: Web service callouts from triggers can be synchronous, though asynchronous is preferred.
D: Updating after an insert is a synchronous trigger operation.
The only use case that can only be performed using asynchronous Apex is B. Making a call to schedule a batch process to complete in the future.
Universal Containers is using a custom Salesforce application to manage customer support cases. The support team needs to collaborate with external partners to resolve certain cases. However, they want to control the visibility and access to the cases shared with the external partners. Which Salesforce feature can help achieve this requirement?
A. Role hierarchy
B. Criteria-based sharing rules
C. Apex managed sharing
D. Sharing sets
Explanation:
To manage customer support cases in a custom Salesforce application where the support team collaborates with external partners while controlling visibility and access, the solution must allow selective sharing with external users (e.g., partners) based on specific conditions. The feature should integrate with Salesforce's security model, support external access (e.g., via Community or Partner portals), and provide granular control over case sharing.
Correct Answer: C. Apex managed sharing
Option C, Apex managed sharing, is the appropriate feature. Apex managed sharing allows developers to programmatically share records, such as cases, with specific users or groups, including external partners, using custom logic. This is ideal for controlling visibility and access based on complex criteria (e.g., case type, priority, or partner role) that standard sharing rules might not handle. By writing Apex triggers or classes, Universal Containers can dynamically grant access to external partners via sharing rules, ensuring security and collaboration. This aligns with the Platform Developer II exam's focus on advanced security customization.
Incorrect Answer:
Option A: Role hierarchy
Option A, Role hierarchy, defines access based on an organization's internal user roles (e.g., managers vs. subordinates) and automatically grants access to records owned by users below in the hierarchy. However, it is designed for internal users and does not natively support sharing with external partners, such as those in a Community or Partner portal. While it can influence visibility, it lacks the flexibility to control access for external collaborators, making it unsuitable for this requirement.
Option B: Criteria-based sharing rules
Option B, Criteria-based sharing rules, allows sharing records with users or groups based on field values (e.g., case status or priority). While useful for internal sharing, it is limited to predefined criteria and does not directly support sharing with external partners unless they are part of a Community with specific profiles or roles. This feature lacks the dynamic, programmatic control needed to manage external partner access on a case-by-case basis, rendering it less effective here.
Option D: Sharing sets
Option D, Sharing sets, are used in Communities to grant access to records (e.g., cases) for Community users based on their profile and a common field (e.g., Account ID). While this can share cases with external partners in a Community, it provides broad access based on predefined rules rather than granular control per case or partner. It is less flexible for managing visibility and access dynamically, making it less suitable than Apex managed sharing for Universal Containers' specific collaboration needs.
Reference:
Salesforce Security and Sharing Guide: "Apex Managed Sharing".
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?
A. Batch Apex
B. Lightning web component
C. Screen Flow
D. Apex method that returns a Continuation object
D. Apex method that returns a Continuation object
Explanation:
The scenario requires collecting user inputs interactively and then making a long-running external web service callout as part of point-to-point integration. Continuations enable asynchronous long-running callouts (up to 120 seconds) without blocking the UI thread or hitting synchronous request limits, while a Lightning Web Component provides the interactive UI to gather the required inputs before invoking the callout.
✅ Correct Option:
✅ B. Lightning web component
An LWC can render input fields to collect key user data and then imperatively (or via wire) call an Apex method. It fully supports Continuations, allowing the UI to remain responsive while the long-running callout executes and the callback returns the response.
✅ D. Apex method that returns a Continuation object
Define an @AuraEnabled(continuation=true) method that creates a Continuation instance, adds the HttpRequest, sets the callback method, and returns the Continuation object. This pattern handles the long-running external call asynchronously and processes the response in the designated callback.
❌ Incorrect options:
❌ A. Batch Apex
Batch Apex is designed for asynchronous bulk data processing across large record sets. It cannot interactively collect end-user inputs in real time and is not suitable for a user-driven, point-to-point callout scenario that requires immediate UI feedback.
❌ C. Screen Flow
A Screen Flow can collect user inputs, but it does not natively support the Continuation pattern for long-running callouts in the same non-blocking UI manner. Callouts from Flow (or Apex actions invoked by Flow) remain subject to synchronous transaction limits and do not provide the Continuation-based asynchronous handling required here.
🔧 Reference:
→ Work with a Continuation in an Apex Class (Lightning Web Components Developer Guide – Salesforce Developers)
Confirms how to implement an Apex method that returns a Continuation object and invoke it from Lightning Web Components for long-running callouts.
A developer wrote an Apex class to make several callouts to an external system. If the URLs used in these callouts will change often, which feature should the developer use to minimize changes needed to the Apex class?
A. Session Id
B. Connected Apps
C. Named Credentials
D. Remote Site Settings
Explanation:
When developing Apex classes that perform callouts to external systems, it's best to decouple sensitive or frequently changing configuration values—like URLs, authentication details, etc.—from the Apex code itself. This improves maintainability, security, and deployment flexibility.
🔎 Why Named Credentials is Best:
Named Credentials is a Salesforce feature that allows developers to:
✔ Store the endpoint URL and authentication settings in one centralized place.
✔ Reference the named credential directly in Apex using callout: scheme (e.g., callout:My_Named_Credential).
✔ Avoid hardcoding the URL and authentication in Apex code.
✔ Easily update the URL or credentials without touching the code.
✔ Control access via profiles/permissions.
This is especially helpful when:
✔ The endpoint URL changes frequently.
✔ You want to promote code across environments without manual changes.
✔ Secure authentication (OAuth, Basic Auth) is required.
❌ Why Other Options Are Incorrect:
A. Session Id
➟ Used for authentication in some older integrations.
➟ Not related to changing endpoint URLs.
➟ Using session IDs in callouts is not secure and not a best practice.
B. Connected Apps
➟ Used to manage OAuth settings and access policies for apps integrating into Salesforce.
➟ Doesn’t help manage outbound callout URLs from Apex.
➟ Useful for inbound access (e.g., mobile apps), not outbound URL management.
D. Remote Site Settings
➟ Required to whitelist external URLs for callouts (mandatory unless using Named Credentials).
➟ Does not support dynamic endpoint management or authentication.
➟ Needs to be updated manually every time the endpoint changes.
➟ Not referenced in Apex code directly.
📚 Reference:
🔗 Named Credentials - Salesforce Docs
🔗 Remote Site Settings vs Named Credentials
Which code snippet processes records in the most memory efficient manner, avoiding governor limits such as "Apex heap size too large"?

A. Option A
B. Option B
C. Option C
D. Option D
Explanation:
Option A:
This approach queries all Opportunity records into a single List in memory at once. If there are many records (e.g., tens of thousands), this can easily exceed the heap size limit, leading to a "Apex heap size too large" error. This is not memory-efficient for large datasets.
Option B:
This uses a SOQL query directly in a for loop, which implicitly processes records in batches of 200 using Salesforce's iterative SOQL feature. This approach is more memory-efficient because it doesn't load all records into memory at once, staying within the governor limit of 200 records per iteration. This is a recommended practice for processing large datasets.
Option C:
Similar to Option A, this queries all Opportunity records into a Map in memory at once. While a Map might use slightly different memory structures, the total heap usage will still depend on the number of records. For large datasets, this will also risk exceeding the heap size limit, making it inefficient.
Option D:
This uses Database.query() to execute a dynamic SOQL query, but it still loads all records into a List in memory at once, just like Option A. The dynamic nature doesn't change the memory footprint, so it suffers from the same inefficiency and heap size risk as Option A.
Correct Answer: Option B
Explanation:
Option B is the most memory-efficient because it leverages Salesforce's iterative SOQL feature. When a SOQL query is used directly in a for loop (e.g., for (Opportunity opp : [SOQL])), Salesforce automatically processes the records in batches of 200, iterating over the result set without loading all records into memory simultaneously. This approach helps avoid the "Apex heap size too large" error by managing memory usage per iteration, making it suitable for handling large datasets within governor limits.
Key Considerations:
The heap size limit is enforced per execution context, and loading all records at once (as in Options A, C, and D) can quickly exceed this limit with large datasets.
Iterative SOQL (Option B) is a best practice recommended by Salesforce for bulk processing, as outlined in the Apex Developer Guide.
Reference:
Salesforce Apex Developer Guide: "SOQL and SOSL Queries" - Section on Iterative SOQL (available on Salesforce Help: Types of Procedural Loops
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
- Experienced Salesforce developers
- Technical consultants and architects
- Professionals aiming to showcase mastery in Apex, Visualforce, Lightning Web Components (LWC), and integrations
- 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
- 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.
- 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.