Home / Salesforce Certified Platform Developer II / Mock exam
Salesforce Certified Platform Developer II Exam-style mock test

Salesforce Platform Developer II Practice Exams|Practice test

Full explanations Exam format Pass line 68%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At the B2B SaaS firm Northstack, a developer must call an external billing API after a Subscription record is saved in a trigger, without blocking the DML transaction. The callout can be a single invocation and needs no job chaining. Which asynchronous approach best fits this requirement?
✓An @future(callout=true) method invoked from the trigger
Correct. A future method with callout=true runs asynchronously, allows the HTTP callout, and suits a one-off invocation from a trigger.
・A Schedulable class run via System.schedule every hour
Incorrect. Scheduling hourly delays the work and does not tie the callout to the record save event.
・A Batch Apex job started with Database.executeBatch from the trigger
Incorrect. Batch Apex targets large record volumes, which is overkill for a single callout.
・A synchronous callout placed directly in the after-save trigger body
Incorrect. A synchronous callout from a trigger is not allowed and would block the transaction.
Explanation
Future methods are the simplest fit for a single, fire-and-forget callout triggered by a save when no chaining is needed.
Example2 · Advanced Testing and Debugging
At the B2B SaaS company CloudLedger, a trigger updates a rollup field on Account whenever related Invoice records change. A developer must prove the trigger is bulk-safe. Which test approach best validates that the trigger behaves correctly under bulk conditions?
・Insert a single Invoice and assert the Account rollup field equals the expected value after the DML
Incorrect. A single record does not exercise bulk behavior and can hide governor limit or collection handling defects.
✓Insert 200 Invoice records in one DML statement and assert the rollup values on each parent Account
Correct. Inserting 200 records in one DML statement exercises the trigger in bulk and lets you assert correct rollups across parents.
・Call the trigger handler method directly in a loop 200 times without performing any DML
Incorrect. Invoking the handler without DML bypasses the trigger context and does not test the actual bulk execution path.
・Use Test.loadData to load one Invoice from a static resource and verify the Account field is populated correctly
Incorrect. Loading one record from a static resource still only exercises single-record behavior, not bulk processing.
Explanation
Bulk-safety is proven by inserting at least 200 records in a single DML call and asserting results across all affected parents.
Example3 · Lightning Web Components and Aura (Advanced UI)
At Flowbyte, a B2B SaaS firm, a developer must build a new high-traffic dashboard embedded in Lightning Experience. Leadership wants the best runtime performance and alignment with modern web standards. Which framework should the developer select for the new component?
・Aura, because only it can render inside the Lightning App Builder
Incorrect. Both LWC and Aura render in the App Builder, so this is not a differentiator.
✓Lightning Web Components, built on native web standards
Correct. LWC leverages native web standards and the browser engine, giving it a lighter, faster runtime than Aura.
・Visualforce wrapped inside an Aura container for the dashboard
Incorrect. Introducing Visualforce adds overhead and does not meet the modern-standards goal.
・Aura, since Lightning Web Components cannot access Apex controllers
Incorrect. LWC can call Apex via the @wire service or imperative methods, so this claim is false.
Explanation
LWC is built on modern web standards and runs closer to the browser engine, making it the performance-oriented choice for new components.
Example4 · Integration (REST/SOAP, Platform Events, Callouts)
A hospital's patient-portal vendor must POST new appointment-request records into Salesforce and expects a clean JSON contract with custom resource URIs. The developer wants full control over the endpoint path and the HTTP verbs. Which approach best fits this requirement?
✓Build an Apex class annotated with @RestResource and @HttpPost bound to a custom URI
Correct. The @RestResource annotation with @HttpPost exposes a custom REST endpoint whose URI and verbs the developer controls, matching the JSON contract need.
・Expose the logic through the standard SOAP-based Enterprise WSDL generated from the org
Incorrect. The Enterprise WSDL is SOAP/XML and strongly typed to the org schema, not a custom JSON resource.
・Generate a Partner WSDL and have the vendor call the login and create operations
Incorrect. The Partner WSDL is loosely typed SOAP and still does not provide custom JSON resource URIs the vendor wants.
・Ask the vendor to use the Bulk API 2.0 ingest job endpoint for every single request
Incorrect. Bulk API 2.0 targets large asynchronous data loads, not a low-latency single-record JSON POST contract.
Explanation
Custom REST resources with controllable URIs and verbs are built using Apex REST (@RestResource).
Example5 · Performance, Security, and Large Data Volumes
A healthcare services firm runs a nightly batch job that updates 4 million Patient Visit records. The developer wants to avoid heap and CPU limit failures. Which Batchable configuration best supports this workload?
✓Implement Database.Batchable with a QueryLocator start method and tune the scope size per execute to keep each chunk within governor limits
Correct. A QueryLocator start method streams records and a tuned scope size keeps each execute within heap, CPU, and DML limits.
・Implement Database.Batchable but return a large in-memory List from the start method so all records load up front for faster access
Incorrect. Returning a large in-memory List from start is capped at 50,000 records and defeats chunked processing.
・Use a single future method that queries every Patient Visit record at once and loops through them in one transaction
Incorrect. A single future method shares the same synchronous governor limits and cannot process millions of records in one transaction.
・Use a scheduled Apex class that performs all the DML in its execute method without chunking the records into batches
Incorrect. Scheduled Apex alone does not chunk records, so all DML runs in one transaction and hits limits.
Explanation
Batch Apex with a QueryLocator and an appropriate scope size is the standard pattern for processing millions of records safely.
Example6 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At MercyPoint Health, a nightly process must recalculate risk scores for roughly 4 million Patient__c records and update each one. Which asynchronous Apex feature should the developer choose?
・A future method annotated with @future(callout=true)
Incorrect. Future methods cannot process millions of records and have strict governor limits per invocation.
✓A Batch Apex class implementing Database.Batchable
Correct. Batch Apex divides the large record set into manageable chunks, each run in its own transaction with fresh governor limits.
・A scheduled method that loops over all records in one transaction
Incorrect. A single transaction cannot process millions of records without exceeding query and DML limits.
・A single Queueable job that queries and updates every record at once
Incorrect. A single Queueable job runs in one transaction and would exceed the query row and DML limits on millions of records.
Explanation
Batch Apex is designed for large data volumes because it splits work into separate transactions, each with its own governor limits.
Example7 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At the retailer UrbanThread, a developer must process 2 million Order records nightly, applying loyalty-tier recalculation in manageable chunks that each respect their own governor limits. Which asynchronous Apex feature best fits this requirement?
✓Batch Apex, which splits the records into scoped execution batches
Correct. Batch Apex is designed to divide large record volumes into scoped chunks, each getting a fresh set of governor limits.
・A future method annotated with @future to run the job later
Incorrect. A future method processes one job and cannot chunk 2 million records across independent limit contexts.
・A scheduled flow triggered from the automation setup menu
Incorrect. A scheduled flow cannot handle this record volume with per-chunk limits the way Batch Apex can.
・A synchronous for loop inside a before-update Apex trigger handler
Incorrect. A synchronous trigger loop would hit governor limits immediately on such volume.
Explanation
Batch Apex is purpose-built for large data volumes, processing records in scoped batches that each receive their own governor limits.
Example8 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At UrbanThread, a developer needs an asynchronous job that, after finishing its work, enqueues a second asynchronous job to continue processing shipment records in sequence. Which approach supports this chaining pattern?
✓Queueable Apex, calling System.enqueueJob from within the execute method
Correct. Queueable Apex allows chaining by calling System.enqueueJob from inside the execute method to enqueue the next job.
・A future method that returns the job ID of the next future call
Incorrect. Future methods cannot call other future methods, so they cannot chain this way.
・A trigger that fires another trigger on the same object automatically
Incorrect. Trigger-to-trigger firing is not a supported chaining pattern for sequential async jobs.
・A scheduled Apex class that re-schedules itself with System.schedule
Incorrect. Scheduled Apex self-rescheduling is not the intended mechanism for immediate sequential chaining.
Explanation
Queueable Apex supports job chaining by enqueuing a subsequent Queueable from within the current job's execute method.
Example9 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
In a UrbanThread Batch Apex class that reprices clearance products, the team wants to send a summary email only after every batch has completed. In which method should this logic go?
✓The finish method, which runs once after all batches complete
Correct. The finish method executes once after all batch executions complete, making it ideal for a summary email.
・The execute method, which runs for each scoped batch of records
Incorrect. The execute method runs per batch, so email logic there would fire repeatedly.
・The start method, which returns the records to be processed
Incorrect. The start method defines the scope and runs before any batch processing.
・A separate future method invoked at the top of the start method
Incorrect. Invoking a future method from start would run before batches finish, not after.
Explanation
The finish method in Batch Apex runs a single time after all execute calls complete, suitable for post-processing like notifications.
Example10 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At MeridianTrust Bank, a developer must call an external fraud-scoring API, then based on the response immediately call a second credit-bureau API, passing complex sObject state between the two steps. Which asynchronous approach best fits this requirement?
✓Use a Queueable chained with System.enqueueJob, passing state through class members
Correct. Queueable supports callouts, holds non-primitive member state, and can chain a follow-up job after the first callout response is known.
・Use a single future method annotated with @future(callout=true) that performs both callouts in one invocation
Incorrect. Future methods only accept primitive arguments and cannot be chained to react to the first callout's result.
・Use a Batch Apex job with the Database.AllowsCallouts marker interface iterating over a single-row scope
Incorrect. Batch Apex is designed for large record volumes, not a two-step callout chain on a single payload.
・Use a Schedulable class that runs every minute to repeatedly poll for changes and issue the callouts
Incorrect. A polling scheduler adds latency and does not pass sObject state between the two dependent callouts cleanly.
Explanation
Queueable Apex allows callouts, retains member variable state, and can be chained, making it ideal for dependent sequential callouts.
Example11 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
MeridianTrust runs a nightly Batch Apex job to recalculate interest on millions of loan records. What is the default scope size per execute() invocation if no scope is specified in Database.executeBatch?
✓200 records
Correct. The default batch scope size is 200 records per execute() call when no scope argument is provided.
・50 records
Incorrect. 50 is not the default batch scope value.
・2000 records
Incorrect. 2000 is the maximum allowed scope for a QueryLocator, not the default.
・One record for every batch job started within the running transaction window
Incorrect. Batch jobs process records in configurable chunks, not a single record tied to transaction count.
Explanation
Database.executeBatch defaults to a scope of 200 records per execute() invocation.
Example12 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
A consulting firm, Northstar Advisory, must nightly recalculate a rollup across roughly 4 million Engagement records. Each record needs callouts suppressed, and the job must process in chunks to stay within governor limits. Which asynchronous Apex feature best fits this requirement?
✓Batch Apex implementing Database.Batchable, so the 4 million records are split into scoped batches
Correct. Batch Apex divides a large record set into manageable scopes, which is purpose-built for processing millions of records within limits.
・A future method annotated with @future, invoked once from a scheduled trigger handler
Incorrect. Future methods accept only primitive arguments and cannot chunk or process millions of records in one transaction.
・Queueable Apex enqueued a single time with System.enqueueJob at midnight
Incorrect. A single Queueable transaction still faces the same per-transaction governor limits and cannot split the data.
・A synchronous Apex scheduled class that loops over all 4 million records in one execute() call
Incorrect. A synchronous loop over millions of rows would immediately exceed heap and query-row limits.
Explanation
Batch Apex is designed to iterate over very large data volumes by splitting them into scoped batches, making it the correct choice for a 4-million-record nightly rollup.
Example13 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At Northstar Advisory, a developer needs a batch job to carry a running total across all batches so it can be logged in finish(). What should the developer do?
✓Implement Database.Stateful on the batch class and keep the total in an instance variable
Correct. Database.Stateful preserves instance member variable values between batch execute() invocations.
・Store the total in a static variable, which persists automatically across every batch transaction
Incorrect. Static variables reset between the separate transactions that each batch runs in.
・Add @future to execute() so each batch shares the same memory and instance state
Incorrect. The @future annotation is invalid on a batch execute() method and does not share state.
・Rely on the default batch behavior, since instance variables already retain values across all batches
Incorrect. By default instance variables are reset for each batch unless Database.Stateful is implemented.
Explanation
Only by implementing Database.Stateful do instance variables retain their values across batch transactions, enabling a running total.
Example14 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
At a manufacturing distributor, a developer must process a shipment, then call a carrier rate service only after the first job completes, keeping a strict order. Which asynchronous approach best supports chaining one dependent job after another?
✓Enqueue a Queueable that enqueues the next Queueable in its execute method
Correct. Queueable jobs support chaining by enqueuing the next job from within execute, preserving order.
・Use @future methods, since future calls run in a guaranteed sequence
Incorrect. Future methods cannot be chained and offer no ordering guarantee.
・Use a scheduled job that fires both pieces of logic at the same minute
Incorrect. Scheduling both at the same minute does not enforce dependency order.
・Invoke both operations synchronously inside the same trigger handler
Incorrect. Synchronous trigger logic cannot wait for a prior async job to finish.
Explanation
Queueable Apex is designed for job chaining, letting each job enqueue the next and maintain a reliable dependency sequence.
Example15 · Advanced Apex (Asynchronous, Batch, Queueable, Triggers)
A distributor nightly recalculates reorder points across millions of Product_Stock__c rows. In a Database.Batchable class, which method defines the overall set of records that the batch will process?
・finish, because it returns the final record collection
Incorrect. The finish method runs post-processing after all batches complete.
✓start, which returns the scope as a QueryLocator or Iterable
Correct. The start method returns a QueryLocator or Iterable defining the records to process.
・execute, because each call selects its own records
Incorrect. The execute method processes each scoped chunk, not the full set.
・schedule, since it both queries and executes the batch work
Incorrect. There is no schedule method on the Batchable interface.
Explanation
The start method establishes the batch scope, returning either a QueryLocator or an Iterable for the job.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)