25 Apex Interview Questions with Answers

  • Apex Interview Questions

Question: 1. What is Batch Apex ?

Answer: Batch Apex is used  for a large number of records, data is divided into small batches of records, and then these batches will be executed. Batch class is generally used to process bulk records together so that we have a greater governor limit when compared to the synchronous code.

Question 2: Name the methods to be implemented in Batch Apex? 

Answer: The methods to be implemented in Batch Apex are as follows

  • Start method(used to collect chunks of data for processing)
  • Execute method(used to perform operations on the collected data)
  • Finish method(used for sending emails)

Question 3: Can we call a batch class from a batch class ? If yes, how ?

Answer: Yes, we can call another batch class from the Finish method.

Question 4: Can we make callouts from Batch Apex? If yes, how ?

Answer: Yes, we have to implement using the interface Database.AllowCallouts.

Question 5: What are the limitations  for Batch Apex?


  • Batch Apex jobs run slower when we use relationship subqueries in QueryLocator in the Start Method.
  • It is not possible to call future methods from the Batch Class.
  • Batch Apex creates one additional AsyncApexJob record for every 10,000 records of BatchApexWorker type,we have to keep this in mind when we are querying the records.
  • Use Starttest and Stoptest methods around the Execute method.

Question 6: What is the schedule Apex ?

Answer: Schedule apex is used  to execute an Apex code snippet at a specific period of time. To schedule an apex class, we need to implement a Schedulable interface .

Question 7: How can we schedule a Batch Apex ?

Answer: We can schedule a Batch Apex in two ways from user interface & programmatically using System.scheduleBatch method.

Question 8: What is System.schedule() ?

Answer: System.schedule() method is used to execute the schedulable interface.

System.schedule() method takes 3 parameters :

  1. Name of the job
  2. An expression that represents the time and date.
  3. The object of the class to be executed.

Question 9: What is the return type of System.schedule() ?

Answer: System.schedule() method returns Job ID.

Question 10: Does Apex Scheduler run in system mode ?

Answer: Yes, Apex Scheduler runs in system mode.

Swathi is a certified Salesforce Administrator and Conga CLM Essentials Administration. Working as a Salesforce Administrator/QA Lead at Cloudely Inc.

By |2023-02-24T16:07:30+05:30February 24th, 2023|Comments Off on 25 Apex Interview Questions with Answers