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

Universal Containers decided to use Salesforce to manage a new hire interview process. A custom object called Candidate was created with organization-wide defaults set to Private. A lookup on the Candidate object sets an employee as an Interviewer. What should be used to automatically give Read access to the record when the lookup field is set to the Interviewer user?

A. The record can be shared using an Apex class.

B. The record can be shared using a permission set.

C. The record can be shared using a sharing rule.

D. The record cannot he shared with the current setup

C.   The record can be shared using a sharing rule.

Explanation:

Universal Containers has set the organization-wide defaults (OWD) for the custom Candidate object to Private, meaning only the record owner and users with higher access (e.g., via roles, sharing rules, or manual sharing) can view the records. A lookup field on the Candidate object links to an Employee (assumed to be a User record) as an Interviewer. The requirement is to automatically grant Read access to the Candidate record when the Interviewer lookup field is set to a specific user. Let’s evaluate the options:

Option A: The record can be shared using an Apex class. While Apex can be used to create sharing records (e.g., via the CandidateShare object for a custom object), this approach requires custom code to detect when the Interviewer lookup field is updated and programmatically insert a sharing record. This is not an automatic, declarative solution and involves manual development, testing, and maintenance. It is less efficient than using built-in Salesforce features like sharing rules.

Option B: The record can be shared using a permission set. Permission sets grant additional permissions to users, such as object-level access (e.g., Read, Create) or field-level access. However, permission sets do not dynamically share individual records based on field values (e.g., the Interviewer lookup). They provide broad access to all records of an object for users assigned the permission set, which does not meet the requirement of automatically sharing a specific Candidate record with the Interviewer user.

Option C: The record can be shared using a sharing rule. Sharing rules are a declarative way to extend access to records based on criteria or ownership. A criteria-based sharing rule can be created for the Candidate object to grant Read access to users specified in the Interviewer lookup field. For example, the rule can be configured to share the record with the user whose ID matches the Interviewer field value whenever it is populated. This automates the sharing process without requiring code, making it the most appropriate solution given the Private OWD and the need for dynamic access.

Option D: The record cannot be shared with the current setup. This is incorrect because Salesforce provides mechanisms like sharing rules to extend access beyond the Private OWD. The lookup field to the Interviewer (User) allows for criteria-based sharing, enabling automatic Read access when the field is set.

Why Option C is Best:
With OWD set to Private, sharing rules are the standard Salesforce feature to automatically grant access to records based on field values or other criteria. A criteria-based sharing rule can evaluate the Interviewer lookup field and share the Candidate record with that user, ensuring Read access is granted dynamically. This aligns with Salesforce’s security model and avoids the complexity of custom Apex code.

Implementation Notes:
Create a criteria-based sharing rule on the Candidate object.
Set the criteria to match records where the Interviewer field is not null.
Grant Read access to the users specified in the Interviewer field.
Ensure the rule is active and tested to confirm access is applied correctly.

References:
1. Salesforce Documentation - Sharing Rules:
Explains how to use criteria-based sharing rules to extend access based on field values.

2. Salesforce Documentation - Organization-Wide Defaults:
Details how OWD interacts with sharing rules to control record access.

3. Salesforce Platform Developer II Study Guide:
Covers security and sharing models, including the use of sharing rules for dynamic access control.

A developer is working on an integration between Salestorce and an external system. The integration requires sending a large amount of data to the external systern, which can cause long response times and timeouts. To optimize the performance and avoid timeouts, which technique should be used?

A. Use a chained batch Apex to split the data into smaller batches.

B. Implement an asynchronous callout using the Continuation class,

C. Increase the timeout limit in the callout options,

D. Use the @future annotation to make the callout asynchronous.

B.   Implement an asynchronous callout using the Continuation class,

Explanation:

To integrate Salesforce with an external system when dealing with large data volumes and long response times, it's crucial to choose an approach that allows the system to handle delays gracefully without hitting governor limits or timeouts.

✅ Correct Answer: B. Implement an asynchronous callout using the Continuation class
The Continuation class is designed specifically for long-running callouts in Visualforce controllers or Aura-enabled Apex controllers. It enables Salesforce to make asynchronous callouts that can wait up to 120 seconds, much longer than the standard 10-second or 60-second limit for synchronous callouts.
Key benefits:
➜ Prevents request timeouts by suspending the server-side processing.
➜ Enables non-blocking behavior in the UI.
➜ Ideal for large data transfers or slow external APIs.

❌ Option A: Use a chained batch Apex to split the data into smaller batches
Chained batch Apex is useful when processing or transforming large datasets within Salesforce or sending multiple independent requests, but does not support HTTP callouts directly within a batch unless you’re careful.
➜ While you can make callouts from the execute() method, it's limited to one callout per batch execution.
➜ It still suffers from timeouts for large or slow callouts.
➜ Not ideal for UI-driven real-time integrations.

❌ Option C: Increase the timeout limit in the callout options
Salesforce allows setting timeouts for callouts using setTimeout() on the HttpRequest object (max 120 seconds), but this alone is not enough. In synchronous Apex (e.g., standard triggers or controller methods), the total request time is capped (typically 10–60 seconds), regardless of the timeout you set.
➜ So increasing timeout won't help if you're hitting platform limits.
➜ Still prone to governor limits and timeouts.

❌ Option D: Use the @future annotation to make the callout asynchronous
While the @future annotation does support callouts, it has several limitations:
➜ You cannot return a response to the user session (e.g., Visualforce or Lightning).
➜ Limited to single method parameters and static methods.
➜ Not ideal for long-running or user-interactive processes.
➜ It's useful for simple fire-and-forget operations, but not for handling large responses or avoiding timeouts with interactivity.

📚 References:
Salesforce Developer Guide: Continuation Class
Trailhead: Asynchronous Apex
Best Practices for Callouts

A company has code to update a Request and Request Lines and make a callout to their external ERP system's REST endpoint with the updated records.

The callousUtil.makeRestCallout fails with a "You have uncommitted work pending. Please commit or rollback before calling cut’ error. What should be done to address the problem?

A. Change the callousUtil makeRestCallout to an @InvocsblsMethod method.

B. Remove the Database. setSavepoint and Database. rollback.

C. Change the CallousUtill .makeRestCallout to an @future method.

C.   Change the CallousUtill .makeRestCallout to an @future method.

✅ Explanation:

The error message:
➥ "You have uncommitted work pending. Please commit or rollback before calling out"
...indicates that a DML operation (like insert/update) was performed before an HTTP callout, which is not allowed in synchronous Apex.

🧠 Why This Happens:
Apex enforces a "DML before callout" restriction in synchronous transactions.

In your code:
➥ You perform insert operations for reqs and reqLines.
➥ Then you make a callout using CalloutUtil.makeRestCallout(...).
➥ This causes the runtime to throw the error because uncommitted DML has occurred before the callout.

✅ How @future Helps
By marking the callout method as @future(callout=true), you:
➥ Move the callout logic to an asynchronous context.
➥ Avoid the DML-before-callout restriction.
➥ Allow the synchronous part to finish (i.e., insert the records), and then the callout is made separately after the transaction completes.

❌ Why the Other Options Are Incorrect

A. Change to @InvocableMethod
➥ @InvocableMethod is used for Flow and Process Builder integration.
➥ It does not solve the DML-before-callout error.
➥ Also, @InvocableMethod does not inherently run asynchronously or allow callouts unless combined with future or Queueable context.

B. Remove Database.setSavepoint() and rollback()
➥ These lines handle transaction rollback and are not related to the DML-callout restriction.
➥ Removing them won't fix the error — you'd still be making a callout after a DML operation.

📘 Reference Documentation
Apex Callouts Best Practices
@future Annotation
DML and Callout Order

Which interface needs to be implemented by an Aura component so that it may be displayed in modal dialog by clicking a button on a Lightning record page?

A. farce:lightningEditRAation

B. lightning:editiction

C. force:lightningQuickhction

D. lightning:quickAction

D.   lightning:quickAction

Explanation:

To determine which interface needs to be implemented by an Aura component to be displayed in a modal dialog when a button is clicked on a Lightning record page, we need to consider Salesforce's Lightning framework and its support for quick actions. A quick action on a Lightning record page can open a modal dialog to perform custom operations, and certain interfaces enable Aura components to be invoked in this manner. Let's evaluate each option based on Salesforce documentation and best practices.

Correct Answer: D. lightning:quickAction
Option D, lightning:quickAction, is the correct interface to implement for an Aura component to be displayed in a modal dialog when triggered by a button on a Lightning record page. This interface allows the component to be used as a custom quick action, which Salesforce renders in a modal popup. By implementing lightning:quickAction, the component can access the record context and interact with the page, making it suitable for tasks like data entry or custom logic. This is a standard practice in Salesforce development, especially for the Platform Developer II exam, where understanding Lightning component integration is key. The interface ensures the component is properly formatted and compatible with the quick action framework.

Incorrect Answer:

Option A: farce:lightningEditAction
Option A, farce:lightningEditAction, appears to be a typographical error or non-existent interface (likely intended as force:lightningEditAction or similar). There is no such interface in the Salesforce Lightning framework. Even if corrected to a similar name, no standard interface like force:lightningEditAction exists for enabling modal dialogs via quick actions. This option does not align with Salesforce's documented interfaces for Aura components, making it invalid for the intended purpose of displaying a component in a modal dialog on a Lightning record page.

Option B: lightning:editAction
Option B, lightning:editAction, is not a recognized interface in the Salesforce Lightning namespace. The lightning namespace includes components and utilities, but no lightning:editAction interface exists for enabling a component to be displayed as a quick action in a modal dialog. This option might be confused with editing-related components or actions, but it lacks the specific functionality required to integrate with quick actions on a Lightning record page. As a result, it is not a viable choice for this scenario.

Option C: force:lightningQuickAction
Option C, force:lightningQuickAction, is not a valid interface in the Salesforce Aura framework. The force namespace includes utilities like force:recordData for record access, but no force:lightningQuickAction interface exists to enable a component as a quick action in a modal dialog. This might be a misinterpretation of the lightning:quickAction interface or related features. Without official support, this option cannot be used to display an Aura component in a modal dialog when a button is clicked on a Lightning record page.

Reference:
Salesforce Lightning Components Basics

Given the following containment hierarchy:


What is the correct way to communicate the new value of a property named ‘’passthrough’’ to my-parent-component if the property is defined within my-child-component?

A. Option A

B. Option B

C. Option C

D. Option D

C.   Option C

Explanation:

📘 Explanation:
CustomEvent('passthrough', {...}): creates a custom event named 'passthrough'.
{ detail: this.passthrough }: sends the value of passthrough in the detail payload (required for passing data).
this.dispatchEvent(cEvent): dispatches the event to the DOM so that the parent component can catch it using an event handler like .

❌ Why Other Options Are Incorrect:

A: Incorrect syntax (customEvent should be CustomEvent) — JavaScript is case-sensitive.
B: Doesn't pass any detail, so parent won’t receive the passthrough value.
D: passthrough is passed as a variable without quotes, causing a ReferenceError unless a variable named passthrough exists (but not passing it correctly in detail either).

Reference:
Salesforce Developer Guide - Create and Dispatch Events

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.