What exactly are context variables, and how do we employ the

Trigger is the correct answer. Context variables (TCV) are variables that allow us track the runtime information about the present execution of a trigger. Among them are:
isExecuting: This variable returns true if the current context for the Apex code is a trigger rather than a Visualforce page, Web service, or execute anonymous() API request.
isInsert: If the trigger executed is an insert operation, this variable returns true.
isUpdate: If the trigger executed is an update operation, this variable returns true.
isDelete: If the trigger executed is a delete action, this variable returns true.
isBefore: This variable returns true if the trigger was triggered before any records were stored.
IsAfter: This variable returns true if the trigger was triggered after all records had been saved. IsUndelete: This variable returns true if the record was retrieved from the recycle bin.
new: This variable returns a list of the updated sObject records. Only the insert, update, and undelete triggers support this.
newMap: This produces a list of Ids for the new version of the sObject records. oldMap: This returns a list of Ids for the old version of the s This variable delivers a list of all the sObject records' previous versions. This feature is only accessible in update and remove triggers. https://www.iteducationcentre.com/salesforce-training-in-pune.php
isExecuting: This variable returns true if the current context for the Apex code is a trigger rather than a Visualforce page, Web service, or execute anonymous() API request.
isInsert: If the trigger executed is an insert operation, this variable returns true.
isUpdate: If the trigger executed is an update operation, this variable returns true.
isDelete: If the trigger executed is a delete action, this variable returns true.
isBefore: This variable returns true if the trigger was triggered before any records were stored.
IsAfter: This variable returns true if the trigger was triggered after all records had been saved. IsUndelete: This variable returns true if the record was retrieved from the recycle bin.
new: This variable returns a list of the updated sObject records. Only the insert, update, and undelete triggers support this.
newMap: This produces a list of Ids for the new version of the sObject records. oldMap: This returns a list of Ids for the old version of the s This variable delivers a list of all the sObject records' previous versions. This feature is only accessible in update and remove triggers. https://www.iteducationcentre.com/salesforce-training-in-pune.php