Apex Triggers Real Interview Questions Quiz – 34 Questions

Apex Triggers Real Interview Questions Quiz

34 questions focused purely on Apex Triggers, drawn from our Trigger Scenarios collection and real trigger questions asked at EY, PwC, TCS, Cognizant, Persistent, Deloitte, Accenture, EPAM, PayPal and more. Click an option to instantly see if you got it right.

Topics: context variables, before vs after, recursion, callouts and bulkification, Batch/Future from triggers, order of execution, Record-Triggered Flows, and real scenario-based trigger-timing questions.

Score: 0 / 34
Question 1 of 34
What is the basic syntax structure used to declare an Apex trigger?
Question 2 of 34
What are the four main DML events a trigger can fire on?
Question 3 of 34
Which trigger context variable holds the version of records about to be saved, available in insert and update triggers?
Question 4 of 34
Which trigger context variable holds the previous version of records, available in update and delete triggers?
Question 5 of 34
Why would you typically choose a before trigger over an after trigger?
Question 6 of 34
Why would you typically choose an after trigger over a before trigger?
Question 7 of 34
In a before insert or before update trigger, how should you update a field on the records currently being saved?
Question 8 of 34
Can Trigger.old be accessed inside a before insert trigger?
Question 9 of 34
Can Trigger.new be accessed inside a before delete trigger?
Question 10 of 34
What is the generally recommended best practice for the number of triggers per object?
Question 11 of 34
What typically causes a recursive trigger, and how is it usually prevented?
Question 12 of 34
Can a future method be called directly from a trigger?
Question 13 of 34
Can Batch Apex be invoked (via Database.executeBatch) from within a trigger?
Question 14 of 34
Roughly how many times can Database.executeBatch() be called within a single Apex transaction?
Question 15 of 34
Can you make a direct HTTP callout inside a trigger?
Question 16 of 34
Given that direct callouts aren't allowed in triggers, how do you typically make an external callout triggered by a record change?
Question 17 of 34
When making callouts triggered by record changes on multiple records, why is it important to bulkify the callout logic?
Question 18 of 34
If two triggers exist on the same object for the same event (e.g. both before update), is their execution order guaranteed?
Question 19 of 34
If an unhandled exception occurs inside an after trigger, what happens to the overall transaction?
Question 20 of 34
In the standard Salesforce order of execution, which generally runs first?
Question 21 of 34
If a field is required by both a Validation Rule and separate trigger logic calling addError(), what ultimately determines whether the record is saved?
Question 22 of 34
Why is using a Map (often keyed by Id) commonly recommended over a List when writing trigger logic that needs to look up related records?
Question 23 of 34
What is a common declarative way to bypass trigger execution during a data load or for a specific integration user, without removing the trigger's logic for everyone?
Question 24 of 34
What is a Record-Triggered Flow, in relation to traditional Apex Triggers?
Question 25 of 34
When would you generally prefer a Record-Triggered Flow over writing an Apex Trigger?
Question 26 of 34
What is the key difference between a before-save and an after-save Record-Triggered Flow (paralleling before vs after Apex triggers)?
Question 27 of 34
Are Apex Triggers and Record-Triggered Flows on the same object and event independent of one another by default, or does one call the other?
Question 28 of 34
Scenario: You need to prevent an Account from being deleted if it still has related Opportunities. Which trigger event is the correct choice?
Question 29 of 34
Scenario: When an Account's Email field is updated, all related Contact records' Email fields should also update. Which trigger event is most appropriate?
Question 30 of 34
Scenario: When an Opportunity is updated, you need to create a new Task assigned to its Primary Contact. Which trigger event is most appropriate?
Question 31 of 34
Scenario: A Guest record should not be linked to a Meeting if that Meeting's Status is 'Completed'. Which trigger event(s) on the Guest object would correctly enforce this?
Question 32 of 34
Scenario: You need to prevent two Contacts from being created or updated with the same Email address. Which trigger event(s) are correct?
Question 33 of 34
Scenario: You need to send an email to the Opportunity Owner whenever an Opportunity is marked Closed. Which trigger event is most appropriate, and why?
Question 34 of 34
400 records are inserted via Data Loader with the default batch size of 200. Roughly how many separate trigger invocations (chunks) will the insert trigger fire for, assuming no further chunking occurs?

Leave a Reply