CSA Apex Programming 4 — Questions and Answers
Question 1: What is the maximum batch size for Batch Apex execute() method?
- 50
- 200 (Correct answer)
- 2,000
- 10,000
Correct answer: 200
The default and maximum batch size for the execute() method in Batch Apex is 200 records per batch.
Question 2: Which keyword allows an Apex class to be accessed from any namespace, including managed packages?
- public
- protected
- global (Correct answer)
- virtual
Correct answer: global
'global' is the most permissive access modifier and makes the class accessible across all namespaces and packages.
Question 3: What does the Database.insert() method return that insert DML statement does not?
- A list of successfully inserted records
- A SaveResult array with success/error info per record (Correct answer)
- The total number of records inserted
- An exception for failed records
Correct answer: A SaveResult array with success/error info per record
Database.insert() returns a list of Database.SaveResult objects with success status and errors for each record, allowing partial success.
Question 4: In a trigger, how do you access the old version of a record after an update?
- Trigger.old (Correct answer)
- Trigger.oldMap
- Trigger.previous
- Trigger.before
Correct answer: Trigger.old
Trigger.old is a List of the old record versions available in update and delete triggers.
Question 5: Which SOQL clause is used to filter records in a parent-to-child relationship query?
- JOIN
- RELATED TO
- IN (SELECT ...)
- WHERE Id IN (subquery) (Correct answer)
Correct answer: WHERE Id IN (subquery)
Salesforce SOQL uses semi-joins with WHERE Id IN (SELECT ... FROM ...) to filter based on related records.
Question 6: How many future method calls are allowed per Apex transaction?
- 10
- 25
- 50 (Correct answer)
- 100
Correct answer: 50
A single Apex transaction can invoke up to 50 future (@future) method calls.
Question 7: Which System method is used to assert that two values are equal in an Apex test?
- System.assertEquals() (Correct answer)
- Assert.areEqual()
- Test.assertEqual()
- System.assert()
Correct answer: System.assertEquals()
System.assertEquals(expected, actual) verifies that two values are equal and fails the test if they are not.
What is the maximum batch size for Batch Apex execute() method?