Salesforce Interview Questions on Asynchronous Apex

Jagdish Dhus
0

Salesforce Interview Questions on Asynchronous Apex -



1. What is Asynchronous Apex?

Ans - If we run some job by using synchronous processing, it waits to finish the current task before 

moving on to another task and we will get the limit error, heap size error, or timeout error.

To avoid such issues, we can run this long-running task using asynchronous apex. Using Asynrouns 

processing, we can execute multiple processes parallel at the same time.


2. Where do we use Asynchronous Apex?

Ans - a. Sending Email

          b. to create complex reports

          c. schedule a job

           d. to call the external system 


3. What are the benefits of Asynchronous processing?

Ans - a. better scalability

          b. more heap size

          c. higher governer limit

          d. increase user efficiency


4. What are the types of Asynchronous Apex? 

Ans - a. Batch Apex

          b. Scheduled Apex

          c. Future Apex

          d. Queueable Apex


5. Why do we use the Batch Apex?

Ans - a. Batch Apex Heap size is 12MB.

          b. Batch Apex executes 200 records per cycle.

          c. Batch apex retrieves 5 million records.


6. What are the advantages of Batch Apex?

Ans - a. Each Batch contains a separate governer limit

          b. system automatically divides batches.

          c. if one batch fails, the other batches will continue to be executed.


7. How many schedulable apex jobs can you have at a time? / What is the maximum number of apex classes that can be scheduled concurrently?

Ans - 100 schedulable apex jobs


8. Are synchronous web service callouts supported by scheduled apex?

Ans - No  


9. Why Sobject does not use in future methods?

Ans - when we call methods and when we execute methods that time Sobject may be changed. that's why Sobject does not use it in future methods. 


10. Can we call batch apex into another batch?

Ans - Yes. we can call batch apex into another batch from the finish method.


11. Can we call batch apex into another batch in execute method?

Ans -No. We can call batch apex only from the finish method. If you try to call batch apex in the Start and execute method it gives Runtime error.


12. What is the use of a Database.QueryLocator and Iterable<SObject>?

Ans - Database.QueryLocator is used to get all records and divide those records into small pieces called batches.

Iterable<SObject> is used to create a custom object and iterate records one by one.


13. Can we call the Batch apex from triggers?

Ans - Yes


14. How we invoke batch jobs from the developer console?

Ans - using    Database.executebatch(batch_class_name);


15. How many batch jobs can be run in parallel?

Ans - Maximum 5


16. What is Batch Job Chaining?

Ans - We can call another Batch of Jobs one by one from the Finish method.


17. What are the different types of interfaces used in Batch Apex?

Ans - a. Database.Batchable 

           b. Schedulable


18. How many numbers of jobs, i can queue using System.enqueueJob() at a time?

Ans - 50 jobs


19. Can I call Queueable from the batch?

Ans - yes 


20. Can I write a future call in a trigger?

Ans - Yes


21. What are the Limitations of Future Methods?

Ans - a. We can not call Future Method from Batch.

           b. Future Methods supports only Primitive Data Types.

           c. Future Methods are not good for a Large number of records.


22. Can we call the future methods in batch?

Ans - No


23. What are the batch execution limits per day?

Ans - 250000


24. How many times Start, Execute, and Finish methods will execute in Batch Apex?

Ans - In Batch Apex, Start and Finish methods execute one time, and Executes methods execute multiple times as per requirement.  

Post a Comment

0Comments
Post a Comment (0)
To Top