Q1
In Apex Triggers, why is putting SOQL or DML directly inside a for (Account acc : Trigger.new) loop a guaranteed production outage—and how does Bulkification (`Map<Id, SObject>`) prevent 101 SOQL crashes?
Data Loader uploads or Flow bulk batches pass up to 200 records per trigger chunk; just 1 query inside a for loop immediately hits the 100 SOQL / 150 DML governor limit! Collect parent IDs into a Set<Id>, execute ONE query into a Map<Id, Account>, and run ONE final update list; outside.
Q2
Why can an after update Apex Trigger updating Trigger.new throw `System.FinalException: Record is read-only`, OR trigger infinite recursion when calling update clone?
Trigger.new records are locked read-only during after triggers (mutate own-record fields strictly inside `before` triggers without extra DML!). When updating related/same records in after, guard against infinite trigger loops via a Set<Id> processedIds recursion helper (NOT a plain static Boolean, which silently skips batches 201–400 in Data Loader uploads!).
Q3
Why is `with sharing` NOT enabled by default on Apex Classes—and what catastrophic leak occurs if an LWC @AuraEnabled controller omits with sharing + WITH USER_MODE?
Apex classes default to System Context (ignoring OWD & Sharing Rules AND Field-Level Security unless with sharing + WITH USER_MODE / Security.stripInaccessible() are enforced!). Omitting sharing lets junior users view confidential CEO/HR records via custom LWCs.
Q4
How do Asynchronous Apex choices (`@future` vs `Queueable` vs `Batchable` vs `Scheduled`) differ when making HTTP Callouts or processing 2 million records?
@future cannot accept non-primitive SObjects or chain jobs; `Queueable` accepts complex objects, yields an AsyncApexJob ID, and allows chaining; `Batch Apex` chunks up to 50 million records in 200-row transactions (with Database.Stateful if needed) and avoids mixed-DML limits.
Q5
In Lightning Web Components (LWC), why does mutating an array item this.items.push(row) NOT re-render the template—and when does `@track` still matter?
LWC tracks top-level property *reassignment* (this.items = [...this.items, row]). Deep nested object/array internal mutations (this.obj.nested.count++) aren't observed unless decorated with @track or replaced immutably.
Q6
Why does calling an Apex method imperatively (await saveRecord(...)) vs `@wire(getAccounts, { search: '$term' })` differ for caching and DML writes?
Wire methods MUST be @AuraEnabled(cacheable=true) (using Lightning Data Service cache automatically—forbidding DML writes!) and re-fire reactively when $term changes. Any Apex method performing DML (insert/update) MUST be called imperatively and call refreshApex() afterwards if updating wired views.
Q7
How do `Database.insert(list, false)` handle partial batch failures cleanly compared to plain insert list;?
Plain insert list; rolls back ALL 200 rows if even 1 fails validation. Database.insert(list, false) returns Database.SaveResult[] so valid rows succeed while failed rows log exact per-record errors.
Q8
What causes Salesforce's `System.CalloutException: You have uncommitted work pending` inside Apex Integration tests or triggers?
Salesforce forbids making an external HTTP Callout *after* uncommitted DML (insert/update) inside the same transaction so DB locks don't stall waiting on slow external APIs! Execute callouts *before* DML, or move them into async Queueable jobs (AllowsCallouts).
Q9
Why must Apex Unit Tests ALWAYS use `Test.startTest()` / `Test.stopTest()` AND avoid `SeeAllData=true`?
Test.startTest() resets a fresh set of Governor Limits for the tested unit and Test.stopTest() forces all async @future/Queueable/Batch jobs to complete synchronously before assertions! SeeAllData=true makes tests fragile and environment-dependent.
Q10
In LWC parent-child communication, why must child components NEVER mutate @api props directly and instead dispatch CustomEvent?
@api properties received from parents are strictly read-only in LWC—mutating them throws runtime errors. Emit this.dispatchEvent(new CustomEvent('selected', { detail: id })) upward cleanly (using Lightning Message Service across unrelated sibling trees).