Reinforce SF-PD2 concepts with active-recall study cards covering all 5 blueprint domains. Each card shows the question on the front and the correct answer with a full explanation on the back.
Flashcards work through active recall — the process of retrieving information from memory rather than passively re-reading it. Research consistently shows that active recall produces stronger, longer-lasting memory than re-reading study guides. For SF-PD2 preparation, this means flashcards are one of the highest-return study tools available.
Attempt recall first
Read the SF-PD2 question on each card, pause, and attempt to formulate the answer in your own words before revealing. This retrieval attempt — even if wrong — dramatically strengthens memory compared to immediately reading the answer.
Review wrong cards again
When you get a card wrong, note it and add it back to your review pile. Spaced repetition — seeing difficult cards more frequently — is the mechanism that makes flashcard study far more efficient than linear reading.
Study by domain
Group your SF-PD2 flashcard sessions by domain for the first 3–4 weeks. Master one domain before moving to the next. In the final week, shuffle all cards together to test cross-domain recall — which is what the real SF-PD2 exam requires.
Short sessions beat marathon reviews
20–30 flashcard cards per session, done daily, produces better retention than a single 200-card marathon session. Five short daily sessions per week over 4 weeks gives you over 400 total card reviews — enough to reliably pass SF-PD2.
Sample cards from the SF-PD2 flashcard bank. Read the question, think of the answer, then read the explanation below.
A developer needs to write a unit test for an asynchronous future method that updates account records. How should the developer structure the test to ensure the asynchronous code executes and validates correctly?
Enclose the future method invocation between Test.startTest() and Test.stopTest() to force synchronous execution.
Wrapping the asynchronous invocation block inside Test.startTest() and Test.stopTest() forces all asynchronous calls queued within the block to execute synchronously before Test.stopTest() completes. This pattern is fundamental in Salesforce testing because it allows developers to reliably assert database states modified by future methods, batch apex, or queueable jobs, preventing false test failures caused by execution timing races.
A developer is building a complex nested Lightning Web Component structure. A deeply nested child component needs to notify an ancestor component, which is not the immediate parent, about a data change. Which configuration of the CustomEvent constructor should the developer use to ensure the event reaches the ancestor across the shadow DOM boundary?
new CustomEvent('update', { bubbles: true, composed: true });
Understanding event propagation in Lightning Web Components is vital for building scalable architectures. When an event needs to cross the shadow DOM boundary and continue bubbling up the regular DOM, both the bubbles and composed properties must be set to true. This allows the event to reach components outside of the immediate shadow root where it originated, enabling decoupled communication between distant components.
A developer has a requirement to update 5,000 records in a single transaction. The operation frequently hits the 'Too many DML statements' limit. What is the most efficient way to refactor the code?
Collect records in a list and perform one DML statement after the loop.
Governor limits enforce boundaries on DML statements within a single transaction to ensure platform stability. Performing DML inside a loop is a violation of best practices because each statement counts against the limit. Refactoring the code to collect records in a list and performing a single DML operation outside the loop reduces the number of statements from 5,000 to one, ensuring the code remains scalable and efficient for large datasets.
An enterprise application requires integrating an external REST API that frequently times out. A developer needs to implement a robust outbound callout mechanism in Apex that handles asynchronous execution while supporting complex retry policies and transactional state management. Which architectural approach best meets these requirements?
Create a Queueable Apex class implementing Database.AllowsCallouts, leveraging custom retry logic and job chaining when a timeout occurs.
Queueable Apex implementing Database.AllowsCallouts is the optimal choice for asynchronous HTTP callouts in Salesforce. It supports chaining jobs, passing complex data types as member variables, and provides robust error handling compared to future methods. Mastering asynchronous processing patterns ensures application resilience and prevents governor limit violations during high-volume enterprise integrations.
When designing a unit test for a class that makes callouts, which pattern is the industry standard for ensuring the test does not actually send requests?
Using the System.Test.setMock() method with an implementation of HttpCalloutMock.
The HttpCalloutMock interface is the standard way to handle external requests in tests. Since Apex unit tests are prohibited from making actual network calls, implementing this interface allows developers to define a static response. This pattern is essential for creating deterministic tests that verify how code handles both success and failure scenarios without requiring an external service to be active or reachable.
Refer to the exhibit. A developer is reviewing a debug log for a failed transaction. What is the primary performance issue identified in the log snippet?
The transaction failed because the CPU time exceeded the 10,000 ms limit.
The debug log shows the cumulative limit usage at the end of a transaction. The 'Maximum CPU time' entry indicates that 10,005 milliseconds were used, which exceeds the synchronous governor limit of 10,000 milliseconds. This results in a LimitException, and the transaction is rolled back, regardless of how many queries or rows were processed.
A developer is writing an Apex trigger that should only fire when specific fields are changed. Which THREE practices help optimize the trigger's performance?
Check field values in the trigger to avoid redundant logic. / Move business logic into a separate service class. / Use the 'if' condition to exit early if criteria are not met.
Trigger optimization is essential for preventing unnecessary processing. By checking if fields have actually changed, the developer avoids executing logic when no relevant data updates have occurred. Furthermore, decoupling logic into service classes keeps the trigger thin and manageable, while early-exit patterns ensure the code finishes as fast as possible if conditions aren't met, maintaining high system throughput and preventing governor limit issues.
Refer to the exhibit. What is the primary security advantage of using a 'Named Credential' in this callout as opposed to hardcoding the API endpoint and credentials?
It centralizes credential management and prevents hardcoded secrets.
Named Credentials encapsulate the authentication process and the endpoint URL, separating the integration configuration from the source code. This not only makes the code cleaner but also provides centralized management of sensitive credentials. If credentials expire or the endpoint changes, the developer updates the Named Credential object, and all associated integrations are updated simultaneously without requiring a deployment or code change.
A developer wants to inspect private variable states and trace execution paths of a complex trigger framework during a sandbox debugging session. Which tool should the developer use to capture this diagnostic information?
Salesforce Developer Console Log Inspector
The Developer Console includes a powerful execution log inspector and perspective layout specifically designed for tracing Apex transactions. Debug logs record database queries, heap allocations, and method entries, enabling developers to isolate root causes of unexpected runtime behaviors efficiently during active troubleshooting sessions.
What is the best way to test asynchronous Apex (Future methods, Queueable) to ensure the logic within the background job actually executes?
Wrap the test logic in Test.startTest() and Test.stopTest().
Using Test.startTest() and Test.stopTest() is the only supported way to force asynchronous code to execute synchronously within a test block. Any asynchronous jobs added between these two calls are processed when stopTest() is invoked. This pattern ensures that tests can assert the outcome of background operations, which is crucial for testing complex integrations or batch processes that rely on asynchronous execution.
A developer is writing a test class that requires a user with a specific profile. How should the developer handle the user creation process?
Create a new user within the test method and use System.runAs().
Tests must create their own data, including Users, to ensure they remain self-contained and environment-independent. Using the 'RunAs' method in combination with user creation allows the developer to simulate specific security and permission contexts. This ensures that the logic is tested exactly as it would be for the target user, confirming that the code respects the platform's security model consistently.
A developer wants to create a custom setting that can be accessed globally within Apex code without performing a SOQL query. Which type of custom setting is most appropriate if the data varies per user profile?
Hierarchy Custom Setting.
Custom Settings are categorized into List and Hierarchy types. Hierarchy Custom Settings allow developers to define values at the Organization, Profile, or User level. This provides a flexible mechanism to retrieve environment-specific configurations without the overhead of SOQL queries, which count against governor limits. For per-profile configuration, the Hierarchy type is the standard architectural choice in Salesforce development.
A developer is building a Lightning Web Component that needs to communicate with a parent component in a deep containment hierarchy. The event must traverse shadow boundaries without stopping at component boundaries. Which property configuration should the developer apply when instantiating the CustomEvent?
{ bubbles: true, composed: true }
Custom events in Lightning Web Components require the bubbles and composed properties to be set to true when they need to cross shadow DOM boundaries and propagate up through the entire DOM tree, including parent and grandparent components. Setting composed to false restricts the event strictly within the local shadow tree of the component that dispatched it.
A developer is writing a complex asynchronous batch Apex job that processes millions of financial transaction records. The job needs to maintain running totals across batches and update a summary logging record upon completion. Which mechanism allows state to be accurately preserved across individual executeBatch transactions?
Implement the Database.Stateful interface on the batch class definition to preserve instance member variable states across transaction chunks.
Implementing the Database.Stateful interface in a Batch Apex class ensures that instance member variables retain their values across distinct transaction chunks. Without this interface, member variables reset between execute method invocations. Preserving state is essential for maintaining running totals and aggregate metrics during large-scale data processing.
Refer to the exhibit. The Apex transaction is consistently hitting the CPU limit. What is the most likely cause and the best way to optimize the code?
Replace nested loops with Map-based lookups.
The CPU time limit is reached when the Apex code performs too many calculations, loops, or complex logic within a single transaction. Optimization requires reducing the complexity of the code, such as moving away from nested loops, using maps for faster lookups, or offloading heavy computations to asynchronous processes like Batch Apex or Queueable Apex. This ensures that the transaction completes within the time limit allocated by the platform.
An enterprise Salesforce application requires high-performance execution of complex SOQL queries across millions of records. Which strategy should a developer implement to ensure optimal query performance and prevent governor limit violations?
Apply custom indexes on frequently filtered fields and ensure filters use selective criteria.
Utilizing selective queries with custom indexes combined with proper bind variables ensures that database operations avoid full table scans. This optimization directly prevents CPU time and query row limit exceptions, protecting platform resources and maintaining user experience under heavy transaction loads.
A developer is attempting to debug a failed deployment in a sandbox. The error message is cryptic, and the debug logs are not capturing the expected execution flow. What should the developer do first?
Increase the debug log level for the user executing the deployment.
Effective debugging starts with ensuring the logging level is correctly configured. If logs are not capturing the flow, it is likely the log level for 'Apex Code' or 'Apex Profiling' is set to 'None' or 'Error'. Increasing the verbosity to 'Fine' or 'Finest' is the standard procedure to gain visibility into the execution path, allowing for the identification of logic errors or incorrect configuration.
A developer wants to minimize the impact of long-running operations on the user interface. Which design pattern should they utilize?
Use Queueable Apex to offload complex tasks to the background.
Asynchronous processing, such as Queueable Apex, offloads heavy tasks to the background. By executing long-running logic outside the main user request thread, the UI remains responsive. This improves the perceived performance of the application significantly, as users do not have to wait for complex computations to finish before continuing their work in the Salesforce interface.
Refer to the exhibit. The service is failing because the external system requires a specific 'Content-Type' header that is missing. Which addition to the code will correctly resolve this issue?
req.setHeader('Content-Type', 'application/json');
To successfully communicate with an external API that expects specific metadata, the HTTP request must be configured with the necessary headers before the request is sent. The HttpRequest class provides the setHeader() method, which is the standard way to define metadata such as 'Content-Type' or 'Authorization'. Adding this line ensures the request is formatted correctly for the external system's expectations.
A developer is writing a query to fetch related records. Which SOQL pattern is best for avoiding unnecessary query execution and improving performance?
Use a single relationship query to fetch parent and child records.
Using relationship queries (joins) allows fetching data from parent and child objects in a single SOQL statement. This prevents the 'query-in-a-loop' anti-pattern, which is the most common cause of hitting the 100 SOQL query limit. By retrieving all necessary data at once, the developer reduces the number of server round-trips and keeps the transaction lightweight and performant, which is essential for scaling code in an enterprise environment.
A company requires that an integration log all outbound API requests for auditing purposes, including the full request and response body. Given the potential for high volumes, which implementation is most efficient and compliant?
Use Platform Events to log the data asynchronously in a separate transaction.
Using a Platform Event to log integration data is the most efficient pattern. Because the logging happens asynchronously, it doesn't block the main business transaction. By publishing an event, a separate subscriber can handle the heavy lifting of storing the log in a custom object, ensuring the primary business operation remains performant while maintaining an audit trail for all outbound communications.
An enterprise development team uses Salesforce DX scratch orgs for feature development. A developer needs to ensure that unit tests execute automatically every time code is committed to the version control system. Which integration approach achieves this requirement?
Set up a CI/CD pipeline using GitHub Actions or Jenkins to spin up a scratch org, push metadata, and run sf apex test run.
Integrating CI/CD pipelines with version control hooks automates validation processes. Utilizing Salesforce CLI commands within CI runners guarantees that code meets quality gates and test coverage thresholds before merging into shared branches, protecting code health and reducing integration debt across large distributed development teams.
The SF-PD2 flashcard bank covers all 5 official blueprint domains published by Salesforce. Cards are distributed proportionally, so domains with higher exam weight have more cards.
Domain Coverage
Testing, Debugging, and Deployment
User Interface
Performance
Process Automation, Logic, and Integration
Advanced Developer Fundamentals
Both flashcards and practice questions are evidence-based study tools. The difference is in what they train:
Flashcards — concept retention
Best for memorising definitions, acronyms, protocol behaviours, command syntax, and conceptual distinctions. Use flashcards to build the foundational vocabulary that SF-PD2 questions assume you know.
Best in: weeks 1–3
Practice tests — application
Best for applying concepts to realistic scenarios, eliminating distractors, and building exam stamina.SF-PD2 questions test scenario reasoning — not just recall — so practice tests are essential.
Best in: weeks 3–6
The most effective SF-PD2 study plan combines both: use flashcards for the first 2–3 weeks to build conceptual foundations, then shift to practice tests and mock exams in the final 2–3 weeks to apply and benchmark that knowledge. Most candidates who pass on their first attempt use both tools.
Yes. Courseiva provides free SF-PD2 flashcards across all official exam domains. Every card includes the correct answer and a full explanation of why it is right and why the distractors are wrong. The platform also includes topic-based practice, mock exams, and readiness tracking — no account required.
Courseiva has 226+ original SF-PD2 flashcards across all 5 exam blueprint domains. New cards are added regularly as the question bank grows. All cards are checked against the official Salesforce exam objectives, with editorial oversight from an experienced network and security engineer.
Courseiva flashcards are purpose-built for IT certification exams. Unlike generic flashcard platforms where content quality varies, every Courseiva card is mapped to the official SF-PD2 exam blueprint, written by engineers who hold the certification, and includes a full explanation of the correct answer and why the distractors are wrong. This explanation quality is what separates genuine learning from rote memorisation.
Courseiva is a web platform — an internet connection is required. For offline study, we recommend creating free Courseiva account, using the platform in your browser, and using your device's offline capabilities if your browser supports offline web apps.
Save your results, see which domains need more work, and get spaced repetition recommendations — all free.
Sign Up FreeFree forever · Every certification included