Last Updated On : 28-Sep-2026
Salesforce Certified Platform Developer II (SP25) Practice Test
Prepare with our free Salesforce Certified Platform Developer II (SP25) sample questions and pass with confidence. Our Salesforce-Platform-Developer-II practice test is designed to help you succeed on exam day.
Salesforce 2026
Refer to the code below:
Lightning Web Component JS file
JavaScript
import {LightningElement} from 'lwc';
import serverEcho from '@salesforce/apex/SimpleServerSideController.serverEcho';
export default class Helloworld extends LightningElement {
firstName = 'world';
handleClick() {
serverEcho({
firstName: this.firstName
})
.then((result) => {
alert('From server: ' + result);
})
.catch((error) => {
console.error(error);
});
}
}
Apex Controller
Java
public with sharing class SimpleServerSideController {
@AuraEnabled
public static String serverEcho(sObject firstName) {
String firstNameStr = (String)firstName.get('firstName');
return ('Hello from the server, ' + firstNameStr);
}
}
Given the code above, which two changes need to be made in the Apex Controller for the
code to work?
A. Annotate the entire class as @AuraEnabled instead of just the single method.
B. Change the argument in the Apex Controller line 05 from sObject to String.
C. Remove line 06 from the Apex Controller and instead use firstName in the return on line
D. Change the method signature to be global static, not public static.
C. Remove line 06 from the Apex Controller and instead use firstName in the return on line
Explanation
This question tests how Lightning Web Components communicate with Apex server-side controllers. It evaluates matching JavaScript parameter types to Apex method signatures and cleanly returning scalar values without casting errors.
✅ B. Change the argument in the Apex Controller line 05 from sObject to String.
The JavaScript controller passes `{ firstName: this.firstName }`, where `firstName` is a string primitive ('world'). In the Apex method signature, parameter names must match the JavaScript key, and parameter types must match the data type passed. Updating `sObject firstName` to `String firstName` corrects the parameter definition.
✅ C. Remove line 06 from the Apex Controller and instead use firstName in the return on line 07.
Line 06 calls `.get('firstName')`, which is a method specific to `sObject` instances. Once the parameter type is updated to `String firstName`, line 06 becomes invalid and unnecessary. Removing line 06 and using the `firstName` string variable directly in the return statement produces the intended response.
❌ A. Annotate the entire class as @AuraEnabled instead of just the single method.
The `@AuraEnabled` annotation is applied directly to individual Apex methods or class properties to expose them to Lightning Web Components or Aura. Annotating an entire class with `@AuraEnabled` is invalid Apex syntax.
❌ D. Change the method signature to be global static, not public static.
Apex methods exposed to Lightning Web Components do not require `global` access modifiers unless they are part of a managed package accessed outside their namespace. Declaring the method as `public static` is sufficient and standard practice.
Reference
🔧 Call Apex Methods - Lightning Web Components Developer Guide → confirms that parameter names and data types in Apex method signatures must match the object payload passed from LWC JavaScript functions.
A query using OR between a Date and a RecordType is performing poorly in a Large Data Volume environment. How can the developer optimize this?
A. Break down the query into two individual queries and join the two result sets.
B. Annotate the method with the @Future annotation.
C. Use the Database.querySelector method to retrieve the accounts.
D. Create a formula field to combine the CreatedDate and RecordType value, then filter based on the formula.
Explanation
The issue is caused by using OR between two filters in a Large Data Volume environment.
For an OR condition, Salesforce requires the fields involved to be indexed and individually selective for indexes to be used effectively.
CreatedDate and RecordTypeId are indexed fields, but the combined query can still exceed selectivity thresholds.
Salesforce recommends decomposing such queries into separate queries when indexes cannot be used efficiently.
The resulting record sets can then be combined in Apex to produce the required result.
🟢 A. Break down the query into two individual queries and join the two result sets.
Salesforce specifically recommends decomposing a query when multiple indexed fields joined with OR prevent efficient index usage. The developer can execute one query using the Date filter and another using the RecordType filter, then combine the results in Apex while removing duplicates if necessary. This allows each query to be optimized independently and avoids the restrictive selectivity requirements applied to OR conditions in large data volumes.
🔴 B. Annotate the method with the @Future annotation.
The @Future annotation makes Apex execute asynchronously, but it does not make the underlying SOQL query more selective or improve index usage. The problem is query optimization caused by the OR condition, not synchronous execution. Moving the query to asynchronous Apex would not address the underlying Large Data Volume performance issue.
🔴 C. Use the Database.querySelector method to retrieve the accounts.
Database.querySelector is not the solution for optimizing an OR query involving indexed filters. Changing the mechanism used to construct or execute the query does not alter the query optimizer's selectivity requirements. The appropriate optimization is to decompose the poorly performing OR query into separate selective queries.
🔴 D. Create a formula field to combine the CreatedDate and RecordType value, then filter based on the formula.
A formula field generally does not improve this query because formula fields are calculated rather than inherently indexed. Salesforce specifically advises avoiding formula fields as query filters when optimizing large-volume queries. Combining the two values would also replace indexed fields with a calculated expression, potentially making the query less selective rather than improving performance.
Reference
⇒ SOQL and SOSL
| Salesforce Developers — Confirms that queries using indexed fields joined by OR may exceed index thresholds and recommends decomposing them into separate queries.
⇒ Lightning Platform Query Optimizer | Salesforce Developers — Confirms how Salesforce evaluates filter selectivity and index usage for Large Data Volume queries..
Universal Charities (UC) uses Salesforce to collect electronic donations in the form of credit card deductions from individuals and corporations. When a customer service agent enters the credit card information, it must be sent to a 3rd-party payment processor for the donation to be processed. UC uses one payment processor for individuals and a different one for corporations. What should a developer use to store the payment processor settings for the different payment processors, so that their system administrator can modify the settings once they are deployed, if needed?
A. Hierarchy custom setting
B. Custom label
C. Custom metadata
D. List custom setting
Explanation
This question tests understanding of which Salesforce configuration feature is best suited for storing application settings that need to be modified by administrators after deployment. It evaluates knowledge of custom settings, custom metadata types, and how each handles deployment and post-deployment editability.
✅ C. Custom metadata
Custom metadata types store configuration as metadata rather than data, allowing records to be deployed alongside the application through change sets or packages [citation:4][citation:8]. This means payment processor settings for individuals and corporations can be defined once, deployed to production, and then modified by system administrators directly in Setup without requiring code changes or manual data migration. This matches the requirement perfectly.
❌ A. Hierarchy custom setting
Hierarchy custom settings allow different values per user, profile, or organization, but they are not deployable through change sets or packages. Their records must be manually recreated in each environment, making them unsuitable for settings that need to travel with the application and be modified post-deployment
❌ B. Custom label
Custom labels are designed for translatable text strings used in the user interface, such as error messages or button labels. They are not structured for storing configuration data like payment processor endpoints or credentials, and lack the field structure needed to represent multiple processor settings.
❌ D. List custom setting
List custom settings store configuration data but, like hierarchy settings, their records cannot be deployed via change sets or packages. They require manual migration between environments, which defeats the purpose of having settings that are deployed and then modified by administrators
Reference
🔗 Salesforce Developer Documentation – Custom Metadata Types
→ confirms that custom metadata types are deployable application configuration that can be packaged and migrated between orgs.
Refer to the Aura component below:
HTML
< aura:component >
< aura:attribute name="contactInfo" type="Object"/ >
< aura:attribute name="showContactInfo" type="boolean" default="true"/ >
< aura:handler name="init" value="{!this}" action="{!c.init}"/ >
< aura:if isTrue="{!v.showContactInfo}" >
< c:contactInfo value="{!v.contactInfo}"/ >
< /aura:if >
< /aura:component >
A developer receives complaints that the component loads slowly. Which change can the
developer implement to make the component perform faster?
A. Move the contents of < c:contactInfo > into the component.
B. Change the type of contactInfo to "Map".
C. Change the default for showContactInfo to "false".
Explanation
This question tests knowledge of Aura component performance optimization, specifically how the aura:if tag can be used to defer rendering of a nested component to reduce initial load time.
✅ C. Change the default for showContactInfo to "false".
Because aura:if only creates and renders its child markup when the condition evaluates to true, setting showContactInfo's default to false prevents the c:contactInfo component from being instantiated during the initial page load. This defers the extra rendering work until the attribute is later set to true, speeding up perceived load time.
❌ A. Move the contents of
Inlining the child component's markup does not reduce the amount of DOM or logic being processed; it only relocates the same rendering work into the parent. This does not address the actual cause of slow loading, which is unnecessary early rendering.
❌ B. Change the type of contactInfo to "Map".
Changing the attribute type from Object to Map alters how the data is structured but has no meaningful impact on component load performance. The slowness is tied to rendering behavior, not the data type used to store contactInfo.
Reference
🔗 Improve Performance with Lazy Loading – Salesforce Developer Documentation → confirms using aura:if to defer rendering of components improves initial load performance.
Consider the following code snippet:
< apex:page docType="html-5.0" controller="FindOpportunities" >
< apex:form >
< apex:pageBlock >
< apex:pageBlockSection title="find opportunity" >
< apex:input label="opportunity name"/>
< apex:commandButton value="search" action="{!search}"/ >
< /apex:pageBlockSection>
< apex:pageBlockSection title="Opportunity List" id="opportunityList" >
< /apex:pageBlockSection >
< /apex:pageBlock >
< /apex:form >
< /apex:page >
Users of this Visualforce page complain that the page does a full refresh every time the
Search button is pressed. What should the developer do to ensure that a partial refresh is
made so that only t13he section identified with opportunityList is re-drawn on the
screen?
A. Enclose the DATA table within the < apex:actionRegion > tag.
B. Implement the < apex:actionFunction > tag with immediate = true.
C. Ensure the action method search returns null.
D. Implement the reRender attribute on the < apex:commandButton > tag.
Explanation
This question tests Ajax-style partial page updates in Visualforce. The Search button currently invokes the controller action and refreshes the full page. To redraw only the Opportunity List section after the search action completes, the button must identify that section as its rerender target.
✅ Correct Option:
✅ D. Implement the reRender attribute on the
The reRender attribute makes an
❌ Incorrect Options:
❌ A. Enclose the data table within the
An
❌ B. Implement the
❌ C. Ensure the action method search returns null.
Returning null prevents navigation to a different Visualforce page, but it does not turn the request into a partial-page Ajax update. Without a reRender target, the current page still refreshes. The button needs reRender="opportunityList" to update only the required section.
🔧 Reference:
→ Implement Partial Page Updates with Command Links and Buttons confirms that reRender on an apex:commandbutton updates a specific page area instead of reloading the entire page.
→ apex:commandButton
confirms that reRender identifies the components redrawn after an Ajax update request.
| Salesforce-Platform-Developer-II Exam Questions - Home | Previous |
| Page 5 out of 33 Pages |