What should a developer do to ensure the code execution is disrupted if the retrievedRecordslist remains empty after the SOQL query?

Posted by: Pdfprep Category: PDI Tags: , ,

Given the following block code: try{ List <Accounts> retrievedRecords = [SELECT Id FROM Account WHERE Website = null]; }catch(Exception e){ //manage exception logic }

What should a developer do to ensure the code execution is disrupted if the retrievedRecordslist remains empty after the SOQL query?
A . Check the state of the retrieveRecords variable and throw a custom exception if the variable is empty.
B . Check the state of the retrievedRecords variable and use System.assert(false) if the variable is empty
C . Check the state of the retrievedRecords variable and access the first element of the list if the variable is empty.
D . Replace the retrievedRecords variable declaration from ftount to a single Account.

Answer: B