31 Most Asked Salesforce Interview Questions Across 25+ Companies (2026)

🔥 Ranked by Frequency
31 Most Asked Salesforce Interview Questions
Not another random list — these are the exact questions that repeat across Accenture, TCS, Infosys, Deloitte, PwC, EY, Capgemini, Cognizant, IBM, KPMG and 15+ more companies, ranked by how often they actually show up. 100% Free, no signup.
31
Questions
25+
Companies Analyzed
4
Frequency Tiers
100%
Free
Every question below was cross-referenced against real interview reports from 25+ companies — Accenture, TCS, Infosys, Deloitte, PwC, EY, Capgemini, Cognizant, IBM, KPMG, NTT Data, Genpact, and more. The frequency tag on each question is an approximate count based on how many distinct company transcripts it appeared in — not an exact statistic, but a genuine reflection of what keeps coming up. If you only have time to prepare a handful of questions before an interview, start with Tier 1. Deep-dive topic guides also available: LWC, Apex Triggers, and Record Sharing & Security.

🔥 Tier 1 — Asked at Nearly Every Company

Q1–Q10 · The genuine repeat-offenders across 25+ companies

Q1
Explain Parent-to-Child and Child-to-Parent communication in LWC, and how do unrelated components communicate?
✅ Direct Answer
Parent to Child: pass data via an @api-decorated public property on the child, referenced as an attribute in the parent's template. Child to Parent: the child dispatches a CustomEvent that the parent listens for. Unrelated components: Lightning Message Service (LMS) via a declared Message Channel.
💡 Why?
This is, without exaggeration, the single most repeated LWC question across every company in the dataset — it shows up in almost every interview transcript regardless of seniority level. For the complete syntax, decorator behavior, and code examples, see our dedicated LWC Interview Questions guide.
🌍 Real World Example
A dashboard with a filter component (parent) and a results-table component (child) uses @api to pass the selected filter down, and a CustomEvent to notify the parent when the user clicks a row in the results table.
🔑 Key Points for Interviewer
  • Asked at 25+ companies — seen at Accenture, TCS, Infosys, Deloitte, PwC, EY, Capgemini, Cognizant, IBM, KPMG, NTT Data, Genpact, Wipro, HCL, LTIMindtree, Coforge, and more
  • This is, without exaggeration, the single most repeated LWC question across every company in the dataset — it shows up in almost every interview transcript regardless of seniority level.
🎤 One-Line Answer
“Parent to Child: pass data via an @api-decorated public property on the child, referenced as an attribute in the parent's template.”
Q2
What is the difference between with sharing, without sharing, and inherited sharing in Apex?
✅ Direct Answer
with sharing enforces the running user's record-level sharing rules; without sharing ignores them entirely regardless of caller context; inherited sharing adopts the sharing mode of whatever class called it, defaulting to with sharing only when it's the actual entry point of the transaction.
💡 Why?
The default behavior when no keyword is declared at all is without sharing — a detail interviewers frequently follow up on immediately after the main definition. inherited sharing exists specifically for reusable utility classes that need to behave correctly regardless of which context calls them.
🌍 Real World Example
A generic "get related records" utility class marked inherited sharing behaves securely when called from a Community-facing controller, and correctly runs permissively when explicitly invoked from an admin data-migration script marked without sharing.
🔑 Key Points for Interviewer
  • Asked at 20+ companies — seen at Accenture, TCS, Infosys, Deloitte, EY, Capgemini, KPMG, Genpact, IBM, NTT Data, Zscaler
  • The default behavior when no keyword is declared at all is without sharing — a detail interviewers frequently follow up on immediately after the main definition.
🎤 One-Line Answer
“with sharing enforces the running user's record-level sharing rules; without sharing ignores them entirely regardless of caller context; inherited sharing adopts the sharing mode of whatever class...”
Q3
What is the difference between Future methods, Queueable Apex, and Batch Apex — and when do you use each?
✅ Direct Answer
Future methods: simple, primitive params only, no chaining. Queueable: accepts complex/sObject parameters, chainable, trackable via Job Id. Batch Apex: processes up to 50 million records in scoped chunks via start/execute/finish.
💡 Why?
The follow-up question asked almost every single time: "Can you call a future method from another future method?" — the answer is no, that throws a runtime exception. Queueable jobs CAN chain (one job per async chain), which is exactly why Queueable is now generally preferred over future methods for anything beyond the simplest fire-and-forget case.
🌍 Real World Example
A nightly price recalculation across 2 million Products uses Batch Apex specifically for scoped-chunk processing; a one-off "send this single confirmation email" uses a simple future method since there's no chaining or complex parameter need.
🔑 Key Points for Interviewer
  • Asked at 20+ companies — seen at Accenture, TCS, Infosys, Deloitte, PwC, EY, Cognizant, IBM, Capgemini, NTT Data
  • The follow-up question asked almost every single time: "Can you call a future method from another future method?" — the answer is no, that throws a runtime exception.
🎤 One-Line Answer
“Future methods: simple, primitive params only, no chaining. Queueable: accepts complex/sObject parameters, chainable, trackable via Job Id.”
Q4
Explain the Order of Execution in Salesforce when a record is saved.
✅ Direct Answer
Roughly: system validation → before-save Flows and before triggers → duplicate rules → other validation rules → after-save Flows and after triggers → assignment/auto-response rules → workflow rules (legacy) → roll-up summary recalculation → post-commit async logic (future, Queueable, Platform Events).
💡 Why?
The detail interviewers specifically probe for: before-save (fast field update) Flow logic runs before validation rules, meaning a Flow can set a value that a Validation Rule then checks against — reversing that assumption is a very common "why did my validation fail" bug in real orgs.
🌍 Real World Example
A before-save Flow defaults a blank Region field based on Country before a Validation Rule requiring Region to be non-blank ever evaluates — get that order backwards and the validation rule breaks unexpectedly.
🔑 Key Points for Interviewer
  • Asked at 18+ companies — seen at TCS, Infosys, Deloitte, Accenture, EY, Capgemini, PwC, Cognizant, Genpact
  • The detail interviewers specifically probe for: before-save (fast field update) Flow logic runs before validation rules, meaning a Flow can set a value that a Validation Rule then checks against — reversing that assumption is a very common "why did my validation fail" bug in real orgs.
🎤 One-Line Answer
“Roughly: system validation → before-save Flows and before triggers → duplicate rules → other validation rules → after-save Flows and after triggers → assignment/auto-response rules → workflow rules...”
Q5
What is the difference between Custom Settings and Custom Metadata Types, and when do you use which?
✅ Direct Answer
Custom Settings store configuration data accessible without a SOQL query (doesn't count against governor limits) but doesn't deploy with metadata packages; Custom Metadata Types ARE deployable metadata that moves automatically with packages/change sets, and is queryable like records.
💡 Why?
For anything environment-specific that needs to travel with a deployment (API endpoints, feature toggles), Custom Metadata is now the generally preferred choice — Custom Settings remain useful mainly for legacy compatibility or genuinely org-specific runtime data that shouldn't move between environments.
🌍 Real World Example
An integration endpoint URL that differs between Dev, QA, and Production is a textbook Custom Metadata use case — it deploys automatically as part of the release instead of needing manual re-entry in every environment.
🔑 Key Points for Interviewer
  • Asked at 18+ companies — seen at Accenture, TCS, Infosys, Deloitte, PwC, Capgemini, KPMG, IBM, NTT Data
  • For anything environment-specific that needs to travel with a deployment (API endpoints, feature toggles), Custom Metadata is now the generally preferred choice — Custom Settings remain useful mainly for legacy compatibility or genuinely org-specific runtime data that shouldn't move between environments.
🎤 One-Line Answer
“Custom Settings store configuration data accessible without a SOQL query (doesn't count against governor limits) but doesn't deploy with metadata packages; Custom Metadata Types ARE deployable...”
Q6
Can we call a Future method from another Future method? What about a Queueable from a Queueable?
✅ Direct Answer
No, a future method cannot call another future method — it throws a runtime exception. Yes, a Queueable job CAN call another Queueable job — this is called Queueable chaining, limited to one chained job per async execution.
💡 Why?
This exact pairing of questions is asked back-to-back so consistently across companies that it's effectively one combined question in practice — always answer both halves even if only one is explicitly asked, since the follow-up is almost guaranteed.
🔑 Key Points for Interviewer
  • Asked at 17+ companies — seen at TCS, Accenture, Infosys, Deloitte, EY, Capgemini, Genpact, KPMG
  • This exact pairing of questions is asked back-to-back so consistently across companies that it's effectively one combined question in practice — always answer both halves even if only one is explicitly asked, since the follow-up is almost guaranteed.
🎤 One-Line Answer
“No, a future method cannot call another future method — it throws a runtime exception.”
Q7
What are Lifecycle Hooks in LWC, and in what order do they fire?
✅ Direct Answer
constructor() → connectedCallback() → render() → renderedCallback(), with disconnectedCallback() firing on removal from the DOM. See our LWC Interview Questions guide for when to use each hook specifically.
💡 Why?
The near-universal follow-up: "When is @wire called relative to connectedCallback?" — @wire fires after connectedCallback() but before the initial render, and is reactive from the start rather than something manually triggered.
🔑 Key Points for Interviewer
  • Asked at 16+ companies — seen at Accenture, TCS, Infosys, PwC, Deloitte, Capgemini, IBM, NTT Data
  • The near-universal follow-up: "When is @wire called relative to connectedCallback?" — @wire fires after connectedCallback() but before the initial render, and is reactive from the start rather than something manually triggered.
🎤 One-Line Answer
“constructor() → connectedCallback() → render() → renderedCallback(), with disconnectedCallback() firing on removal from the DOM.”
Q8
Write a trigger: whenever an Account's email is updated, update the related Contact's email field to match. (Or the reverse — Contact updates Account.)
✅ Direct Answer
On the source object's after update, detect the actual field change by comparing Trigger.new against Trigger.oldMap, then bulk-query and update the related records in a single DML statement.
💡 Why?
This near-identical trigger scenario — swap "email" for "billing city," "phone," or any other field — is asked in some variant at almost every single company in this dataset. Memorize the change-detection + bulk-update pattern once and you can answer any variant of it instantly.
trigger AccountEmailSync on Account (after update) { Set<Id> changedIds = new Set<Id>(); for (Account acc : Trigger.new) { if (acc.Email__c != Trigger.oldMap.get(acc.Id).Email__c) changedIds.add(acc.Id); } if (changedIds.isEmpty()) return; Map<Id, Account> accMap = new Map<Id, Account>([SELECT Id, Email__c FROM Account WHERE Id IN :changedIds]); List<Contact> toUpdate = [SELECT Id, AccountId, Email FROM Contact WHERE AccountId IN :changedIds]; for (Contact c : toUpdate) c.Email = accMap.get(c.AccountId).Email__c; update toUpdate; }
🔑 Key Points for Interviewer
  • Asked at 16+ companies — seen at TCS, Accenture, Infosys, Deloitte, EY, PwC, Genpact
  • This near-identical trigger scenario — swap "email" for "billing city," "phone," or any other field — is asked in some variant at almost every single company in this dataset.
🎤 One-Line Answer
“On the source object's after update, detect the actual field change by comparing Trigger.new against Trigger.oldMap, then bulk-query and update the related records in a single DML statement.”
Q9
How do you avoid recursive triggers? (Interviewers explicitly expect more than a static Boolean.)
✅ Direct Answer
A static Boolean flag works for simple single-pass recursion, but the more robust pattern is a static Set of "already processed" record Ids checked at the top of the handler, so a legitimate second update to a *different* record in the same transaction still processes correctly.
💡 Why?
Nearly every interviewer who asks this question adds the exact same caveat: "more than just a static Boolean" — meaning they specifically want to hear the Set pattern, not the simpler (and blunter) Boolean flag version.
private static Set<Id> processedIds = new Set<Id>(); for (Account acc : Trigger.new) { if (processedIds.contains(acc.Id)) continue; processedIds.add(acc.Id); // trigger logic }
🔑 Key Points for Interviewer
  • Asked at 15+ companies — seen at Accenture, TCS, Deloitte, PwC, Capgemini, IBM, KPMG
  • Nearly every interviewer who asks this question adds the exact same caveat: "more than just a static Boolean" — meaning they specifically want to hear the Set pattern, not the simpler (and blunter) Boolean flag version.
🎤 One-Line Answer
“A static Boolean flag works for simple single-pass recursion, but the more robust pattern is a static Set of 'already processed' record Ids checked at the top of the handler, so a legitimate second...”
Q10
What is the difference between SOQL and SOSL?
✅ Direct Answer
SOQL queries a single object type (with optional related-object sub-queries) with full filtering, sorting, and aggregation support; SOSL performs a text search across multiple object types simultaneously in one call, with more limited filtering.
💡 Why?
SOSL is the right tool specifically when you don't know in advance which object type contains a match (searching an email across Leads AND Contacts at once); for anything with a known target object and precise filter criteria, SOQL is almost always the better fit.
🔑 Key Points for Interviewer
  • Asked at 14+ companies — seen at TCS, Accenture, Infosys, Deloitte, PwC, Capgemini
  • SOSL is the right tool specifically when you don't know in advance which object type contains a match (searching an email across Leads AND Contacts at once); for anything with a known target object and precise filter criteria, SOQL is almost always the better fit.
🎤 One-Line Answer
“SOQL queries a single object type (with optional related-object sub-queries) with full filtering, sorting, and aggregation support; SOSL performs a text search across multiple object types...”

⭐ Tier 2 — Very Common Across Companies

Q11–Q20 · Shows up at most companies, especially 3-5 YOE interviews

Q11
What is Mixed DML Exception, and how do you resolve it?
✅ Direct Answer
Thrown when you try to perform DML on Setup objects (User, Group, GroupMember) and non-Setup objects (Account, custom objects) in the same transaction. Resolve it by wrapping the Setup-object DML in System.runAs(), which executes in a separate transaction context.
💡 Why?
This most commonly bites developers inside test classes, where creating a test User alongside test business data in the same method is a very natural thing to want to do — System.runAs() is specifically the fix for exactly that test-context scenario.
System.runAs(new User(Id = UserInfo.getUserId())) { insert testUser; // Setup object DML isolated here } insert new Opportunity(Name='Test', StageName='Prospecting', CloseDate=Date.today());
🔑 Key Points for Interviewer
  • Asked at 12+ companies — seen at TCS, Accenture, Deloitte, EY, PwC, Genpact
  • This most commonly bites developers inside test classes, where creating a test User alongside test business data in the same method is a very natural thing to want to do — System.runAs() is specifically the fix for exactly that test-context scenario.
🎤 One-Line Answer
“Thrown when you try to perform DML on Setup objects (User, Group, GroupMember) and non-Setup objects (Account, custom objects) in the same transaction.”
Q12
What is the difference between Trigger.new / Trigger.newMap and Trigger.old / Trigger.oldMap, and when is each available?
✅ Direct Answer
Trigger.new/newMap hold the incoming (new) record state, available in insert/update/undelete contexts. Trigger.old/oldMap hold the pre-change state, available in update/delete contexts. Trigger.new is read-only in after-context; Trigger.newMap is never directly editable.
💡 Why?
A very common trap question: Trigger.new is null during a pure delete operation — only Trigger.old is populated then, since there's no "new" version of a record being deleted.
🔑 Key Points for Interviewer
  • Asked at 12+ companies — seen at Accenture, TCS, Deloitte, Infosys, PwC, KPMG
  • A very common trap question: Trigger.new is null during a pure delete operation — only Trigger.old is populated then, since there's no "new" version of a record being deleted.
🎤 One-Line Answer
“Trigger.new/newMap hold the incoming (new) record state, available in insert/update/undelete contexts. Trigger.old/oldMap hold the pre-change state, available in update/delete contexts. Trigger.”
Q13
Wire vs Imperative Apex calls in LWC — is wire reactive by default, and if not, how do you make it reactive?
✅ Direct Answer
A @wire property IS reactive by default for its parameters — it automatically re-fires whenever a $-prefixed reactive parameter changes; an imperative call never auto-refires. See our LWC Interview Questions guide for the full comparison including caching behavior.
🔑 Key Points for Interviewer
  • Asked at 12+ companies — seen at Accenture, TCS, Deloitte, Infosys, Capgemini, IBM
🎤 One-Line Answer
“A @wire property IS reactive by default for its parameters — it automatically re-fires whenever a $-prefixed reactive parameter changes; an imperative call never auto-refires.”
Q14
What are Governor Limits, and can you name a few key ones?
✅ Direct Answer
Hard resource caps Salesforce enforces per transaction to protect the shared multi-tenant infrastructure — 100 SOQL queries, 150 DML statements, 10,000 DML rows, and roughly 50,000 records returned by SOQL, all per synchronous transaction.
💡 Why?
The limits reset per transaction, which is exactly why async Apex (future/Queueable/Batch) is the standard escape valve for work that would otherwise exceed them in a single synchronous run.
🔑 Key Points for Interviewer
  • Asked at 11+ companies — seen at TCS, Accenture, Deloitte, PwC, EY, Genpact
  • The limits reset per transaction, which is exactly why async Apex (future/Queueable/Batch) is the standard escape valve for work that would otherwise exceed them in a single synchronous run.
🎤 One-Line Answer
“Hard resource caps Salesforce enforces per transaction to protect the shared multi-tenant infrastructure — 100 SOQL queries, 150 DML statements, 10,000 DML rows, and roughly 50,000 records returned...”
Q15
What is Database.Stateful used for in Batch Apex?
✅ Direct Answer
It preserves instance variable values across separate execute() invocations within the same batch job — without it, every chunk starts with completely fresh instance state, discarding whatever the previous chunk had accumulated.
💡 Why?
Only apply it when you genuinely need running totals or accumulated state across chunks (like a running counter) — it carries a small serialization overhead per chunk that's wasted if your batch doesn't actually need cross-chunk state.
🔑 Key Points for Interviewer
  • Asked at 11+ companies — seen at Accenture, TCS, Deloitte, Capgemini, KPMG
  • Only apply it when you genuinely need running totals or accumulated state across chunks (like a running counter) — it carries a small serialization overhead per chunk that's wasted if your batch doesn't actually need cross-chunk state.
🎤 One-Line Answer
“It preserves instance variable values across separate execute() invocations within the same batch job — without it, every chunk starts with completely fresh instance state, discarding whatever the...”
Q16
What is the difference between a Master-Detail relationship and a Lookup relationship?
✅ Direct Answer
Master-Detail ties the child record's existence and security to its parent (deleting the parent cascades to delete children, OWD/sharing follows the parent), and enables native roll-up summary fields; Lookup is looser, with independent security and no native rollup support.
💡 Why?
The single most consequential practical difference: a Lookup relationship can never have a native roll-up summary field — that's exactly why so many companies ask a variant of "write an Apex rollup trigger" as a follow-up, since it's the only workaround for a Lookup-based rollup requirement.
🔑 Key Points for Interviewer
  • Asked at 11+ companies — seen at Accenture, TCS, Infosys, Deloitte, PwC
  • The single most consequential practical difference: a Lookup relationship can never have a native roll-up summary field — that's exactly why so many companies ask a variant of "write an Apex rollup trigger" as a follow-up, since it's the only workaround for a Lookup-based rollup requirement.
🎤 One-Line Answer
“Master-Detail ties the child record's existence and security to its parent (deleting the parent cascades to delete children, OWD/sharing follows the parent), and enables native roll-up summary...”
Q17
Explain the different types of Flow in Salesforce.
✅ Direct Answer
Screen Flow (user-facing multi-step forms), Record-Triggered Flow (fires on record create/update/delete), Schedule-Triggered Flow (recurring cadence), Autolaunched Flow (invoked from Apex/another Flow, no UI), and Platform Event-Triggered Flow.
💡 Why?
Record-Triggered Flows further split into before-save (fast field updates, no separate DML) and after-save (for anything touching related records) — this sub-distinction is usually what separates a surface-level answer from a hands-on one.
🔑 Key Points for Interviewer
  • Asked at 10+ companies — seen at TCS, Accenture, Deloitte, EY, Capgemini
  • Record-Triggered Flows further split into before-save (fast field updates, no separate DML) and after-save (for anything touching related records) — this sub-distinction is usually what separates a surface-level answer from a hands-on one.
🎤 One-Line Answer
“Screen Flow (user-facing multi-step forms), Record-Triggered Flow (fires on record create/update/delete), Schedule-Triggered Flow (recurring cadence), Autolaunched Flow (invoked from Apex/another...”
Q18
What is the difference between Profile and Permission Set, and when would you use each?
✅ Direct Answer
A Profile is mandatory for every user and sets baseline object/field/system permissions; a Permission Set layers additional access on top for specific users without needing a whole new Profile — use Permission Sets for any access that applies to a subset of users within an existing Profile.
💡 Why?
The general best-practice trend is toward minimal Profiles (baseline only) plus most actual permission-granting done through Permission Sets and Permission Set Groups, since it's far more flexible to assign and revoke than cloning Profiles.
🔑 Key Points for Interviewer
  • Asked at 10+ companies — seen at Accenture, TCS, Deloitte, Infosys, KPMG
  • The general best-practice trend is toward minimal Profiles (baseline only) plus most actual permission-granting done through Permission Sets and Permission Set Groups, since it's far more flexible to assign and revoke than cloning Profiles.
🎤 One-Line Answer
“A Profile is mandatory for every user and sets baseline object/field/system permissions; a Permission Set layers additional access on top for specific users without needing a whole new Profile — use...”
Q19
What is the difference between Named Credentials and Remote Site Settings?
✅ Direct Answer
Remote Site Settings only whitelist an endpoint URL for callouts with no authentication handling; Named Credentials store the endpoint AND authentication details, and Salesforce automatically injects auth on every callout.
💡 Why?
A URL covered by a Named Credential doesn't need a separate Remote Site Setting entry — the Named Credential already implicitly whitelists it, which trips up developers who add both unnecessarily.
🔑 Key Points for Interviewer
  • Asked at 10+ companies — seen at TCS, Accenture, PwC, Deloitte, Genpact
  • A URL covered by a Named Credential doesn't need a separate Remote Site Setting entry — the Named Credential already implicitly whitelists it, which trips up developers who add both unnecessarily.
🎤 One-Line Answer
“Remote Site Settings only whitelist an endpoint URL for callouts with no authentication handling; Named Credentials store the endpoint AND authentication details, and Salesforce automatically injects...”
Q20
What is LMS (Lightning Message Service), and how is it different from parent-child @api/CustomEvent communication?
✅ Direct Answer
LMS is a declared Message Channel that lets components communicate across the entire page (even across LWC, Aura, and Visualforce) with no direct DOM relationship required — unlike @api/CustomEvent, which only works between an actual parent and child. See our LWC Interview Questions guide for the full syntax.
🔑 Key Points for Interviewer
  • Asked at 9+ companies — seen at Accenture, TCS, Deloitte, Infosys, Capgemini
🎤 One-Line Answer
“LMS is a declared Message Channel that lets components communicate across the entire page (even across LWC, Aura, and Visualforce) with no direct DOM relationship required — unlike @api/CustomEvent,...”

📌 Tier 3 — Techno-Managerial & Senior Rounds

Q21–Q26 · Recurring in project-deep-dive and senior-level cross-questioning

Q21
Two users have the same Profile and Role, but one can see 100 records and the other only 10, on an object with the same OWD. What's causing this?
✅ Direct Answer
Manual sharing on specific records, a criteria-based or ownership-based Sharing Rule applying differently, Apex-managed sharing, or Account/Opportunity Teams giving extra access — same Profile/Role guarantees nothing beyond the baseline; any of these four layered mechanisms can independently widen one user's visibility over another's.
💡 Why?
This is the most common security "debug this scenario" question across every senior-level round — the expected answer walks through all four possible causes systematically rather than guessing at just one.
🔑 Key Points for Interviewer
  • Asked at 10+ companies (senior rounds) — seen at TCS, Accenture, Deloitte, PwC, Capgemini, EY
  • This is the most common security "debug this scenario" question across every senior-level round — the expected answer walks through all four possible causes systematically rather than guessing at just one.
🎤 One-Line Answer
“Manual sharing on specific records, a criteria-based or ownership-based Sharing Rule applying differently, Apex-managed sharing, or Account/Opportunity Teams giving extra access — same Profile/Role...”
Q22
How do you deal with external/offshore teams that have a different style of functioning and different delivery timelines?
✅ Direct Answer
Establish a shared communication cadence early (joint standups or weekly sync), document interface contracts explicitly so teams aren't blocked waiting on tribal knowledge, and build buffer time around known cross-team dependencies.
💡 Why?
The real risk with offshore teams isn't skill — it's timezone-driven latency on blocking questions; documenting assumptions in writing reduces the number of round-trips a single blocked question would otherwise cost.
🔑 Key Points for Interviewer
  • Asked at 9+ companies — seen at Accenture, TCS, Deloitte, PwC, Capgemini
  • The real risk with offshore teams isn't skill — it's timezone-driven latency on blocking questions; documenting assumptions in writing reduces the number of round-trips a single blocked question would otherwise cost.
🎤 One-Line Answer
“Establish a shared communication cadence early (joint standups or weekly sync), document interface contracts explicitly so teams aren't blocked waiting on tribal knowledge, and build buffer time...”
Q23
What are the drawbacks of Change Sets as a deployment tool?
✅ Direct Answer
Manual, one environment-pair at a time, no rollback capability, poor handling of destructive changes, and zero automated testing or CI/CD integration — impractical at real team scale.
💡 Why?
Most engagements past a certain team size move to Salesforce DX with a real CI/CD pipeline (GitHub Actions, Copado, Gearset) specifically to escape these limitations — naming a specific tool you've used shows hands-on experience beyond textbook knowledge.
🔑 Key Points for Interviewer
  • Asked at 9+ companies — seen at TCS, Accenture, Deloitte, Genpact, Capgemini
  • Most engagements past a certain team size move to Salesforce DX with a real CI/CD pipeline (GitHub Actions, Copado, Gearset) specifically to escape these limitations — naming a specific tool you've used shows hands-on experience beyond textbook knowledge.
🎤 One-Line Answer
“Manual, one environment-pair at a time, no rollback capability, poor handling of destructive changes, and zero automated testing or CI/CD integration — impractical at real team scale.”
Q24
How do you handle a situation where you're the only expert on a certain module and are suddenly unavailable?
✅ Direct Answer
Proactively maintain a living design/runbook document for that module before the situation arises, and pair-program or run periodic knowledge-transfer sessions so at least one other team member has working familiarity.
💡 Why?
Bus-factor risk is a genuine project management concern — the answer interviewers want is prevention as an ongoing habit, not "I'd document it if asked."
🔑 Key Points for Interviewer
  • Asked at 8+ companies — seen at Accenture, TCS, Deloitte, PwC, EY
  • Bus-factor risk is a genuine project management concern — the answer interviewers want is prevention as an ongoing habit, not "I'd document it if asked.".
🎤 One-Line Answer
“Proactively maintain a living design/runbook document for that module before the situation arises, and pair-program or run periodic knowledge-transfer sessions so at least one other team member has...”
Q25
One of your classes doesn't individually have 75% code coverage, but your org's overall average is above 75%. Will your deployment succeed?
✅ Direct Answer
Yes at the platform level — Salesforce's hard deployment gate is 75% aggregate coverage plus every trigger having some coverage, with no strict per-class minimum enforced by the platform itself for classes specifically.
💡 Why?
The nuance worth adding: professional engagements almost always layer a stricter per-class policy (often 85-90%) on top via CI, precisely because relying only on the platform's aggregate minimum lets individual classes go essentially untested.
🔑 Key Points for Interviewer
  • Asked at 8+ companies — seen at TCS, Accenture, Deloitte, Capgemini, EY
  • The nuance worth adding: professional engagements almost always layer a stricter per-class policy (often 85-90%) on top via CI, precisely because relying only on the platform's aggregate minimum lets individual classes go essentially untested.
🎤 One-Line Answer
“Yes at the platform level — Salesforce's hard deployment gate is 75% aggregate coverage plus every trigger having some coverage, with no strict per-class minimum enforced by the platform itself for...”
Q26
What are the different annotations used in Apex test classes, and what is Test.startTest()/Test.stopTest() for?
✅ Direct Answer
@isTest marks test-only code, @testSetup creates shared data once per class, @TestVisible exposes private members to test code, and Test.startTest()/stopTest() delineate a fresh governor-limit context that forces queued async work to run synchronously for immediate assertion.
💡 Why?
The @testSetup detail interviewers check for specifically: it runs once *before every test method*, not once total — each method gets a fresh rollback to that setup state, keeping tests isolated from each other.
🔑 Key Points for Interviewer
  • Asked at 7+ companies — seen at Accenture, TCS, PwC, Deloitte
  • The @testSetup detail interviewers check for specifically: it runs once *before every test method*, not once total — each method gets a fresh rollback to that setup state, keeping tests isolated from each other.
🎤 One-Line Answer
“@isTest marks test-only code, @testSetup creates shared data once per class, @TestVisible exposes private members to test code, and Test.”

🧠 Tier 4 — Trigger & Coding Scenarios

Q27–Q31 · The same handful of write-the-code scenarios, company after company

Q27
Write a trigger to prevent deletion of an Account if it has any related Opportunities (or Contacts).
✅ Direct Answer
On before delete, query related child records in bulk using the Ids from Trigger.old, and call addError() on any parent Account that still has one, blocking the delete transaction.
💡 Why?
Swap "Opportunities" for "Contacts" or "Cases" and this is functionally the identical trigger asked by a dozen different companies — the pattern (before delete + bulk child query + addError) is universal regardless of which child object is named.
trigger PreventAccountDelete on Account (before delete) { Set<Id> accIds = Trigger.oldMap.keySet(); Set<Id> accIdsWithOpps = new Set<Id>(); for (Opportunity o : [SELECT AccountId FROM Opportunity WHERE AccountId IN :accIds]) accIdsWithOpps.add(o.AccountId); for (Account acc : Trigger.old) { if (accIdsWithOpps.contains(acc.Id)) acc.addError('Cannot delete an Account with related Opportunities.'); } }
🔑 Key Points for Interviewer
  • Asked (in some variant) at 12+ companies — seen at TCS, Accenture, Infosys, Deloitte, PwC, EY, Capgemini
  • Swap "Opportunities" for "Contacts" or "Cases" and this is functionally the identical trigger asked by a dozen different companies — the pattern (before delete + bulk child query + addError) is universal regardless of which child object is named.
🎤 One-Line Answer
“On before delete, query related child records in bulk using the Ids from Trigger.old, and call addError() on any parent Account that still has one, blocking the delete transaction.”
Q28
Write a trigger to roll up a child object's Amount field onto a lookup-related parent (no native roll-up summary available).
✅ Direct Answer
On the child object's after insert/update/delete/undelete, aggregate SUM() grouped by the parent lookup field, and bulk-update the parent records with the resulting totals.
💡 Why?
This is the standard workaround whenever the relationship is a lookup rather than master-detail, since native roll-up summary fields only work across master-detail — Apex is the only option once that architectural constraint is in place.
trigger ChildAmountRollup on Child__c (after insert, after update, after delete, after undelete) { Set<Id> parentIds = new Set<Id>(); for (Child__c c : (Trigger.isDelete ? Trigger.old : Trigger.new)) parentIds.add(c.Parent__c); Map<Id, Decimal> totals = new Map<Id, Decimal>(); for (AggregateResult ar : [SELECT Parent__c, SUM(Amount__c) total FROM Child__c WHERE Parent__c IN :parentIds GROUP BY Parent__c]) { totals.put((Id) ar.get('Parent__c'), (Decimal) ar.get('total')); } List<Parent__c> toUpdate = new List<Parent__c>(); for (Id pId : parentIds) toUpdate.add(new Parent__c(Id = pId, Total_Amount__c = totals.containsKey(pId) ? totals.get(pId) : 0)); update toUpdate; }
🔑 Key Points for Interviewer
  • Asked (in some variant) at 11+ companies — seen at Accenture, TCS, Deloitte, PwC, Capgemini, EY
  • This is the standard workaround whenever the relationship is a lookup rather than master-detail, since native roll-up summary fields only work across master-detail — Apex is the only option once that architectural constraint is in place.
🎤 One-Line Answer
“On the child object's after insert/update/delete/undelete, aggregate SUM() grouped by the parent lookup field, and bulk-update the parent records with the resulting totals.”
Q29
Write a trigger to prevent creation of a duplicate record based on a field like Name or Email.
✅ Direct Answer
On before insert, bulk-query existing records for a matching value, and call addError() on any incoming record that matches — though in production, native Duplicate/Matching Rules are usually the better tool for this exact requirement.
💡 Why?
A strong answer explicitly notes that Duplicate Rules with fuzzy matching are the production-grade solution here — a simple exact-match trigger is what interviewers want to see coded live, but naming the better real-world tool shows judgment beyond just solving the immediate ask.
trigger PreventDuplicateAccount on Account (before insert) { Set<String> existingNames = new Set<String>(); for (Account a : [SELECT Name FROM Account]) existingNames.add(a.Name.toLowerCase()); for (Account acc : Trigger.new) { if (existingNames.contains(acc.Name.toLowerCase())) acc.Name.addError('An Account with this name already exists.'); } }
🔑 Key Points for Interviewer
  • Asked (in some variant) at 10+ companies — seen at TCS, Accenture, Deloitte, PwC, Genpact
  • A strong answer explicitly notes that Duplicate Rules with fuzzy matching are the production-grade solution here — a simple exact-match trigger is what interviewers want to see coded live, but naming the better real-world tool shows judgment beyond just solving the immediate ask.
🎤 One-Line Answer
“On before insert, bulk-query existing records for a matching value, and call addError() on any incoming record that matches — though in production, native Duplicate/Matching Rules are usually the...”
Q30
Write a trigger: when an Opportunity Stage changes to Closed Won, create a follow-up Task automatically.
✅ Direct Answer
On Opportunity after update, detect the specific StageName transition by comparing against Trigger.oldMap, and bulk-insert a Task per newly-Closed-Won Opportunity.
trigger ClosedWonTask on Opportunity (after update) { List<Task> tasks = new List<Task>(); for (Opportunity o : Trigger.new) { if (o.StageName == 'Closed Won' && Trigger.oldMap.get(o.Id).StageName != 'Closed Won') { tasks.add(new Task(Subject = 'Kick off onboarding', WhatId = o.Id, OwnerId = o.OwnerId, ActivityDate = Date.today().addDays(2))); } } if (!tasks.isEmpty()) insert tasks; }
🔑 Key Points for Interviewer
  • Asked (in some variant) at 9+ companies — seen at Accenture, TCS, Deloitte, EY, PwC
🎤 One-Line Answer
“On Opportunity after update, detect the specific StageName transition by comparing against Trigger.oldMap, and bulk-insert a Task per newly-Closed-Won Opportunity.”
Q31
Write a trigger to count related Contacts on an Account and store it in a custom field.
✅ Direct Answer
On Contact after insert/update/delete/undelete, aggregate COUNT(Id) grouped by AccountId, and bulk-update the parent Accounts with the resulting counts.
trigger ContactCountRollup on Contact (after insert, after update, after delete, after undelete) { Set<Id> accIds = new Set<Id>(); for (Contact c : (Trigger.isDelete ? Trigger.old : Trigger.new)) if (c.AccountId != null) accIds.add(c.AccountId); Map<Id, Integer> counts = new Map<Id, Integer>(); for (AggregateResult ar : [SELECT AccountId, COUNT(Id) cnt FROM Contact WHERE AccountId IN :accIds GROUP BY AccountId]) { counts.put((Id) ar.get('AccountId'), (Integer) ar.get('cnt')); } List<Account> toUpdate = new List<Account>(); for (Id accId : accIds) toUpdate.add(new Account(Id = accId, Total_Contacts__c = counts.containsKey(accId) ? counts.get(accId) : 0)); update toUpdate; }
🔑 Key Points for Interviewer
  • Asked (in some variant) at 8+ companies — seen at TCS, Accenture, Deloitte, Capgemini
🎤 One-Line Answer
“On Contact after insert/update/delete/undelete, aggregate COUNT(Id) grouped by AccountId, and bulk-update the parent Accounts with the resulting counts.”
🚀 Bookmark sfinterviewpro.com
1,500+ free Salesforce interview questions across 25+ topics. No paywall. No signup. Updated regularly.
Test yourself on this topic
2,244 practice MCQs across 27 quizzes — 5 quizzes free, no signup
Open Practice Zone →
RK
Written by
Rajnish Kumar
Salesforce Developer · Apex, LWC, Data Cloud & AI · Building SF Interview Pro
Connect on LinkedIn ↗
Testimonials

Real feedback from real candidates

People using SF Interview Pro to prepare for Salesforce interviews
★★★★★
"Crashed multiple interviews thanks to this. Better than the paid courses I tried."
SP
Salesforce Professional
Developer
★★★★★
"No signup, no paywall. The Apex Trigger series alone got me through two rounds."
AK
Aditya K.
Salesforce Admin
★★★★★
"LWC Zero to Hero is more practical than any paid course I found."
RM
Riya M.
LWC Developer
★★★★★
"Practice Zone MCQs matched my actual interview difficulty almost exactly."
PS
Priya S.
Business Analyst
★★★★★
"Started knowing nothing. Three weeks later I had two offers."
MK
Mohit K.
Salesforce Admin
★★★★★
"Company-wise Accenture prep was scarily accurate."
SN
Sneha N.
Consultant
★★★★★
"Explains identity resolution better than official Trailhead modules."
VR
Vikram R.
Data Cloud Consultant
★★★★★
"Free and better than the paid prep I bought earlier."
TJ
Tanvi J.
Fresher
★★★★★
"Reports and Dashboards guide made a tricky topic finally click."
KP
Karan P.
Salesforce Admin
★★★★★
"SOQL Part 2 questions came up almost word for word in my interview."
AN
Ananya N.
Developer
★★★★★
"Field Service Lightning guide is the only good free resource I found."
RD
Rohan D.
FSL Consultant