A developer is creating a Lightning web component to showa 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?
Correct Answer: B
The correct answer is option B. Use Security.stripInaccessible to remove fields inaccessible to the current user. This method takes a list of records and an access type (READ, UPDATE, CREATE, or UPSERT) and returns a new list of records with the inaccessible fields removed. This way, the Lightning web component can display the records without throwing any errors due to field-level security. Option A is incorrect because WITH SECURITY_ENFORCED is a SOQL clause that enforces field-level security on all fields in the query. If the query returns any fields that the user does not have access to, the query will throw an exception. This is not desirable for the Lightning web component, as it will prevent the component from displaying any records at all. Option C is incorrect because Lightning Data Service is a layer of Lightning web components that provides access to Salesforce data and metadata, cache management, and data synchronization. However, Lightning Data Service does not automatically handle field-level security for the records it retrieves. The developer still needs to use Security.stripInaccessible or another method to remove the inaccessible fields. Option D is incorrect because Lightning Locker Service is a security feature that isolates Lightning web components from each other and from the rest of the page. It does not enforce sharing rules or field-level security for the data that the components access. References: Security.stripInaccessible (Apex Developer Guide)), WITH SECURITY_ENFORCED (Apex Developer Guide)), Lightning Data Service Basics (Trailhead)), Lightning Locker (Lightning Web Components Developer Guide))
Question 2
Which two platform features allow for the use of unsupported languages? Choose 2 answers
Correct Answer: B,C
Question 3
A developer is asked to write helper methods that create test data for unit tests. What should be changed in the Testvtils class so that its methods are only usable by unit test methods?
Correct Answer: C
By adding the @IsTest annotation above the class definition (line 01), it indicates that this class is a test class, and therefore, can only be used by other test classes. This ensures that the helper methods within are only accessible to unit tests, aligning with the best practices of encapsulation and modularity in Apex code. References: The related information can be found in the Apex Testing module on Trailhead ([Apex Testing](1(https://trailhead.salesforce.com/en/content/learn/modules/apex_testing%29%29.
Question 4
Which two statements are acceptable for a developer to use inside procedural loops?
Correct Answer: A,C
Question 5
In terms of the MVC paradigm, what are two advantages of implementing the view layer of a Salesforce application using Lightning Web Component-based development over Visualforce? Choose 2 answers