Free Certified Platform Developer II Exam Braindumps (page: 4)

Page 4 of 90

An Apex class does not achieve expected code coverage. The testSetup method explicitly calls a method in the Apex class. How can the developer generate the code coverage?

  1. Verify the user has permissions passing a user into System.runAs().
  2. Call the Apex class method from a testMethod instead of the testSetup method.
  3. Add @testVisible to the method in the class the developer is testing.
  4. Use system.assert() in testSetup to verify the values are being returned.

Answer(s): B



A developer is trying to decide between creating a Visualforce component or a Lightning component for a custom screen.
Which functionality consideration impacts the final decision?

  1. Does the screen need to be rendered as a PDF?
  2. Does the screen need to be accessible from the Lightning Experience UI?
  3. Will the screen make use of a JavaScript framework?
  4. Will the screen be accessed via a mobile app?

Answer(s): A



A developer wishes to improve runtime performance of Apex calls by caching results on the client.
What is the best way to implement this?

  1. Decorate the server-side method with @AuraEnabled(cacheable=true).
  2. Set a cookie in the browser for use upon return to the page.
  3. Call the setStorable() method on the action in the JavaScript client-side code.
  4. Decorate the server-side method with @AuraEnabled(storable=true).

Answer(s): A



A developer is asked to update data in an org based on new business rules. The new rules state that Accounts with the type set to 'Customer' should have a status of 'Active', and Accounts with the type set to 'Prospect' should have a status of 'Pending'. No other changes to data should be made.
Which code block will accurately meet the business requirements?

  1. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'}
    List<Account> accountUpdates = new List<Account>();
    for ( Account a : [SELECT Id, Type FROM Account]){
    if ( statusMap.containsKey(a.Type) ) {
    a.Status = a.Type == 'Customer' ? 'Active' : 'Pending';
    }
    accountUpdates.add(a);
    }
    update accountUpdates;
  2. Map<String, String> statusMap = new Map<String, String>{'Customer'=>'Active', 'Prospect'=>'Pending'}
    List<Account> accountUpdates = new List<Account>();
    for ( Account a : [SELECT Id, Type FROM Account WHERE Status IN :statusMap.keySet()]){
    a.Status = statusMap.get(a.Type);
    accountUpdates.add(a);
    }
    update accountUpdates;
  3. List<Account> accountUpdates = new List<Account>();
    for ( Account a : [SELECT Id, Type FROM Account]){
    if ( String.isNotBlank(a.Type) && a.Type == 'Customer' ){
    a.Status = 'Active';
    }
    if ( String.isNotBlank(a.Type) && a.Type == 'Prospect' ){
    a.Status = 'Pending';
    }
    accountUpdates.add(a);
    }
    update accountUpdades;
  4. List<Account> accountUpdates = new List<Account>();
    for ( Account a : [SELECT Id, Type FROM Account]){
    a.Status = a.Type == 'Customer' ? 'Active' : 'Pending';
    accountUpdates.add(a);
    }
    update accountUpdates;

Answer(s): C



Page 4 of 90



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

Jenil Gandhi commented on November 14, 2024
Hi everyone could sone share the certification voucher for PD2.
INDIA
upvote

Aniq commented on December 02, 2023
Hi every one Could some share the certification voucher for PD2
Anonymous
upvote

Rasheed commented on June 07, 2023
Worth the price. I got 50% off when I selected 2 exams.
PAKISTAN
upvote

Lisha commented on September 21, 2022
Thank you!
Anonymous
upvote