C Certs Club
Home
Oracle SAP Microsoft Cisco CompTIA Fortinet Salesforce Nutanix Linux Foundation Amazon View All Vendors →
Login Register

Salesforce CRT-450 - Salesforce Certification Preparation for Platform Developer I Certification Exam

Download Exam View Entire Exam
Page: 1 / 4
Question #1 (Topic: demo questions)

A developer has an integer variable called maxAttempts. The developer needs to ensure
that once maxAttempts is initialized, it preserves its value for the length of the Apex
transaction; while being able to share the variable's state between trigger executions.
How should the developer declare maxAttempts to meet these requirements?


A.
Declare maxattempts as a constant using the static and final keywords.
B.
Declare maxattempts as a member variable on the trigger definition.
C.
Declare maxattempts as a variable on a helper class.
D.
Declare maxAttempts as a private static variable on a helper class
Correct Answer: A
Explanation:
D. Declare maxAttempts as a private static variable on a helper class. A static variable in Apex is initialized only once per transaction and its value is shared across all trigger executions within that same transaction, making it ideal for preserving state and controlling behavior such as recursion or retry limits. By placing maxAttempts in a helper class as a private static variable, the developer ensures that the value remains available and unchanged throughout the transaction while being accessible to all trigger invocations. For example:
public class TriggerHelper {
    private static Integer maxAttempts = 5;
    public static Integer getMaxAttempts() {
        return maxAttempts;
    }
}
This approach satisfies both requirements: maintaining the value for the duration of the Apex transaction and sharing the variable's state between trigger executions.

Question #2 (Topic: demo questions)

niversal Containers recently transitioned from Classic to Lightning Experience.
One of its business processes requires certain values from the Opportunity object to be sent via an
HTTP REST callout to its external order management system when the user presses a custom button
on the Opportunity detail page. Example values are as follows:
* Name
*Amount
* Account
Which two methods should the developer implement to fulfill the business requirement?
Choose 2 answers

A.
Create a custom Visualforce quick action that performs the HTTP REST callout, and use a
Visualforce quick action to expose the component on the Opportunity detail page.


B.
Create a Remote Action on the Opportunity object that executes an Apex immediate action to
perform the HTTP REST callout whenever the Opportunity is updated.
C.
Create a Lightning component quick action that performs the HTTP REST callout, and use a
Lightning Action to expose the component on the Opportunity detail page.
D.
Create an after update trigger on the Opportunity object that calls a helper method using @future
(Callout=true) to perform the HTTP REST callout.
Correct Answer: A, C
Explanation:
Explanation: The requirement states that the HTTP REST callout should occur when the user presses a custom button on the Opportunity detail page. In Lightning Experience, this is typically implemented using a Quick Action. A Visualforce Quick Action (A) can execute Apex code that performs the callout and can be exposed on the Opportunity record page. Similarly, a Lightning Component Quick Action (C) can invoke Apex to perform the HTTP REST callout and is the preferred Lightning Experience solution. Both approaches are user-initiated and execute only when the button is clicked.
Why not B? A Remote Action is a Visualforce concept and an Apex Immediate Action is used in automation tools, not for a user-clicked custom button on an Opportunity page.
Why not D? An after-update trigger with @future(callout=true) executes whenever the Opportunity is updated, not specifically when the user clicks the custom button. This does not satisfy the requirement of triggering the callout directly from the button press.

Question #3 (Topic: demo questions)

A developer is asked to write helper methods that create test data for unit tests.

What should be changed in the Testutils class so that its methods are only usable by unit test

methods?


A.
@isTest above line 03.
B.

Add @istest above line 01.


C.
Change public to private on line 01.


D.
Remove static from line 03.
Correct Answer: A
Explanation:
To ensure that the methods in the TestUtils class are only available to unit test code, the entire class should be marked with the @isTest annotation by adding it above line 01. In Apex, classes annotated with @isTest are excluded from the organization's code size limit and can only be referenced by test methods, making them ideal for utility classes that create test data or provide helper functionality for tests. Placing @isTest above the createAccount() method (Option A) would be invalid because the annotation applies to classes or test methods, not helper methods like this one. Changing the class to private (Option C) would only restrict visibility within the same class and would not make it test-only. Removing static from the method (Option D) would simply require an instance of the class to call the method and would not restrict its usage to test code. Therefore, the best solution is to annotate the entire class with 
Question #4 (Topic: demo questions)

A developer is creating a Lightning web component to show a list of sales records.
The Sales Representative user should be able to see the commission field on each record. The Sales
Assistant user should be able to see all fields on the record except the commission field.
How should this be enforced so that the component works for both users without showing any
errors?

A.
Use WITH SECURITY_ENFORCED In the SOQL that fetches the data for the component,
B.
Use Security.stripInaccessible Le to remove fields inaccessible to the current user.
C.
Use Lightning Locker Service to enforce sharing rules and field-level security.
D.
Use Lightning Data Service to get the collection of sales records.
Correct Answer: B
Explanation:
The requirement is that both users should be able to see the records, but the Sales Assistant should not see the Commission field, and the component should work without generating errors. The Apex method that retrieves the records should use Security.stripInaccessible() to automatically remove fields that the current user does not have permission to access before returning the data to the Lightning Web Component. This ensures that Sales Representatives receive the Commission field while Sales Assistants do not, and no exceptions are thrown. Option A (WITH SECURITY_ENFORCED) would throw a runtime exception if the query includes a field the user cannot access, causing errors rather than gracefully hiding the field. Option C is incorrect because Lightning Locker Service provides client-side security isolation, not field-level security enforcement. Option D (Lightning Data Service) respects CRUD and FLS but does not provide the same server-side filtering control needed when retrieving collections through Apex. Therefore, Security.stripInaccessible() is the best solution for enforcing field-level security while avoiding errors.
List<Sales__c> salesRecords = [
    SELECT Name, Amount__c, Commission__c
    FROM Sales__c
];
SObjectAccessDecision decision =
    Security.stripInaccessible(
        AccessType.READABLE,
        salesRecords
    );
return decision.getRecords();
Question #5 (Topic: demo questions)

Which three Salesforce resources can be accessed from a Lightning web component?
Choose 3 answers


A.

Static resources

B.
All external libraries
C.
SVG resources
D.
Third-party web components


E.
Content asset files
Next Question
Correct Answer: A, C, E
Explanation not available for this question.