Real Interview Questions with Practical Answers
1) What is Mixed DML error?
Occurs when setup objects (User, Group) and non-setup objects (Account, Case) are modified in the same transaction.
2) How to enforce class A sharing setting to class B?
Declare class B as with sharing; sharing is not inherited automatically—each class must define it.
3) What are the methods of a batch class?
start(), execute(), finish().
4) How to communicate between components in LWC?
Parent → Child using @api; Child → Parent using CustomEvent.
5) How to enforce field-level security in Apex?
Use Schema.sObjectType.Object__c.fields.Field__c.isAccessible() or stripInaccessible().
6) What are the different workflow actions?
Field Update, Email Alert, Task Creation, Outbound Message.
7) Can we catch the 101 SOQL query exception in try-catch?
No, governor limit exceptions cannot be caught.
8) What is the return type of start method?
Database.QueryLocator or Iterable<sObject>.
9) Difference between with sharing and without sharing?
with sharing enforces record sharing; without sharing ignores it.
10) Have you worked on workflow rules?
Yes, used for field updates, emails, and tasks (now mostly replaced by Flow).
11) Best practices to write Apex test class?
No SeeAllData, use @testSetup, bulk testing, assertions, mock callouts.
12) Limitations of future method and when to recommend them?
No chaining, no return value, limited parameters; recommend for simple async callouts.
13) How to call Apex from LWC?
Using @wire or imperative Apex calls.
14) How to catch a specific exception in Apex?
Use specific exception types like DmlException, QueryException.
15) Can we create a Contact without Account?
Yes, if “Allow Contacts without Accounts” is enabled.
16) How to handle exception in Apex?
Use try-catch, custom exceptions, meaningful error messages.
17) What are governor limits?
Runtime limits to ensure multi-tenant fairness (SOQL, DML, CPU, heap).
18) What is event bubbling?
CustomEvent traveling from child to parent components in LWC.
19) Can we call one batch from another batch?
Yes, from the finish() method.
20) Order of execution in Salesforce?
Validation → Before Trigger → After Trigger → Workflow/Flow → Commit → Post-commit logic.
21) How to call Apex method from Flow?
Using an @InvocableMethod.
22) Use of @api decorator?
Exposes properties/methods to parent components.
23) What is heap size in asynchronous Apex?
12 MB.
24) Have you used Iterable?
Yes, for custom record processing in batch Apex.
25) What type of integration have you worked on?
REST, SOAP, Payment Gateway, Platform Events, Bulk API.
26) How authentication works in integration callout/callback?
OAuth 2.0 via Named Credentials; callbacks via secure endpoints/webhooks.
27) Have you worked on integrations?
Yes, both inbound and outbound integrations.
28) Different workflow actions?
Field Update, Email Alert, Task, Outbound Message.
29) Introduction.
Salesforce Developer with experience in Apex, LWC, integrations, and deployments.
30) Current requirement you are working on.
LWC-based feature with Apex backend and integration handling.
31) Clouds you worked on
Sales Cloud, Service Cloud, Experience Cloud, Marketing Cloud (if applicable).
32) Best practices to avoid governor limits in Apex?
Bulkify code, avoid SOQL/DML in loops, use collections, async processing.
33) Difference between Profile and Role?
Profile controls permissions; Role controls record visibility.
34) Other sharing methods apart from Role hierarchy?
Sharing Rules, Manual Sharing, Apex Managed Sharing, Teams.