HireHireInterview Quizzes › Salesforce Developer

Salesforce Developer Interview Questions

Think you're ready? These are the questions that actually decide Salesforce Developer interviews. Warm up on Easy — then face the Hard round, where 95% of candidates crumble. 80 questions across 3 levels, instant score, completely free.

80Questions
3Difficulty levels
95%Fail the hard round
FreeInstant score
Easy
Warm-up · 20 Qs
Medium
Practical · 30 Qs
Hard
Brutal · 30 Qs
⚡ Take the Salesforce Developer quiz — get your score →

The Salesforce Developer interview questions

Below are the real questions, grouped by difficulty. Expand any one to reveal the correct answer and why — or take the timed quiz for a score you can share. Can you clear the Hard round?

Easy round 20 questions

Your Apex trigger must query related records and update them for a batch of 200 inserted records. What is the correct way to avoid governor limits?
  • A. Put the SOQL query inside the for loop over Trigger.new
  • B. Query once outside the loop and use collections/maps ✓
  • C. Call the query recursively for each record
  • D. Use @future on every record individually
Correct answer: B. Bulkifying by querying once outside the loop and using maps avoids hitting SOQL-per-transaction limits.
A validation rule and a before-save flow both run on the same record update. In what order do they execute relative to each other?
  • A. Validation rules run after all flows and triggers
  • B. Before-save flows run, then validation rules run ✓
  • C. Validation rules always run first, before any automation
  • D. Both run simultaneously with no defined order
Correct answer: B. In the save order, before-save flows execute before standard validation rules run.
You need to reference the currently inserted records inside a before-insert trigger. Which context variable holds them?
  • A. Trigger.old
  • B. Trigger.new ✓
  • C. Trigger.oldMap
  • D. Trigger.newMap
Correct answer: B. Trigger.new holds the new versions of records; in before-insert their Ids are not yet populated but the records are available.
A SOQL query returns more than 50,000 rows and must process each. Which construct prevents heap and query-row limit errors?
  • A. A standard for loop over a List
  • B. A SOQL for loop that queries in batches ✓
  • C. Storing all rows in a single Map
  • D. Using @future to load them
Correct answer: B. A SOQL for loop retrieves records in batches of 200, keeping heap usage low for large result sets.
You must call an external REST API and wait for its response inside a Visualforce/LWC action. Which Apex approach is appropriate?
  • A. A @future method that returns the response
  • B. A synchronous callout in a method annotated for callouts ✓
  • C. A batch job scheduled nightly
  • D. A trigger performing the callout directly
Correct answer: B. A synchronous HTTP callout can return the response in-line to the UI; @future returns void and can't return data to the caller.
A user with a profile that lacks 'View All' on Accounts runs your Apex class declared 'without sharing'. What record access do they get?
  • A. Only records they own or are shared to them
  • B. All Account records, ignoring sharing rules ✓
  • C. No records at all
  • D. Only records in their role hierarchy
Correct answer: B. 'without sharing' ignores the running user's sharing rules, exposing records they otherwise couldn't see.
You want a child Contact to be deleted automatically when its parent custom record is deleted. Which relationship enforces this?
  • A. Lookup relationship
  • B. Master-detail relationship ✓
  • C. External lookup
  • D. Hierarchical relationship
Correct answer: B. Master-detail cascades delete from parent to child; lookups do not by default.
Your test class asserts trigger behavior but fails with 'no records'. What is the most likely correct fix?
  • A. Add SeeAllData=true to read org data
  • B. Create the needed test data inside the test method ✓
  • C. Query production records directly
  • D. Disable the trigger during the test
Correct answer: B. Best practice is to create your own test data in the test rather than relying on org data.
In an LWC, you need to call an Apex method and reactively refresh the UI when its parameter changes. Which is the idiomatic choice?
  • A. Imperative Apex call in the constructor
  • B. @wire the Apex method to a reactive property ✓
  • C. A setInterval polling loop
  • D. A direct SOQL query in JavaScript
Correct answer: B. @wire re-invokes the Apex method reactively when its reactive parameters change and provisions the data.
A flow needs to run only when a Case's Status changes from anything to 'Closed'. Which record-triggered flow condition setup is correct?
  • A. Run on create only
  • B. Run when a record is updated, with entry condition Status = Closed and 'only when requirements are newly met' ✓
  • C. Run on every save regardless of change
  • D. Run on delete
Correct answer: B. An update-triggered flow with 'only when requirements are newly met' fires precisely on the transition into Closed.
You get 'Too many SOQL queries: 101'. What is the root cause you should look for first?
  • A. A query returning too many fields
  • B. A SOQL query placed inside a loop ✓
  • C. Missing WHERE clause on one query
  • D. Querying a formula field
Correct answer: B. The 101-query error almost always comes from SOQL executed inside a loop; move it outside and bulkify.
A roll-up summary field is needed to sum child Opportunity amounts on the parent. Which relationship must exist for a declarative roll-up summary?
  • A. Lookup relationship
  • B. Master-detail relationship ✓
  • C. Many-to-many junction only
  • D. Self-relationship
Correct answer: B. Declarative roll-up summary fields require a master-detail relationship between parent and child.
You must prevent a trigger from firing itself recursively during an update it performs. What is a common correct technique?
  • A. Use a static Boolean flag to guard re-entry ✓
  • B. Add more SOQL queries
  • C. Switch the trigger to after-delete
  • D. Increase the CPU time limit
Correct answer: A. A static Boolean guard tracks whether the trigger already ran in the transaction, preventing recursion.
A SOQL query is `SELECT Name FROM Account WHERE Industry = :selectedIndustry`. What does the colon syntax do?
  • A. Comments out the value
  • B. Binds an Apex variable into the query ✓
  • C. Casts the field to a string
  • D. Escapes a reserved keyword
Correct answer: B. The colon is bind-variable syntax, safely injecting an Apex variable's value into SOQL.
You need to process 5 million records nightly without hitting per-transaction limits. Which Apex feature is designed for this?
  • A. A single synchronous method
  • B. Batch Apex implementing Database.Batchable ✓
  • C. A trigger on insert
  • D. A Visualforce controller
Correct answer: B. Batch Apex splits large data volumes into chunks, each with its own governor limits.
An after-insert trigger tries to modify a field on Trigger.new directly and fails. Why?
  • A. Trigger.new is read-only in after triggers ✓
  • B. After triggers cannot query records
  • C. Trigger.new is null in after triggers
  • D. You must use @future in after triggers
Correct answer: A. In after triggers the records are already saved and Trigger.new is read-only; use before triggers to modify same-record fields.
Your unit test must verify code behaves correctly for a user with a specific profile. Which construct isolates that execution context?
  • A. System.runAs(user) ✓
  • B. Test.startTest only
  • C. @future annotation
  • D. Database.rollback
Correct answer: A. System.runAs lets a test execute code in the context of a specified user's permissions and sharing.
A declarative before-save flow and an Apex before-insert trigger both set a default field. Which generally runs first in the save order?
  • A. The Apex before trigger runs before the before-save flow
  • B. The before-save flow runs before the Apex before trigger ✓
  • C. They run in random order
  • D. Only one is allowed per object
Correct answer: B. In Salesforce's order of execution, before-save (fast field update) flows run before before triggers.
You expose an Apex method to LWC. Which annotation makes it callable from the component?
  • A. @future
  • B. @AuraEnabled ✓
  • C. @isTest
  • D. @InvocableMethod
Correct answer: B. @AuraEnabled exposes Apex methods to Lightning components including LWC.
A callout from Apex fails with 'Unauthorized endpoint'. What configuration typically resolves it?
  • A. Increase the heap size
  • B. Add the endpoint as a Remote Site Setting or Named Credential ✓
  • C. Wrap the call in Test.startTest
  • D. Convert the method to @future
Correct answer: B. Salesforce blocks callouts to endpoints not registered as Remote Site Settings or Named Credentials.

Medium round 30 questions

You have a trigger on the Account object that needs to update related Contact records. To follow best practices and avoid hitting governor limits when 200 records are processed in a batch, how should you perform the DML on the Contacts?
  • A. Call an update statement inside the for loop that iterates over each Account
  • B. Collect the Contacts into a List and perform a single update DML statement after the loop ✓
  • C. Use a @future method for every Contact update individually
  • D. Perform a separate SOQL and update inside the loop for each Account
Correct answer: B. Bulkification requires collecting records into a collection and performing a single DML operation outside the loop to stay within governor limits.
A validation rule should fire only when a record is being created, not when it is edited. Which formula condition correctly restricts the rule to new records?
  • A. ISNEW() ✓
  • B. ISCHANGED(Id)
  • C. ISNULL(Id)
  • D. PRIORVALUE(Id) = null
Correct answer: A. The ISNEW() function returns true only when a record is being created, making it the correct way to limit a validation rule to inserts.
In Apex, you need to query Contacts and their parent Account's name in a single SOQL query. Which query correctly retrieves the Account name?
  • A. SELECT Id, Account.Name FROM Contact ✓
  • B. SELECT Id, (SELECT Name FROM Account) FROM Contact
  • C. SELECT Id, Account__r.Name FROM Contact
  • D. SELECT Id, Accounts.Name FROM Contact
Correct answer: A. For a child-to-parent relationship on a standard lookup, you traverse using dot notation with the relationship name (Account.Name).
Which statement about the difference between a Workflow Rule and Process Builder / Flow is most accurate for a developer choosing an automation tool today?
  • A. Workflow Rules can create related records, but Flows cannot
  • B. Flows can perform more complex logic like creating/updating unrelated records and calling Apex, which Workflow Rules cannot ✓
  • C. Workflow Rules run after Flows in the order of execution and can override them
  • D. Flows cannot send email alerts, so Workflow Rules are required for email
Correct answer: B. Flows are far more capable, able to create/update any records and invoke Apex, whereas Workflow Rules are limited to field updates, email alerts, tasks, and outbound messages.
You wrote a test method and need to verify that an exception is thrown when invalid data is inserted. What is the recommended pattern to assert that behavior?
  • A. Insert the record inside System.runAs() and check debug logs
  • B. Wrap the DML in a try-catch, and if no exception is caught call System.assert(false) to fail the test ✓
  • C. Use Test.isRunningTest() to skip the insert
  • D. Set the record to null and check that it equals null
Correct answer: B. The standard pattern is a try-catch where the catch verifies the expected exception, and reaching the line after the DML (via System.assert(false)) fails the test because no exception occurred.
A Lightning Web Component needs to call an Apex method and get data when the component loads, with the result automatically refreshed if the underlying data changes. Which approach is most appropriate?
  • A. Call the Apex method imperatively inside the constructor
  • B. Use the @wire decorator on the Apex method ✓
  • C. Use setInterval to poll the Apex method every second
  • D. Use a Visualforce remoting call
Correct answer: B. The @wire decorator reactively provisions data from an Apex method and integrates with Lightning Data Service caching, refreshing when tracked reactive values change.
In the Salesforce order of execution, when do 'before' triggers run relative to validation rules on a standard save?
  • A. Before triggers run after all validation rules complete
  • B. Before triggers run before system validation but the record's own validation rules run after before triggers ✓
  • C. Before triggers never run when validation rules exist
  • D. Validation rules and before triggers run simultaneously in random order
Correct answer: B. In the order of execution, before triggers execute, and then the record's custom validation rules run after them (after system validations for required fields).
You need to grant a group of users edit access to certain Opportunity records they do not own, based on a criteria like Region. Which sharing mechanism is the standard declarative tool for this?
  • A. Profiles
  • B. Permission Sets
  • C. Criteria-based sharing rules ✓
  • D. Field-level security
Correct answer: C. Sharing rules (owner- or criteria-based) open up record-level access beyond the org-wide default, which profiles and permission sets do not control.
A SOQL query in Apex might return zero rows. Which of the following will throw an exception if no rows are returned?
  • A. List<Account> accs = [SELECT Id FROM Account WHERE Name = 'X'];
  • B. Account acc = [SELECT Id FROM Account WHERE Name = 'X']; ✓
  • C. Integer c = [SELECT COUNT() FROM Account WHERE Name = 'X'];
  • D. for (Account a : [SELECT Id FROM Account WHERE Name = 'X']) {}
Correct answer: B. Assigning a SOQL query directly to a single sObject throws a QueryException (List has no rows) when zero rows are returned; assigning to a List safely returns an empty list.
Which governor limit is most directly relevant when you accidentally place a SOQL query inside a for loop iterating over 200 records?
  • A. The 100 SOQL queries per synchronous transaction limit ✓
  • B. The 10,000 DML rows per transaction limit
  • C. The 6 MB heap size limit
  • D. The 50,000 records returned by SOQL limit
Correct answer: A. A query inside a loop over many records quickly exceeds the 100 SOQL queries per synchronous transaction limit, which is the classic reason to move queries outside loops.
What is the maximum number of SOQL queries allowed in a synchronous Apex transaction?
  • A. 50
  • B. 100 ✓
  • C. 200
  • D. 300
Correct answer: B. Synchronous Apex allows up to 100 SOQL queries per transaction (200 for asynchronous).
What does it mean to 'bulkify' a trigger?
  • A. Processing collections of records instead of one at a time ✓
  • B. Deleting duplicate records automatically
  • C. Running triggers only at night
  • D. Bypassing all governor limits
Correct answer: A. Bulkification handles lists of records and moves SOQL/DML outside loops to respect governor limits.
In an update trigger, what does Trigger.new contain?
  • A. The old versions of updated records
  • B. A map of record IDs to profiles
  • C. The new versions of the records in the trigger ✓
  • D. The list of deleted record IDs only
Correct answer: C. Trigger.new holds the new versions of the records being inserted or updated.
Which is a valid way to run Apex asynchronously?
  • A. A standard trigger
  • B. A validation rule
  • C. A synchronous SOQL loop
  • D. A Queueable or @future method ✓
Correct answer: D. Queueable, @future, Batch, and Scheduled Apex all execute asynchronously.
What is the total number of DML rows allowed per Apex transaction?
  • A. 10,000 ✓
  • B. 5,000
  • C. 50,000
  • D. 1,000
Correct answer: A. A single transaction can process at most 10,000 DML rows across all DML statements.
Which feature grants record access declaratively (without code)?
  • A. Validation rules
  • B. Sharing rules ✓
  • C. Formula fields
  • D. Page layouts
Correct answer: B. Sharing rules open up record-level access based on criteria or ownership without any Apex.
How is a child-to-parent relationship traversed in SOQL?
  • A. A subquery in parentheses
  • B. A GROUP BY clause
  • C. Dot notation across the relationship ✓
  • D. A separate second query
Correct answer: C. Child-to-parent traversal uses dot notation (e.g., Contact.Account.Name) in the SELECT clause.
What is the minimum code coverage required to deploy Apex to production?
  • A. 50% and no assertions needed
  • B. 90% for the whole org
  • C. 100% on every class
  • D. At least 75% code coverage to deploy ✓
Correct answer: D. Salesforce requires at least 75% org-wide Apex code coverage for production deployment.
How does Apex make an outbound REST callout to an external system?
  • A. HttpRequest and Http callout classes ✓
  • B. A SOQL FOR UPDATE query
  • C. A Visualforce remote action only
  • D. A workflow outbound message only
Correct answer: A. Apex uses the HttpRequest/HttpResponse and Http classes to send REST callouts.
How do you avoid a Mixed DML error between setup and non-setup objects?
  • A. Wrapping everything in one trigger
  • B. Separating the DML into different transactions (e.g., via an async method) ✓
  • C. Increasing the heap size
  • D. Disabling sharing rules
Correct answer: B. Performing DML on setup and non-setup objects in separate transactions (often async) avoids the mixed DML error.
What is the maximum total number of records a synchronous transaction can retrieve via SOQL?
  • A. 50,000 ✓
  • B. 10,000
  • C. 100
  • D. 500,000
Correct answer: A. A single Apex transaction can retrieve at most 50,000 records across all SOQL queries.
How many SOQL queries can be issued in a single synchronous Apex transaction?
  • A. 100 ✓
  • B. 150
  • C. 50
  • D. 200
Correct answer: A. Synchronous Apex allows 100 SOQL queries per transaction (asynchronous allows 200).
Which annotation runs an Apex method asynchronously in a separate thread?
  • A. @future ✓
  • B. @AuraEnabled
  • C. @isTest
  • D. @ReadOnly
Correct answer: A. @future marks a method to run asynchronously when platform resources are available.
To avoid hitting DML governor limits in a trigger, you should:
  • A. Bulkify logic by performing DML on collections outside loops ✓
  • B. Place DML statements inside for loops
  • C. Create additional triggers on the object
  • D. Request a higher limit from Salesforce
Correct answer: A. Bulkifying by collecting records and doing one DML outside loops keeps you within per-transaction limits.
What does the 'with sharing' keyword enforce on an Apex class?
  • A. The record-level sharing rules of the running user ✓
  • B. Only field-level security
  • C. Only object-level CRUD permissions
  • D. Nothing at runtime
Correct answer: A. 'with sharing' makes the class respect the running user's record-level sharing/access rules.
Which statement about Apex test classes is correct?
  • A. By default they don't see org data and must create their own test data ✓
  • B. They always have access to all org data
  • C. They cannot create any records
  • D. They execute automatically in production without deployment
Correct answer: A. Tests run in isolation and must set up their own data unless @isTest(SeeAllData=true) is used.
What is the minimum overall Apex code coverage required to deploy to production?
  • A. 75% ✓
  • B. 100%
  • C. 50%
  • D. 90%
Correct answer: A. Salesforce requires at least 75% code coverage to deploy Apex to a production org.
Which async Apex mechanism is best suited to process millions of records in manageable chunks?
  • A. Batch Apex implementing Database.Batchable ✓
  • B. A single @future call
  • C. One Queueable job with no chaining
  • D. A record trigger
Correct answer: A. Batch Apex splits a large record set into batches, each with its own governor limits.
In a master-detail relationship, deleting the master record causes what?
  • A. Cascade deletion of the related detail records ✓
  • B. The detail records to become orphaned
  • C. The delete to be blocked entirely
  • D. The detail records to convert to lookups
Correct answer: A. Master-detail relationships enforce cascade delete of detail records when the master is deleted.
Which annotation exposes an Apex method so a Lightning Web Component can call it?
  • A. @AuraEnabled ✓
  • B. @RemoteAction
  • C. @future
  • D. @InvocableMethod
Correct answer: A. @AuraEnabled exposes Apex methods to Lightning components (Aura and LWC).

Hard round 30 questions

You must update 10,000 User records (setup) and 10,000 related Account records (non-setup) in response to a single button click, and both updates are genuinely required together. Doing both DMLs in one synchronous transaction throws a MixedDML exception. Which approach correctly resolves this while keeping both updates?
  • A. Wrap the User DML in Database.update with allOrNone=false so partial success suppresses the MixedDML error
  • B. Perform the Account DML synchronously and move the User DML into a @future method (or Queueable) so it runs in a separate transaction ✓
  • C. Add 'without sharing' to the class so setup and non-setup objects share the same DML context
  • D. Reorder the statements so the setup-object DML always executes before the non-setup DML in the same transaction
Correct answer: B. MixedDML is resolved by separating setup and non-setup DML into different transactions, typically by deferring one to an async @future or Queueable method.
Consider this Batch class: ``` global class Recalc implements Database.Batchable<sObject>, Database.Stateful { global Integer total = 0; global void execute(Database.BatchableContext bc, List<Account> scope){ total += scope.size(); // ... work ... } } ``` A batch of 1,000,000 records runs with scope size 200. Midway, execute() throws an unhandled exception in one chunk. What happens?
  • A. The entire batch rolls back and total resets to 0 across all chunks
  • B. Only the failing chunk's DML is rolled back; other chunks already committed remain committed, and total retains its accumulated value from successful chunks ✓
  • C. The batch pauses and can be resumed from the exact failed record via Database.resume()
  • D. All subsequent chunks are skipped and the batch is marked Completed with partial data
Correct answer: B. Each Batch execute() chunk is its own transaction, so a failure rolls back only that chunk while committed chunks persist and Database.Stateful preserves accumulated instance state.
In the Salesforce Order of Execution, a before-insert trigger sets Field_A, a Validation Rule references Field_A, a Flow (record-triggered, after-save) updates Field_B, and a Workflow field update sets Field_C. Which sequence is correct for a single record insert?
  • A. Validation Rule -> before trigger -> after trigger -> Workflow -> Flow
  • B. before trigger -> Validation Rules -> after trigger -> after-save Flow -> Workflow field update -> (re-fire triggers if workflow updated a field) ✓
  • C. Flow -> before trigger -> Validation Rule -> Workflow -> after trigger
  • D. before trigger -> after trigger -> Validation Rule -> Workflow -> Flow (Flow always runs last, after commit)
Correct answer: B. Before triggers run first, then system+custom validation, then after triggers, then after-save flows, then workflow rules whose field updates can re-fire before/after triggers a second time.
A recursion-prevention pattern uses a static Boolean flag set to true on first trigger entry and never reset. Within a single transaction, a legitimate later update to those same records needs the trigger logic to run again. What is the risk of this exact static-flag design?
  • A. Static flags reset between batch execute() chunks, so recursion is never actually prevented at scale
  • B. A never-reset static flag can over-suppress legitimate re-entry, silently skipping trigger logic for records that genuinely need reprocessing within the same transaction ✓
  • C. Static variables are shared across concurrent user sessions, causing one user's flag to block another's trigger
  • D. The trigger depth limit of 16 makes static flags redundant, so the flag has no effect at all
Correct answer: B. A static flag that is set once and never reset blocks all subsequent legitimate re-entry in the same transaction, over-suppressing valid reprocessing rather than just breaking the recursive loop.
You have a SOQL query `SELECT Id FROM Contact WHERE Custom_Status__c = 'Active'` running against 8 million Contacts. It throws a non-selective query error in a trigger. Custom_Status__c has only two possible values ('Active'/'Inactive') split roughly 50/50. Which action will make this query selective?
  • A. Add a custom index on Custom_Status__c; the index makes any filtered field selective regardless of value distribution
  • B. Nothing on that field alone will help because the low-cardinality filter matches ~4M rows, exceeding the selectivity threshold; add a selective, indexed, high-cardinality filter (e.g., a bounded date/Id range) ✓
  • C. Wrap the query with WITH SECURITY_ENFORCED, which forces the optimizer to use a selective path
  • D. Convert it to a skinny table query, which removes all selectivity thresholds
Correct answer: B. A filter matching ~50% of 8M rows can never be selective even if indexed, because it exceeds the optimizer's row thresholds; you need an additional high-cardinality selective filter.
An LWC uses `@wire(getContacts, { accountId: '$recordId' }) contacts;` against a `cacheable=true` Apex method. A separate LWC in the same app inserts a new Contact via imperative Apex. The wired list does not show the new Contact even after the insert succeeds. What is the correct fix?
  • A. Set cacheable=false on getContacts so the wire always hits the server
  • B. Call refreshApex(this.contacts) after the insert completes, passing the wired provisioned value to invalidate the client cache and re-fetch ✓
  • C. Reassign this.recordId to itself to force the '$recordId' reactive parameter to re-trigger
  • D. Move the query into connectedCallback with an imperative call, since @wire cannot display server data
Correct answer: B. refreshApex on the stored wired reference invalidates the Lightning Data Service cache for that cacheable method and re-provisions fresh data, unlike changing an unrelated reactive variable.
You must call an external REST API from a trigger's after-insert context to enrich 200 newly created Leads, and the API allows only one record per request. You also need to respect the external API's rate limits with sequential ordering. Which async design is BEST?
  • A. Use a single @future(callout=true) method that loops 200 times issuing callouts, since @future runs asynchronously
  • B. Use a Queueable that processes a bounded batch of records and chains to the next Queueable (System.enqueueJob in execute) to enforce sequential ordering and stay within callout limits per transaction ✓
  • C. Call the API directly in the after-insert trigger; triggers permit callouts as long as they are wrapped in a try/catch
  • D. Use a Scheduled Apex job firing every minute to poll for new Leads and process them in bulk
Correct answer: B. Queueable chaining gives sequential ordering, per-transaction callout budgets, and controlled throughput, whereas @future can't chain and is limited to callouts with no ordering guarantee.
A class declared `public with sharing` calls a helper method in a second class declared `public without sharing`. The helper runs a SOQL query returning records the running user cannot see via sharing rules. What data does the query return?
  • A. Records are filtered by the calling class's 'with sharing', because sharing is inherited down the call stack
  • B. The query in the 'without sharing' helper runs in system mode for sharing and returns all matching records regardless of the user's sharing access ✓
  • C. A runtime exception is thrown because mixing with/without sharing in one call stack is disallowed
  • D. Sharing is enforced only if the helper is 'inherited sharing'; 'without sharing' always throws an FLS error
Correct answer: B. Sharing enforcement is determined by the sharing keyword of the class where the SOQL executes, so a 'without sharing' helper ignores the caller's 'with sharing' and returns all rows.
Which Apex test correctly verifies a callout without making a real HTTP request AND asserts bulk behavior?
  • A. Use Test.setMock(HttpCalloutMock.class, new MyMock()) before Test.startTest(), insert 200 records to trigger the callout logic, then assert results after Test.stopTest() ✓
  • B. Use SeeAllData=true so the test hits the real endpoint with production credentials for realism
  • C. Wrap the callout in Test.startTest()/stopTest() only; the platform auto-mocks any HTTP callout inside that block
  • D. Insert one record and assert a 200 status code, since bulk paths behave identically to single-record paths
Correct answer: A. HttpCalloutMock registered via Test.setMock stubs the HTTP response, and inserting 200 records inside start/stopTest exercises the bulk/async path and forces async completion before assertions.
A Platform Event subscriber (Apex trigger on the event) processes high-volume events. During a spike, some events appear to be processed twice. Which statement about the delivery semantics is correct here?
  • A. Platform Events guarantee exactly-once delivery, so duplicate processing indicates a code bug unrelated to the platform
  • B. Platform Event subscribers get at-least-once delivery and can be re-delivered (e.g., after an unhandled exception or EventBus.RetryableException), so subscribers must be idempotent ✓
  • C. Events are delivered in strict transactional lock-step with the publisher's commit, so a failed subscriber rolls back the publisher
  • D. Replay IDs guarantee no event is ever delivered more than once as long as you store the last replay ID
Correct answer: B. Platform Event delivery is at-least-once with possible retries/redelivery, so subscribers must be written idempotently to tolerate duplicate processing.
In the Salesforce order of execution, when do custom validation rules run relative to before triggers?
  • A. Validation rules run before all triggers
  • B. Validation rules replace before triggers
  • C. Validation rules run after before triggers ✓
  • D. Validation rules run after after triggers
Correct answer: C. Before triggers execute first, then system and custom validation rules run before the record is saved.
What is the maximum number of @future method invocations allowed per Apex transaction?
  • A. 50 ✓
  • B. 10
  • C. 100
  • D. 200
Correct answer: A. A transaction can enqueue at most 50 @future method calls.
Which statement about Queueable vs @future Apex is correct?
  • A. Future methods can be chained and accept sObjects
  • B. Queueable supports job chaining and non-primitive parameters ✓
  • C. Both run strictly synchronously
  • D. Neither can perform callouts
Correct answer: B. Queueable can chain jobs and accept sObjects/complex types, unlike @future which only takes primitives.
What is the standard way to prevent a trigger from recursing infinitely?
  • A. Add more SOQL queries
  • B. Increase governor limits
  • C. Use a before and after trigger together
  • D. Use a static Boolean flag to guard re-entry ✓
Correct answer: D. A static variable persists across the transaction and lets the trigger skip re-execution after the first run.
What is the Apex heap size limit for a synchronous transaction?
  • A. 6 MB ✓
  • B. 12 MB
  • C. 3 MB
  • D. 1 MB
Correct answer: A. Synchronous Apex has a 6 MB heap limit; asynchronous Apex gets 12 MB.
What does the WITH SECURITY_ENFORCED clause in SOQL do?
  • A. Locks records against concurrent edits
  • B. Runs the query asynchronously
  • C. Enforces field- and object-level security in the query ✓
  • D. Bypasses sharing rules for the query
Correct answer: C. WITH SECURITY_ENFORCED throws an exception if the running user lacks read access to referenced fields/objects.
What do the 'with sharing' / 'without sharing' keywords on an Apex class control?
  • A. Field-level security on every field
  • B. Record-level access via sharing rules ✓
  • C. The API version of the class
  • D. Whether triggers fire in order
Correct answer: B. These keywords determine whether the class respects the running user's record-level sharing, not FLS.
Which statement correctly distinguishes Change Data Capture from Platform Events?
  • A. Both can only be consumed inside Apex
  • B. CDC is synchronous while platform events are not
  • C. Platform events store data in objects permanently
  • D. Change Data Capture auto-publishes on record changes; platform events are custom-defined messages ✓
Correct answer: D. CDC automatically emits change events for record modifications, whereas platform events are developer-defined and explicitly published.
What is the main advantage of using a SOQL for-loop (for (Account a : [SELECT ...]))?
  • A. It retrieves records in batches of 200 to reduce heap usage ✓
  • B. It bypasses the SOQL query limit
  • C. It commits DML automatically
  • D. It runs the query asynchronously
Correct answer: A. The SOQL for-loop processes query results in chunks of 200, keeping heap usage low for large result sets.
A Mixed DML Operation error occurs when a single transaction performs DML on which combination?
  • A. Two triggers fire on the same object
  • B. More than 100 SOQL queries run
  • C. Setup and non-setup objects in the same transaction ✓
  • D. A SOQL query returns over 50,000 rows
Correct answer: C. Mixing DML on setup objects (like User or Group) and non-setup objects in one transaction raises a Mixed DML error.
In the Apex trigger order of execution, when do custom validation rules run relative to before triggers?
  • A. After before triggers, before the record is committed ✓
  • B. Before any before triggers execute
  • C. After all after triggers execute
  • D. They never run in the same transaction as triggers
Correct answer: A. In the save order, before triggers fire first, then custom validation rules run before the record is saved.
What is the standard best practice to prevent unintended trigger recursion?
  • A. Use a static Boolean flag in a helper class to block re-entry ✓
  • B. Add more triggers on the same object
  • C. Move all logic into @future methods
  • D. Deactivate the trigger during runtime
Correct answer: A. A static variable persists across the transaction, letting you guard against re-executing trigger logic.
Which statement comparing Queueable Apex and @future methods is correct?
  • A. Queueable supports job chaining and non-primitive (sObject) parameters ✓
  • B. @future methods support chaining directly
  • C. @future methods accept sObject parameters
  • D. Queueable jobs cannot be monitored via job ID
Correct answer: A. Queueable accepts complex types and returns a job ID for chaining/monitoring, unlike @future.
Why must a SOQL filter on a large object use a selective, indexed field?
  • A. To avoid a non-selective query error from a full table scan ✓
  • B. To raise the org's governor limits
  • C. To bypass the running user's sharing rules
  • D. To reduce required test coverage
Correct answer: A. Salesforce throws a non-selective query exception when a query on a large object can't use an index efficiently.
What triggers a MIXED_DML_OPERATION error?
  • A. Performing DML on setup and non-setup objects in the same transaction ✓
  • B. Executing two insert statements consecutively
  • C. Querying two different objects in one method
  • D. Using an upsert statement
Correct answer: A. Setup objects (like User) and non-setup objects can't be modified in the same transaction without async separation.
How does Database.insert(records, false) handle a partial failure in a bulk operation?
  • A. It commits the successful records and returns per-record Save Results ✓
  • B. It rolls back the entire batch
  • C. It throws immediately and stops on the first error
  • D. It automatically retries all failed records
Correct answer: A. Passing allOrNone=false lets valid records save while returning individual success/error results for each.
Which mechanism grants record-level access programmatically at runtime?
  • A. Apex managed sharing via share object rows ✓
  • B. Assigning a profile
  • C. Assigning a permission set
  • D. Setting field-level security
Correct answer: A. Apex managed sharing inserts rows into an object's __Share table to grant record access programmatically.
Which is a genuine limitation of @future methods?
  • A. They cannot return a value and cannot call another @future method ✓
  • B. They can return values to the caller
  • C. They can be chained without limits
  • D. They accept sObjects as parameters
Correct answer: A. @future methods must be void, take only primitives/collections of primitives, and can't invoke other @future methods.
In LWC, how does a child component communicate an event up to its parent?
  • A. It dispatches a CustomEvent that the parent listens for ✓
  • B. It directly mutates the parent's properties
  • C. It applies @api to the parent component
  • D. It can only use a pub-sub library
Correct answer: A. Child-to-parent communication in LWC uses CustomEvent dispatch with the parent binding an event handler.
When a 'without sharing' class is invoked from a 'with sharing' class, how is sharing enforced?
  • A. Code in the 'without sharing' class runs without sharing enforcement ✓
  • B. Sharing is always inherited as 'with sharing' from the caller
  • C. The call throws a sharing violation exception
  • D. Field-level security is enforced instead of sharing
Correct answer: A. Sharing is determined by the class where the executing code is declared, so the inner class runs without sharing.

Prep for another role

Questions are original, written and independently verified for HireHire's role interview quizzes. They reflect the kind of knowledge Salesforce Developer interviews test, not any specific company's questions. HireHire maps live tech & IT jobs across India, updated regularly. Last updated: August 2026.