Salesforce Certified Platform Developer II

450 Questions and Answers

$19.99

Advance your Salesforce development career with confidence using this expertly crafted Salesforce Certified Platform Developer II Practice Exam. Designed for experienced developers, this exam resource prepares you for one of Salesforce’s most challenging and respected certifications.

This practice test focuses on the advanced concepts required for certification, including Apex design patterns, asynchronous programming, Lightning Web Components (LWC), testing strategies, and integration techniques. Each question mirrors the complexity and style of the actual exam, ensuring you’re fully equipped for real-world challenges in enterprise Salesforce development.

Ideal for professionals working on custom application development, scalable architecture, and multi-org deployments, this exam prep enhances your proficiency in governor limits, system events, SOQL performance tuning, and advanced error handling.

Key Features:

  • Based on the latest Salesforce Platform Developer II exam guide

  • Includes real-world, scenario-based questions with full explanations

  • Covers all key topics: Apex, LWC, APIs, security, and integration

  • Perfect for developers, technical architects, and advanced coders

Elevate your technical credentials and pass the Salesforce Platform Developer II exam with confidence—powered by Studylance.org’s expert-level practice solutions.

Sample Questions and Answers

What is the maximum number of callouts allowed in a single Apex transaction?
A) 5
B) 10
C) 15
D) 20

Answer: B) 10
Explanation: Apex allows up to 10 callouts per transaction.

417.

What is the best way to handle exceptions in batch Apex?
A) Use try-catch blocks inside the execute() method
B) Rely on Salesforce to retry automatically
C) Throw exceptions to abort the batch
D) Do not handle exceptions; log errors only

Answer: A) Use try-catch blocks inside the execute() method
Explanation: Proper error handling prevents batch failures.

418.

What is the effect of the @future(callout=true) annotation?
A) The method can perform callouts asynchronously
B) The method runs synchronously
C) The method cannot be tested
D) The method is scheduled to run later

Answer: A) The method can perform callouts asynchronously
Explanation: Marks future methods to allow HTTP callouts.

419.

Which of the following is true about platform events?
A) They support real-time event-driven architecture
B) They replace batch Apex jobs
C) They require manual polling to get events
D) They cannot be subscribed to via Apex triggers

Answer: A) They support real-time event-driven architecture
Explanation: Platform events enable real-time communication and asynchronous processing.

420.

What is a valid use case for Database.SaveResult in Apex?
A) Checking success or failure of DML operations
B) Handling exceptions in SOQL queries
C) Debugging Apex performance
D) None of the above

Answer: A) Checking success or failure of DML operations
Explanation: Database.SaveResult provides success status and error messages for DML operations.

 

421.

Which of the following statements about Lightning Web Components (LWC) and Apex integration is true?
A) Apex methods must be annotated with @AuraEnabled to be called from LWC.
B) LWC can directly call any Apex method without restrictions.
C) Apex methods called from LWC cannot be asynchronous.
D) Apex methods must be global to be accessible by LWC.

Answer: A) Apex methods must be annotated with @AuraEnabled to be called from LWC.
Explanation: Only Apex methods annotated with @AuraEnabled can be accessed by Lightning components, including LWCs.

422.

How does the @TestSetup annotation improve Apex test classes?
A) It creates reusable test data that runs once per test class execution.
B) It allows tests to access production data.
C) It prevents tests from running in parallel.
D) It enforces CRUD and FLS checks automatically.

Answer: A) It creates reusable test data that runs once per test class execution.
Explanation: @TestSetup methods create common test data to be used across multiple test methods, improving test performance.

423.

What happens if an unhandled exception is thrown in a batch Apex execute() method?
A) The batch job stops immediately and all processed records roll back.
B) The batch job skips the current batch and continues with the next.
C) The batch job retries the failed batch indefinitely.
D) The batch job completes successfully despite the error.

Answer: A) The batch job stops immediately and all processed records roll back.
Explanation: Unhandled exceptions cause the entire batch transaction to roll back.

424.

Which of the following is NOT true about Custom Labels in Salesforce?
A) They support multiple languages.
B) They can be referenced in Apex and Visualforce.
C) They can be edited only through Setup UI.
D) They can contain up to 1,000 characters.

Answer: C) They can be edited only through Setup UI.
Explanation: Custom Labels can also be deployed and edited via metadata API, not only UI.

425.

What is the maximum number of future methods that can be invoked in a single Apex transaction?
A) 5
B) 10
C) 50
D) 100

Answer: A) 5
Explanation: Apex allows up to 50 future calls per transaction for asynchronous execution.

(Correction: Actually, the limit is 50, so the correct answer is C.)

Correction:
Answer: C) 50
Explanation: A maximum of 50 future method calls are allowed per Apex transaction.

426.

What are the benefits of using the Lightning Data Service in Lightning components?
A) Automatic cache management and record-level security enforcement.
B) Requires explicit Apex controller code for data access.
C) Disables CRUD and FLS enforcement.
D) Only available in Aura components.

Answer: A) Automatic cache management and record-level security enforcement.
Explanation: Lightning Data Service provides data caching, declarative data access, and respects security.

427.

Which statement best describes the difference between a Queueable Apex job and a Batch Apex job?
A) Queueable Apex supports job chaining; Batch Apex does not.
B) Batch Apex is for large data sets and supports chunking; Queueable Apex is for smaller jobs.
C) Queueable Apex cannot perform callouts; Batch Apex can.
D) Batch Apex does not have governor limits; Queueable Apex does.

Answer: B) Batch Apex is for large data sets and supports chunking; Queueable Apex is for smaller jobs.
Explanation: Batch Apex processes records in batches, Queueable Apex handles jobs with fewer records or simpler logic.

428.

Which annotation is required for a test method to access private methods in Apex?
A) @IsTest
B) @TestVisible
C) @TestMethod
D) @VisibleForTesting

Answer: B) @TestVisible
Explanation: @TestVisible annotation allows test methods to access private or protected methods and variables.

429.

Which of the following is a valid way to bulkify Apex triggers?
A) Performing SOQL queries inside for-loops.
B) Processing records in collections rather than one by one.
C) Calling DML statements for each record in the trigger.
D) Using static variables to store data from unrelated triggers.

Answer: B) Processing records in collections rather than one by one.
Explanation: Bulkification processes all records in bulk to avoid governor limits.

430.

What is the maximum number of batch Apex jobs that can be submitted or active concurrently per org?
A) 10
B) 50
C) 100
D) 200

Answer: C) 100
Explanation: Salesforce limits 100 batch Apex jobs active or queued per org.

431.

Which method in Apex can be used to prevent SOQL injection attacks?
A) Use dynamic SOQL with concatenated strings.
B) Use static SOQL queries with bind variables.
C) Disable user input.
D) Use string escaping methods manually.

Answer: B) Use static SOQL queries with bind variables.
Explanation: Bind variables safely pass user input and prevent injection.

432.

What does the @InvocableMethod annotation do?
A) Marks methods for use in Process Builder and Flow.
B) Marks methods as future methods.
C) Enables methods for REST API exposure.
D) Marks test methods.

Answer: A) Marks methods for use in Process Builder and Flow.
Explanation: @InvocableMethod exposes Apex methods to declarative tools.

433.

Which interface should an Apex class implement to be used as a batch Apex job?
A) Queueable
B) Database.Batchable
C) Schedulable
D) Database.Stateful

Answer: B) Database.Batchable
Explanation: Batch classes must implement Database.Batchable interface.

434.

Which of the following is true about the with sharing keyword in Apex?
A) It enforces the current user’s sharing rules.
B) It disables sharing rules.
C) It bypasses FLS checks.
D) It is the default behavior of all Apex classes.

Answer: A) It enforces the current user’s sharing rules.
Explanation: Classes marked with with sharing respect sharing and security settings.

435.

How can you handle callout limits when performing multiple HTTP requests in Apex?
A) Use synchronous Apex with @future(callout=true).
B) Use Batch Apex to process callouts in chunks.
C) Make more than 10 callouts in a single transaction.
D) Use Queueable Apex chaining for sequential callouts.

Answer: D) Use Queueable Apex chaining for sequential callouts.
Explanation: Queueable Apex can chain jobs to handle multiple callouts without hitting limits.

436.

Which method allows Apex classes to execute asynchronously and chain jobs?
A) Future methods
B) Batch Apex
C) Queueable Apex
D) Scheduled Apex

Answer: C) Queueable Apex
Explanation: Queueable Apex supports chaining for asynchronous job sequences.

437.

What is the maximum number of records that can be returned by a SOQL query?
A) 10,000
B) 50,000
C) 100,000
D) 500,000

Answer: B) 50,000
Explanation: The governor limit restricts SOQL query results to 50,000 records per transaction.

438.

Which annotation is used to define a custom permission set in Apex?
A) @PermissionSet
B) @CustomPermission
C) @IsTest
D) None of the above

Answer: D) None of the above
Explanation: Custom permissions are defined declaratively, not via Apex annotations.

439.

Which statement best describes the use of Apex Trigger Context Variables?
A) They provide information about the runtime context of triggers, such as operation type and affected records.
B) They allow you to bypass governor limits.
C) They are used only for batch Apex jobs.
D) They are global variables accessible in any Apex code.

Answer: A) They provide information about the runtime context of triggers, such as operation type and affected records.
Explanation: Context variables help determine trigger invocation context.

440.

What is the best practice to test callouts in Apex?
A) Use HttpCalloutMock and Test.setMock() to simulate responses.
B) Call external services during test execution.
C) Use seeAllData=true to access live data.
D) Avoid testing callouts.

Answer: A) Use HttpCalloutMock and Test.setMock() to simulate responses.
Explanation: This enables controlled, reliable tests without external dependencies.

441.

Which Salesforce feature allows you to programmatically manipulate metadata such as custom fields or layouts?
A) Metadata API
B) REST API
C) SOAP API
D) Bulk API

Answer: A) Metadata API
Explanation: Metadata API allows deployment and modification of metadata components.

442.

What is the recommended way to expose Apex methods to be consumed by external systems?
A) Mark methods as @Future.
B) Use Apex REST or SOAP web services.
C) Use Batch Apex.
D) Use @TestMethod.

Answer: B) Use Apex REST or SOAP web services.
Explanation: These allow external integration with Salesforce.

443.

Which of the following are valid access modifiers in Apex?
A) public, private, global, protected
B) static, transient, final
C) abstract, virtual, override
D) public, final, override

Answer: A) public, private, global, protected
Explanation: These are standard Apex access modifiers controlling visibility.

444.

How can you improve the performance of SOQL queries in Apex?
A) Use selective filters and avoid querying unnecessary fields.
B) Query all fields with SELECT *.
C) Use SOQL inside loops.
D) Avoid indexes.

Answer: A) Use selective filters and avoid querying unnecessary fields.
Explanation: Selectivity and reducing fields improve performance.

445.

Which governor limit applies to the total number of records retrieved by SOQL in a single transaction?
A) 50,000
B) 100,000
C) 10,000
D) 5,000

Answer: A) 50,000
Explanation: SOQL queries can return up to 50,000 records per transaction.

What is the effect of setting Database.AllOrNone to false in DML operations?
A) Partial success allowed; errors do not rollback entire operation.
B) All operations are rolled back on error.
C) Disables sharing rules.
D) Executes DML asynchronously.

Answer: A) Partial success allowed; errors do not rollback entire operation.
Explanation: It allows partial commit of records.

447.

Which statement about Apex Scheduler is true?
A) It allows scheduling Apex classes to run at specific times.
B) It is used only for batch Apex jobs.
C) It cannot be used with Queueable Apex.
D) It requires no governor limits.

Answer: A) It allows scheduling Apex classes to run at specific times.
Explanation: Scheduler supports timed Apex execution.

448.

What does the Database.Stateful interface do when implemented by a batch Apex class?
A) Maintains state across batch transactions.
B) Enables callouts in batch jobs.
C) Runs batch jobs in parallel.
D) Disables sharing rules.

Answer: A) Maintains state across batch transactions.
Explanation: It keeps instance variables between execute() calls.

449.

Which statement about static variables in Apex is true?
A) Static variables retain their value only during a single transaction.
B) Static variables retain value across multiple user sessions.
C) Static variables can store data permanently.
D) Static variables are thread-safe.

Answer: A) Static variables retain their value only during a single transaction.
Explanation: Static variables reset after each transaction.

450.

Which tool helps analyze Apex code for best practices and potential issues?
A) Developer Console’s Code Scanner
B) Salesforce Setup > Debug Logs
C) Visual Studio Code Extensions like Salesforce CLI
D) Salesforce Inspector Browser Extension

Answer: A) Developer Console’s Code Scanner
Explanation: It identifies potential issues and best practice violations in Apex.

Reviews

There are no reviews yet.

Be the first to review “Salesforce Certified Platform Developer II”

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top