You are on page 1of 2

BATCH APEX QUESTIONS

1. When would you use a batch class in Salesforce?


a) When you want to perform a specific task on a large number of records
b) When you want to perform a specific task on a small number of records
c) When you want to perform a specific task on records in a particular object
d) All of the above

2. How do you create a batch class in Salesforce?


a) By creating a new Apex class and implementing the Batchable interface
b) By creating a new Apex class and extending the Batchable class
c) By creating a new Apex trigger and implementing the Batchable interface
d) By creating a new Apex trigger and extending the Batchable class

3. What is the maximum number of records that can be passed to a batch class at one time?
a) 1000
b) 10000
c) 100000
d) 1000000

4. What is the maximum number of records that can be processed by a batch class in a single
execution?
a) 1000
b) 10000
c) 100000
d) 1000000

5. What is the maximum number of batch classes that can be executed concurrently in
Salesforce?
a) 1
b) 5
c) 10
d) 25

6. Can a batch class be scheduled to run automatically in Salesforce?


a) Yes, using the Scheduled Apex feature
b) Yes, using the Time-Based Workflow feature
c) Yes, using the Process Builder feature
d) All of the above

7. Can a batch class be called from a trigger in Salesforce?


a) Yes, using the Database.executeBatch() method
b) Yes, using the System.scheduleBatch() method
c) Yes, using the BatchableContext.schedule() method
d) All of the above

8. How do you test a batch class in Salesforce?


a) By creating test records and calling the start() method in a test method
b) By creating test records and calling the execute() method in a test method
c) By creating test records and calling the finish() method in a test method
d) All of the above

9. Can a batch class be used to update records in a different object than the object it is
processing?
a) Yes, using cross-object formulas
b) Yes, using cross-object triggers
c) Yes, using cross-object workflow rules
d) All of the above

10. Can a batch class be used to delete records in Salesforce?


a) Yes, by calling the delete() method on each record in the execute() method
b) Yes, by calling the delete() method on the QueryLocator object in the start() method
c) Yes, by calling the delete() method on the Database.emptyRecycleBin() method in the
finish() method
d) All of the above

11. Can a batch class be used to insert records in Salesforce?


a) Yes, by calling the insert() method on each record in the execute() method
b) Yes, by calling the insert() method on the QueryLocator object in the start() method
c) Yes, by calling the insert() method on the Database.insert() method in the finish()
method
d) All of the above

12. Can a batch class be used to upsert records in Salesforce?


a) Yes, by calling the upsert() method on each record in the execute() method
b) Yes, by calling the upsert() method on the QueryLocator object in the start() method
c) Yes, by calling the upsert() method on the Database.upsert() method in the finish()
method
d) All of the above

13. Can a batch class be used to send emails in Salesforce?


a) Yes, by calling the Messaging.sendEmail() method in the execute() method
b) Yes, by calling the Messaging.sendEmail() method in the start() method
c) Yes, by calling the Messaging.sendEmail() method in the finish() method
d) All of the above

14. Can a batch class be used to call a REST API in Salesforce?


a) Yes, by calling the HttpRequest.send() method in the execute() method
b) Yes, by calling the HttpRequest.send() method in the start() method
c) Yes, by calling the HttpRequest.send() method in the finish() method
d) All of the above

15. Can a batch class be used to perform callouts to external systems in Salesforce?
a) Yes, by calling the callout methods in the execute() method
b) Yes, by calling the callout methods in the start() method
c) Yes, by calling the callout methods in the finish() method
d) All of the above

You might also like