Salesforce Certified Platform Developer I 1-10

表示モード
画像位置
文字位置
理解度の自動記録
STATUS FILTER

Choose confidence levels to display

Loading...
Q1Salesforce Platform Developer
Show answer
Correct answer: C. 2
A do-while statement is a construct in which the body is always executed at least once before the condition is evaluated.
x is first initialized to 0, but inside the loop x = 1 is executed, and then x++ makes x equal to 2.
After that, the condition while (x < 1) is evaluated, but since x is already 2 the condition is false and the loop ends.
Therefore the value output by System.debug is 2.
This question tests whether you understand the difference from a while statement, especially whether the first iteration runs.
Apex Do-While Loops
Q2Salesforce Platform Developer
Show answer
Correct answer: B. @AuraEnabled
To call Apex from Lightning components (both Aura and LWC), you must add @AuraEnabled to the Apex methods and properties.
This makes server-side processing accessible from the client side.
@RestResource is for exposing a REST API, @RemoteAction is the legacy approach for Visualforce, and @HttpInvocable is for integrating with external services, so their purposes differ.
Therefore, the correct annotation used to connect Lightning components with Apex is @AuraEnabled.
AuraEnabled Annotation
Q3Salesforce Platform Developer
Show answer
Correct answer: A, B, E
With asynchronous Apex (Future, Queueable, Batch, etc.), there are items whose governor limits are relaxed compared to synchronous processing.Specifically, the total heap size (6MB to 12MB), the maximum CPU time (10,000ms to 60,000ms), and the total number of SOQL queries issued (100 to 200) are increased.
On the other hand, the total number of records that can be retrieved by SOQL queries (a limit of 50,000 records) and the maximum execution time of an Apex transaction do not change between synchronous and asynchronous execution.
Therefore, the key point is that while asynchronous processing raises some limits so that resource-intensive processing can be run safely, the limit on the number of records remains unchanged.
Execution Governors and Limits
Q4Salesforce Platform Developer
Show answer
Correct answer: B. 100
In this code, insert is executed twice inside the loop, but when the limit on DML statements per transaction (150) is exceeded, an exception occurs.
Only the first insert is wrapped in try-catch, so the subsequent inserts are not handled by exception handling.
Therefore, once the governor limit is reached, an unhandled exception occurs, and the entire transaction is rolled back and all record insertions are undone.
As a result, it stays at the original 100 records with no change.
Execution Governors and Limits
Q5Salesforce Platform Developer
Show answer
Correct answer: C. 2→1→5→4→3
In Salesforce’s trigger order of execution, the before triggers run first, and then the system validation and validation rules are re-checked.
Next, duplicate rules are applied, and if there are no issues the record is saved to the database (not yet committed). The after triggers run after that.
Therefore, the key point is that after the before triggers the order is validation → duplicate check → save → after triggers.
Triggers and Order of Execution
Q6Salesforce Platform Developer
Show answer
Correct answer: C. For(variable : list_or_set) { }
When processing a collection (List or Set) whose number of records is unknown, using the enhanced for statement (for-each construct) is best.
With this construct you do not need to obtain the count with .size() or the like, and you can process all elements in the collection safely and concisely.
Other for statements and while statements require count management or condition control and become verbose.
Therefore, using the for(variable : list_or_set) construct is the best practice for collection processing.
For Loops
Q7Salesforce Platform Developer
Show answer
Correct answer: B, C
In Apex, with sharing and without sharing control how sharing rules are applied, but an inner class does not automatically inherit the sharing setting of the outer class.
Therefore, you must specify it explicitly for each class.
In addition, since inner classes and outer classes can be declared independently, it is possible to define sharing settings individually for both classes.
This behavior is important for making security control explicit.
Using the with sharing, without sharing, and inherited sharing Keywords
Q8Salesforce Platform Developer
Show answer
Correct answer: D. Anonymous block
When the sharing setting is omitted, the default behavior differs depending on the kind of class. An anonymous block (Execute Anonymous) automatically follows the permissions and sharing settings of the user running it.
On the other hand, class-defined items such as triggers and custom controllers are, as a rule, treated as without sharing when the keyword is omitted.
Therefore, the one that automatically follows the running user’s settings is the anonymous block.
Using the with sharing, without sharing, and inherited sharing Keywords
Q9Salesforce Platform Developer
Show answer
Correct answer: B. Dev Hub
Scratch orgs must be created and managed from a production org that has Dev Hub enabled.
Dev Hub is the central feature of Salesforce DX and manages the creation limits and history of scratch orgs.
The Environment Hub is a separate feature for release management, and a Sandbox is a different mechanism from Dev Hub.
Therefore, enabling Dev Hub is essential for introducing scratch orgs.
Enable Dev Hub in Your Org
Q10Salesforce Platform Developer
Show answer
Correct answer: A, D
In Apex tests, it is important to prepare your own test data rather than depending on external data. The recommended approach is to store a CSV file as a static resource in the org and load it with Test.loadData().
This approach lets you manage and reuse test data efficiently.
HttpCalloutMocks and WebServiceTests (such as Test.setMock) are mechanisms for mocking external web service callouts, not for loading data.
Therefore, the combination of CSV and a static resource is the best practice for loading test data.
Isolating Test Data from Organization Data in Unit Tests