ExamGecko
Home Home / Salesforce / Certified Platform Developer II

Salesforce Certified Platform Developer II Practice Test - Questions Answers, Page 35

Question list
Search
Search

List of questions

Search

Related questions











What are three reasons that a developer should write Jest tests for Lightning web components?

Choose 3 answers

A.
To test basic user interaction
A.
To test basic user interaction
Answers
B.
To verify that events fire when expected
B.
To verify that events fire when expected
Answers
C.
To test how multiple components work together
C.
To test how multiple components work together
Answers
D.
To verify the DOM output of a component
D.
To verify the DOM output of a component
Answers
E.
To test a component's non-public properties
E.
To test a component's non-public properties
Answers
Suggested answer: B, D, E

A developer created a Lightning web component for the Account record page that displays the five most recently contacted Contacts for an Account. The Apex method, getRecentContacts, returns a list of Contacts and will be wired to a property in the component.

Which two lines must change in the above ode to make the Apex method able to be wired?

Choose 2 answers

A.
Add AuraEnanled(cacheabletrue) to the line 08
A.
Add AuraEnanled(cacheabletrue) to the line 08
Answers
B.
Remove private from line 09.
B.
Remove private from line 09.
Answers
C.
Add @AuraEnabled (cacheabletrue) to line 03.
C.
Add @AuraEnabled (cacheabletrue) to line 03.
Answers
D.
Add public to line 04.
D.
Add public to line 04.
Answers
Suggested answer: C, D

A developer writes a lightning web component that displays a dropdown list of all custom objects in the org from which a user will select Apex method prepares and returns data to the component.

What should the developer do to determine which objects to include m the response?

A.
Check the isCustom ( ) value on the sObject describe result.
A.
Check the isCustom ( ) value on the sObject describe result.
Answers
B.
Use the getCustomObject ( ) method from the Schema class.
B.
Use the getCustomObject ( ) method from the Schema class.
Answers
C.
Import the list of all custom objects from @salesforce/schema.
C.
Import the list of all custom objects from @salesforce/schema.
Answers
D.
Check the getObjectType () value for Custom' or 'Standard' on the sObject describe result.
D.
Check the getObjectType () value for Custom' or 'Standard' on the sObject describe result.
Answers
Suggested answer: A

The following code segment is railed from a Trigger handler class from the Opportunity trigger:

Which two changes should improve this code and make it more efficient? Choose 2 answers

A.
Move the DML outside of the for loop.
A.
Move the DML outside of the for loop.
Answers
B.
Move the SOQL to fetch the account record outside of the for loop.
B.
Move the SOQL to fetch the account record outside of the for loop.
Answers
C.
Move business logic inside the Opportunity trigger.
C.
Move business logic inside the Opportunity trigger.
Answers
D.
Use Triginstead.old instead of Trigger.new.
D.
Use Triginstead.old instead of Trigger.new.
Answers
Suggested answer: A, B

A developer is asked to find a way to store secret data with an ability to specify which profiles and users can access which secrets.

What should be used to store this data?

A.
Static resources
A.
Static resources
Answers
B.
Custom settings
B.
Custom settings
Answers
C.
Custom metadata
C.
Custom metadata
Answers
D.
System.Cookie class
D.
System.Cookie class
Answers
Suggested answer: B

A developer is working with existing functionality that tracks how many times a stage has changed for an Opportunity. When the opportunity's stage is changed, a workflow rule is fired to increase the value of a filed by one. The developer wrote an after trigger to create a child record when the field changes from 4 to 5.

A user changes the stage of an Opportunities and manually sets the count field to 4. The count field updates to 5, but the child record is not created.

What is the reason this is happening?

A.
After triggers fire before workflow rules.
A.
After triggers fire before workflow rules.
Answers
B.
After triggers are not fired after field updates.
B.
After triggers are not fired after field updates.
Answers
C.
Trigger .new does not change after a field update.
C.
Trigger .new does not change after a field update.
Answers
D.
Trigger .old does not contain the updated value of the count field.
D.
Trigger .old does not contain the updated value of the count field.
Answers
Suggested answer: D

A developer created a class that implement he Queueable interface, as follows:

As part of the deployment process, the developer is asked to create a corresponding test class.

Which two actions should the developer take to successfully execute the test class?

Choose 2 answers

A.
Ensure the running user of the test class has, at least, the View All permission on the Order object
A.
Ensure the running user of the test class has, at least, the View All permission on the Order object
Answers
B.
Enclose System.enqueueJob (new orderQueueable Job ( }) within Test. starttest and Test, stoptest ()
B.
Enclose System.enqueueJob (new orderQueueable Job ( }) within Test. starttest and Test, stoptest ()
Answers
C.
Implement seeAllData-true to ensure the Queueable )ob is able to run in bulk mode.
C.
Implement seeAllData-true to ensure the Queueable )ob is able to run in bulk mode.
Answers
D.
Implement Test.isRunningtest ( ) to prevent chaining jobs during test execution.
D.
Implement Test.isRunningtest ( ) to prevent chaining jobs during test execution.
Answers
Suggested answer: C, D

Universal Containers decided to use Salesforce to manage a new hire interview process. A custom object called candidate as created with organization-wide default set to Private. A lookup on the Candidate object sets an employee as an the viewer user

A.
The record can be shared using a permission set.
A.
The record can be shared using a permission set.
Answers
B.
The record can be shared using a sharing rule.
B.
The record can be shared using a sharing rule.
Answers
C.
The record cannot be shared with the current setup
C.
The record cannot be shared with the current setup
Answers
D.
The record can be shared an Apex class.
D.
The record can be shared an Apex class.
Answers
Suggested answer: D

A developer is writing a Jest for a Lightning web component that conditionally displays child components based on a user's checkbox selections.

What should the developer do to property test that the correct components display and hide for each scenario?

A.
Reset the DOM after each test with the after Each method.
A.
Reset the DOM after each test with the after Each method.
Answers
B.
Add a teardown block to reset the DOM after each test.
B.
Add a teardown block to reset the DOM after each test.
Answers
C.
Create a new describe block for each test
C.
Create a new describe block for each test
Answers
D.
Create a new jsdom instance for each test
D.
Create a new jsdom instance for each test
Answers
Suggested answer: C

A business requires that every parent record must have a child record. A developer writes an Apex method with two DML statements to insert a parent record and a child record.

A validation rule blocks child records from being created. The method uses a try/catch block to handle the DML exception.

What should the developer do to ensure the parent always has a child record?

A.
Use Database.insert () and set the allorNone parameter to true.
A.
Use Database.insert () and set the allorNone parameter to true.
Answers
B.
Use addError () on the parent record if an error occurs on the child record.
B.
Use addError () on the parent record if an error occurs on the child record.
Answers
C.
Set a database savepoint to rollback if there are errors.
C.
Set a database savepoint to rollback if there are errors.
Answers
D.
Delete the parent record in the catch statement when an error occurs on the child record DML operation.
D.
Delete the parent record in the catch statement when an error occurs on the child record DML operation.
Answers
Suggested answer: A, C
Total 408 questions
Go to page: of 41