Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 108 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 108
Topic #: 1
[All Certified Platform Developer II Questions]

What is a consideration when testing batch Apex? (Choose two.)

  • A. Test methods must execute the batch with a scope size of less than 200 records
  • B. Test methods must call the batch execute() method once
  • C. Test methods must use the @isTest (SeeAllData=true) annotation
  • D. Test methods must run the batch between Test.startTest() and Test.stopTest()
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
singhkar
Highly Voted 3 years, 5 months ago
the correct ans is BD as the scope size can be 200
upvoted 6 times
moitam
1 year, 2 months ago
Test methods must not call the batch execute() method once, as this is done automatically by the Database.executeBatch() method. So... I Guess A and D
upvoted 2 times
...
...
FriedConsole2000
Most Recent 9 months, 1 week ago
Selected Answer: BD
B & D are correct
upvoted 1 times
...
p4wix
1 year, 1 month ago
AD ref: https://trailhead.salesforce.com/content/learn/modules/asynchronous_apex/async_apex_batch
upvoted 1 times
...
ejh
1 year, 8 months ago
Selected Answer: BD
Batch code should run only once in test classes
upvoted 1 times
...
lorenac2
1 year, 10 months ago
Selected Answer: D
Only D is correct. A is written incorrectly, you can specify the number of records executed per batch, which may be anything from 1 to 2000. https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database.htm#apex_System_Database_executeBatch_2 B is incorrect becuase it is referring to the execute() method of the batch class, NOT the executeBatch method of the database class. Here is how you call it: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm. C is wrong, because it is not a best practice, so this is almost always wrong. Apparently the Connect API namespace is an exception.
upvoted 1 times
...
Rp194
2 years, 4 months ago
B and D
upvoted 1 times
...
amerbearat
3 years, 3 months ago
Answer: AD “Make sure that the number of records inserted is less than or equal to the batch size of 200 because test methods can execute only one batch. You must also ensure that the Iterable returned by the start method matches the batch size.”
upvoted 4 times
ncore
2 years, 12 months ago
Question says "less than 200", in your argument it says it can be equal to 200, therefore I would say B and D are correct.
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...