Salesforce · Free Practice Questions · Last reviewed May 2026
24 real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
A developer wants to chain a second asynchronous job from within an executing Queueable Apex job. Which method should be used?
System.enqueueJob()
`System.enqueueJob()` is the only valid mechanism to chain a second asynchronous job from within an executing Queueable Apex context, directly satisfying the requirement to initiate a subsequent asynchronous process sequentially. Unlike future methods, which cannot be called from another asynchronous execution, `System.enqueueJob()` supports flexible job chaining by returning an ID that can be monitored, allowing developers to execute dependent asynchronous operations reliably within the Governor limit framework.
Database.executeBatch()
apexJob.schedule()
Future.runAsync()
A developer writes an Apex trigger that performs a SOQL query inside a standard for-loop processing Trigger.new. Which governor limit is most likely to be exceeded?
Total number of SQL queries issued (100)
A SOQL query inside a for-loop over Trigger.new executes once per record, so a bulk update of 200 records issues 200 queries, breaching the 100 synchronous SOQL query governor limit. The fix is querying once outside the loop into a map.
Total heap size (6 MB)
Total number of records retrieved by SOQL queries (50,000)
Total CPU time (10,000 milliseconds)
Which context variable should a developer use in an Apex trigger to determine if the trigger was fired by an update operation rather than an insert?
Trigger.isExecuting
Trigger.isBefore
Trigger.isInsert
Trigger.isUpdate
`Trigger.isUpdate` returns a Boolean value of true specifically when an update DML operation initiates the execution context, allowing developers to cleanly separate update logic from insert logic. This satisfies the stem constraint of determining whether an update operation fired the trigger rather than an insert, directly evaluating the operational event context provided by the platform runtime without requiring manual inspection of record ID fields.
An asynchronous method needs to be invoked from a standard trigger to perform callouts to an external web service. Which annotation is required for this asynchronous method?
@TestSetup
@future(callout=true)
Standard Salesforce triggers execute synchronously within a database transaction, which inherently prohibits direct outbound web service callouts to prevent blocking execution threads. Applying the `@future(callout=true)` annotation delegates the method execution to a separate thread that runs asynchronously once resources become available. This specific parameter explicitly lifts the platform restriction against making HTTP requests from asynchronous contexts, thereby satisfying the requirement to invoke callouts safely from a trigger.
@InvocableMethod
@ReadOnly
A developer implements a Schedulable class to run a daily cleanup job. What is the maximum number of scheduled Apex jobs that can be simultaneously active in an org?
500
50
100
Salesforce enforces a strict platform governor limit of 100 simultaneously active scheduled Apex jobs per organisation, which directly satisfies the scheduling constraint mentioned in the stem. When a developer programs a Schedulable class for daily execution using `System.schedule`, the resulting job enters the Apex queue and consumes one of these allocated slots. Attempting to schedule an excess job beyond this threshold throws a runtime exception, meaning administrators and developers must monitor active schedules to ensure daily automated routines remain within this capacity.
250
A developer needs to process 2 million records asynchronously, performing complex calculations and updating parent records in batches of 2,000. Which feature should the developer implement?
Queueable Apex
Batch Apex
Batch Apex handles millions of records asynchronously by splitting them into chunks of up to 2,000, each processed in a separate transaction with its own governor limits. This satisfies the 2 million record volume and the 2,000-record batch size constraint.
Future methods
Scheduled Apex
Want more Process Automation And Logic practice?
Practice this domainWhat is the maximum number of SOQL queries that can be issued in a single synchronous Apex transaction?
50
200
100
Salesforce enforces a strict governor limit of 100 SOQL queries per synchronous Apex transaction to ensure multi-tenant resource fairness. This constraint prevents any single process from monopolising database resources, which would otherwise degrade performance for other organisations sharing the same infrastructure. By restricting the total number of queries, the platform maintains consistent execution times and system stability. Developers must therefore optimise their code to batch data retrieval or utilise collections to remain within this defined threshold during their application logic.
500
A developer needs to ensure that an Apex class respects organization-wide defaults, role hierarchies, and sharing rules when querying custom objects. Which keyword should be added to the class definition?
enforce sharing
with sharing
Adding `with sharing` to the Apex class definition enforces record-level security by ensuring that Salesforce applies organization-wide defaults, role hierarchies, and sharing rules during SOQL queries on custom objects. By default, Apex runs in system mode and ignores user-based sharing settings, which would bypass these constraints. Declaring the class `with sharing` forces the execution context to respect the requesting user's specific record permissions, directly satisfying the requirement to restrict data visibility according to the defined sharing model.
without sharing
inherited sharing
An enterprise application requires Apex code to check whether the current user has read access to a specific custom field before displaying it in a custom Lightning Web Component. What is the most appropriate class to use?
System.Security
Schema.DescribeFieldResult
`Schema.DescribeFieldResult` provides the `isAccessible()` method, which directly evaluates the current user's field-level security permissions for a specific custom field. By invoking this method before rendering data in a Lightning Web Component, developers ensure that the application adheres to the principle of least privilege. This approach satisfies the requirement to verify read access programmatically, preventing unauthorised data exposure that could occur if the component relied solely on UI-level visibility without backend validation.
UserInfo
ApexPages.StandardController
A developer writes an Apex method that executes a SOQL query using user-supplied search parameters. How can the developer protect against SOQL injection vulnerabilities?
Execute the query using Database.queryWithBinds() with a restricted access modifier.
Use bind variables in the SOQL query instead of string concatenation.
Using bind variables satisfies the constraint of executing a SOQL query using user-supplied search parameters securely. When developers integrate dynamic user input via string concatenation, malicious actors can manipulate the query logic. By substituting string concatenation with bind variables (using the colon syntax, such as `:userInput`), the Salesforce platform treats the input strictly as a literal value rather than executable query syntax. This completely neutralises SOQL injection attempts, ensuring the query structure remains unaltered regardless of the input's content.
Use String.escapeSingleQuotes() on all user inputs before concatenating into the query string.
Enclose all dynamic parameters in single quotes within the dynamic SOQL query string.
Which Apex data type should a developer use to represent a precise geographic location with latitude and longitude coordinates?
Coordinate
Location
The built-in Apex `Location` data type directly satisfies the requirement for representing a precise geographic location with latitude and longitude coordinates. Unlike generic numeric or string variables, `Location` natively stores spatial data using compound fields, allowing developers to perform built-in distance calculations such as `EucDist` or `toMiles`. It ensures type safety and seamless integration with Salesforce geolocation fields and SOQL spatial functions like `DISTANCE()` and `GEOLOCATION()`, fulfilling the exact criteria specified in the stem.
Address
GeoPoint
A developer needs to store a collection of unique customer email addresses in Apex and check for existence efficiently. Which collection type should the developer use?
Queueable
List
Map
Set
Set stores only unique elements and provides constant-time contains() lookups via hashing, so duplicate emails collapse automatically and existence checks avoid scanning. This satisfies the uniqueness and efficient existence-checking constraints, which List and Map do not address as directly.
Want more Developer Fundamentals practice?
Practice this domainA developer wants to test an asynchronous future method. Where must the developer place the asynchronous code execution so that it runs synchronously and within the test context?
Inside a System.runAs() block
Within a try-catch block
Inside a Database.executeBatch block
Between Test.startTest() and Test.stopTest()
Placing the callout between Test.startTest() and Test.stopTest() forces asynchronous future methods to execute synchronously once Test.stopTest() runs, returning control only after completion. This satisfies the stem's requirement that the code runs within the test context, letting the developer assert on results immediately.
A developer is analyzing a debug log and notices that it is truncated because it exceeded the maximum file size limit. Which action should the developer take to capture only the relevant Apex code execution details without exceeding the limit?
Increase the maximum log file size in company profile settings.
Adjust the Trace Flag log levels to reduce verbosity for unnecessary categories like Database and Workflow.
Trace flag log levels control which categories are captured, so lowering verbosity on categories such as Database and Workflow reduces log volume, keeping the Apex execution details within the maximum debug log size and preventing truncation.
Disable all validation rules in the org temporarily.
Switch the debug log perspective to 'Development Harvester'.
A developer receives a System.LimitException: Too many SOQL queries: 101 when running a complex unit test. The test class inserts a large volume of test records that inadvertently cause a trigger to execute multiple queries inside a loop. What is the most effective way to reset the governor limits specifically for the code being tested?
Wrap the test assertion code between Test.startTest() and Test.stopTest().
Test.startTest() resets governor limits, giving the code between it and Test.stopTest() a fresh set of SOQL, DML and CPU allocations. Placing assertions inside that block isolates the tested logic from the 101-query limit already consumed by setup and trigger execution.
Mark the test method with @isTest(SeeAllData=true).
Wrap the trigger logic in a Database.setSavepoint() block.
Use Limits.getLimitQueries() inside the test method.
A developer is writing a unit test that executes under a specific user context to verify sharing rules. Which method should the developer use to specify the user for the subsequent test operations?
UserInfo.setUserId()
Database.setSavepoint()
Test.setCurrentUser()
System.runAs()
`System.runAs()` is the correct method because it forces test execution within a specified user context, allowing developers to enforce and verify user-specific sharing rules and record visibility. Standard unit tests run in the context of the user executing the test, ignoring record-level sharing by default unless this specific testing mechanism is employed.
A developer is writing a test method that performs a callout to an external REST service. Which interface must the developer implement to provide mock responses during the unit test execution?
InstallHandler
Schedulable
Database.Batchable
HttpCalloutMock
Implementing HttpCalloutMock lets the test supply a fake HTTP response via Test.setMock, so the callout never reaches the external REST service. This satisfies the requirement that mock responses be returned during unit test execution, since real callouts are blocked in tests.
A developer is using Salesforce CLI to create a temporary environment for feature development and testing that includes all source code and shape settings. Which CLI command should the developer use to create this temporary environment?
sf org login web
sf org create sandbox
sf project retrieve start
sf org create scratch
The `sf org create scratch` command directly satisfies the requirement to create a temporary, disposable environment for feature development and testing by provisioning a scratch org based on a defined configuration file and shape settings. This command connects to a Salesforce DX hub org to spin up a fully configurable, short-lived development workspace that encapsulates all source code and metadata, distinguishing it from commands that merely authenticate existing production or sandbox environments.
Want more Testing Debugging And Deployment practice?
Practice this domainA developer needs to retrieve Salesforce data in a Lightning Web Component without writing imperative Apex. Which module should be imported to use the wire service for standard record data?
lightning/platformShowErrorToast
lightning/navigation
lightning/uiRecordApi
`lightning/uiRecordApi` provides built-in wire adapters such as `getRecord`, which directly satisfies the requirement to retrieve standard record data without writing imperative Apex. By importing this standard module, a Lightning Web Component can declaratively access, read, and manipulate Salesforce record data via the Lightning Data Service architecture. This avoids the need for server-side controller methods, streamlining data retrieval while automatically managing caching, error handling, and UI synchronisation in compliance with the specified constraint.
lightning/apex
A developer creates a Visualforce page and wants to include standard Salesforce styling. Which attribute on the <apex:page> tag enables this?
lightningStylesheets="true"
standardStylesheets="true"
Setting the `standardStylesheets` attribute to true on the `<apex:page>` component directly satisfies the requirement to include standard Salesforce styling. By default, this attribute evaluates to true, which injects the core Salesforce stylesheet into the rendered HTML document. This mechanism ensures that standard user interface elements, such as input fields, labels, and buttons, automatically inherit the native Lightning or Salesforce Classic visual look and feel without requiring custom CSS definitions to be written manually by the developer.
applyHtmlTag="true"
sidebar="true"
A developer creates a custom LWC that wraps child components. The developer needs to pass styling from the parent component into specific slots of the child component. Which CSS selector should be used inside the child component to style content passed into a slot?
:content
:scope
:host
::slotted()
::slotted() targets elements assigned to a slot from the parent's light DOM, letting the child component style slotted content while respecting shadow DOM encapsulation. It satisfies the stem's constraint of passing styling into specific slots, unlike :host or ::part, which address the host element or exposed parts respectively.
A developer wants to style a Lightning Web Component using the Salesforce Lightning Design System (SLDS). What is the recommended way to include SLDS styling?
Use standard SLDS utility classes directly in the component's HTML template.
Using standard SLDS utility classes directly within the HTML template satisfies the recommended approach for styling Lightning Web Components without importing external stylesheets or custom static resources. The Salesforce Lightning Design System is natively available in the platform's component architecture, meaning developers can apply predefined design tokens and layout classes straight to the markup. This native integration ensures optimal performance, consistent branding aligned with Salesforce guidelines, and automatic adaptation to theme updates without requiring manual CSS maintenance.
Import the full SLDS stylesheet explicitly as a static resource.
Apply standard Bootstrap classes to match Salesforce themes.
Use inline styles exclusively for all components.
A developer is building a Lightning Web Component and needs to execute code as soon as the component is inserted into the DOM. Which lifecycle hook should be used?
renderedCallback
constructor
connectedCallback
The `connectedCallback` lifecycle hook executes automatically when a component is inserted into the DOM, satisfying the requirement to trigger code immediately upon mounting. Unlike the `constructor` which runs before the component is connected, this hook provides access to the element's properties and the DOM environment. It serves as the standard entry point for initialising data or performing setup tasks, ensuring that the component is fully integrated into the page structure before the logic begins to execute.
disconnectedCallback
Which SLDS utility class should a developer use to add a standard margin around a container?
slds-grid
slds-m-around_medium
The `slds-m-around_medium` utility class directly satisfies the requirement to add a standard margin around a container by applying a medium-sized spacing scale uniformly across all four sides. Salesforce Lightning Design System (SLDS) naming conventions structure spacing modifiers using the property prefix (`m` for margin), the modifier type (`around` for all sides), and the size specifier (`medium`), which ensures consistent layout dimensions and aligns precisely with the standard spacing constraint specified in the stem.
slds-padding_medium
slds-margin-all
Want more User Interface practice?
Practice this domainThe vendor does not publish an exact question count for the SALESFORCE-PD1; the exam lasts 105 minutes. The passing score is 68%. Always confirm current details on the vendor's official exam page.
Scenario-based questions covering exam objectives with detailed answer explanations.
The exam covers 4 domains: Process Automation And Logic, Developer Fundamentals, Testing Debugging And Deployment, User Interface. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official Salesforce SALESFORCE-PD1 exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.