Free Platform-Developer-II Exam Braindumps

Pass your Platform Developer II exam with these free Questions and Answers

Page 17 of 35
QUESTION 76

- (Exam Topic 3)
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?

  1. A. Use Database.insert () and set the allorNone parameter to true.
  2. B. Use addError () on the parent record if an error occurs on the child record.
  3. C. Set a database savepoint to rollback if there are errors.
  4. D. Delete the parent record in the catch statement when an error occurs on the child record DML operation.

Correct Answer: C

QUESTION 77

- (Exam Topic 1)
A developer wants to write a generic Apex method that will compare the Salesforce Name filed between any two object records, for example to compare the Name field of an Account and an Opportunity; or the name of an Account and a Contact.
How should the developer do this?

  1. A. Use a String.replace( ) method to parse the contents of each Name field.
  2. B. Invoke a Schema,describe() function to compare the values of each Name field.
  3. C. Cast each object into an sObject and use sObject.get(Name’) to compare the Name fields.
  4. D. Use the salesforce metadata API to extract the value of each object and compare the name fields

Correct Answer: C

QUESTION 78

- (Exam Topic 3)
A developer is building a Lightning web component to get data from an Apex method called getData that takes a parameter, name. The data should be retrieved when the user clicks the Load Data button.
Exhibit.
Platform-Developer-II dumps exhibit
What must be added to get the data?

  1. A. Add @wire(getData, (name: $name’)} to the account field and this, account = getData ( ) ; to t loadData ( ) function.
  2. B. Add this, account = getData (this,name); to the loadData ( ) function.
  3. C. Add getData ({ name; this,name}) , then (result=> { this.account = result}) to the LeadData ( ) function.
  4. D. Add @wire(getData, {name: $name’}) to the account field and delete loadData ( ) because it is not needed.

Correct Answer: C

QUESTION 79

- (Exam Topic 1)
What is a recommended practice with regard to the Apex CPU limit? (Choose two.)

  1. A. Optimize SOQL query performance
  2. B. Use Map collections to cache sObjects
  3. C. Avoid nested Apex iterations
  4. D. Reduce view state in Visualforce pages

Correct Answer: BC

QUESTION 80

- (Exam Topic 1)
Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?

  1. A. use the Database.Delete method if the Contact insertion fails.
  2. B. Disable validation rules on Contacts and set default values with a Trigger.
  3. C. use the Database.Insert method with allOrNone set to False.
  4. D. use setSavePoint() and rollback() with a try/catch block.

Correct Answer: D

Page 17 of 35

Post your Comments and Discuss Salesforce Platform-Developer-II exam with other Community members: