Saturday, April 27, 2019

Salesforce Certification PD1 Sample Questions 2019 Part1


1. A developer needs to create a baseline set of data (Accounts, Contacts, Products, Assets) for an entire suite of tests allowing them to test independent requirements various types of Salesforce Cases. Which approach can efficiently generate the required data for each unit test?

  Use @TestSetup with a void method.
   Create a mock using the Stub API.
   Create test data before Test.startTest() in the unit test.
   Add @IsTest (see AllData=true) at the start of the unit test class.

2. Which three resources in a Lightning Component Bundle can contain JavaScript functions?

   Helper
   Renderer
   Controller
   Design
   Style

3. which query should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contacts that have the company name "Universal Containers"?

  FIND 'Universal Containers' IN Name Fields RETURNING lead(id, name), account(id, name), contact(id, name)
   SELECT Lead.id, Lead.Name, Account.Id, Account.Name, Contact.id, Contact.Name FROM Lead, Account,Contact WHERE Company Name = 'Universal Containers'
   SELECT lead(id, name), account(id, name), contact(id, name) FROM Lead, Account, Contact WHERE Name ='Universal Containers'
   FIND 'Universal Containers' IN CompanyName Fields RETURNING lead(id, name), account(id, name), contact(id,name)

4. A developer needs an Apex method that can process Account or Contact records. Which method signature should the developer use?

   public void doWork(Account || Contact)
   public void doWork(Record theRecord)
   public void doWork(sObject theRecord)
   public void doWork(Account Contact)

5. Which two combined methods should a developer use to prevent more than one open Opportunity on each Account? Choose 2 answers

   Create an Account Roll-up Summary field to count open Opportunities
   Create an opportunity Workflow Rule to auto-close the opportunity
   Create an Account Trigger to generate an error on Opportunity insert
   Create an opportunity Validation Rule to generate an error on insert.

6. Which two conditions cause workflow rules to fire?

   Changing the territory assignments of accounts and opportunities
   Updating records using the bulk API
   Converting leads to person accounts
   An Apex Batch process that changes field values

7. A developer needs to create an audit trail for records that are sent to the recycle bin. Which type of trigger is most appropriate to create?

   after undelete
   before delete
   after delete
   before undelete

8. From which two locations can a developer determine the overall code coverage for a sandbox?

   The Test Suite Run panel of the Developer Console
   The Tests tab of the Developer Console
   The Apex Test Execution page
   The Apex classes setup page

9. Which two approaches optimize test maintenance and support future declarative configuration changes? Choose 2

   Create a method that loads valid Account records from a static resource, then call this method within test methods
   Create a method that creates valid records, then call this method within test methods
   Create a method that queries for valid records, then call this method within test methods
   Create a method that performs a callout for valid records, then call this method within test methods

10. A developer is creating an enhancement to an application that will allow people to be related to their employer. Which data model should be used to track the data?

   Create a junction object to relate many people to many employers through master-detail relationships
   Create a junction object to relate many people to many employers through lookup relationships
   Create a lookup relationship to indicate that a person has an employer
   Create a master-detail relationship to indicate that a person has an employer

11. A developer uses an after update trigger on the Account object to update all the Contacts related to the Account. The trigger code shown below is randomly failing.


 List<Contact> theContacts = new List<Contact>(); 

 for (Account a : Trigger.new) { 
   for (Contact c : (SELECT Id, Account_Date__C FROM Contact WHERE AccountId = :a.Id]) { 
     c.Account_Date__c = Date.today(); 
     theContacts.add(c);
   } 
 } 
update theContacts;

Which line of code is causing the code block to fail?

   A SOQL query is located inside of the for loop
   The trigger processes more than 200 records in the for loop
   An exception is thrown if Account_Date_c is null
   An exception is thrown if theContacts is empty

12. Managed Packages can be created in which type of org?

   Developer Sandbox
   Developer Edition
   Partial Copy Sandbox
   Unlimited Edition

13. A developer needs to find information about @future methods that were invoked. From which system monitoring feature can the developer see this information?

   Background Jobs
   Asynchronous Jobs
   Scheduled Jobs
   Apex Jobs

14. How can a developer use a Set to limit the number of records returned by a SOQL query?

   Pass the Set as an argument in a reference to the Database.query() method
   Reference the Set in the WHERE clause of the query
   Pass the query results as an argument in a reference to the Set.containsAll() method
   Reference the set in the LIMIT clause of the query

15. In the code below, which type does String inherit from?
String s = 'Hello World';


   Prototype
   Class
   sObject
   Object

16. Which two queries can a developer use in a Visualforce controller to protect against SOQL injection vulnerabilities?

    String qryName = '%' + String.escapeSingleQuotes(name) + '%';
String qryString = 'SELECT ID FROM
WHERE Name LIKE \'%'+qryName+'%\'';
List<Contact> queryResult = Database.query(qryString);

    String qryName = '%' + name + '%';
String gryString = 'SELECT Id FROM Contact WHERE Name LIKE :qryName';
List<Contact> queryResult = Database.query(qryString);

    String gryString = 'SELECT Id FROM Contact WHERE Name
LIKE \'%' + name + '\'%';
List<Contact> queryResult = Database.query(qryString);

    String qryName = '%' + String.enforceSecurityChecks(name) + '%';
String gryString = 'SELECT Id FROM Contact WHERE Name :qryName;
List<Contact> queryResult = Database.query(qryString);

17. Which declarative process automation feature supports iterating over multiple records?

   Flows
   Validation rules
   Approval processes
   Workflow

18. Which is a valid Apex assignment?

   Integer x = 5.0;
   Integer x = 5 * 1.0;
   Float x = 5.0;
   Double x = 35

19. A developer creates a custom controller and custom Visualforce page by using the code block below.

   b, a, getMyString
   a, b, getMyString
   a, a, a
   a, b, b

20. A developer wants to store a description of a product that can be entered on separate lines by a user during product setup and later displayed on a Visualforce page for shoppers.Which field type should the developer choose to ensure that the description will be searchable in the custom Apex SOQL queries that are written?

   Text
   Text Area
   Text Area (Rich)
   Text Area (Long)

21. What are two benefits of the Lightning Component framework? Choose 2 answers

   It simplifies complexity when building pages, but not applications
   It provides an event-driven architecture for better decoupling between components
   It allows faster PDF generation with Lightning components
   It promotes faster development using out-of-the-box components that are suitable for desktop and mobile devices.

22. Which option should a developer use to create 500 Accounts and make sure that duplicates are not created for existing Account Sites?

   Data Import Wizard
   Sandbox Template
   Salesforce-to-Salesforce
   Data Loader

23. An Account trigger updates all related Contacts and Cases each time an Account is saved using the following two DML statements:

update allconacts;
update allCases;

What is the result if the Case update exceeds the governor limit for maximum number of DML records?
   The Account save succeeds and no Contacts or Cases are updated
   The Account save is retried using a smaller trigger batch size
   The Account save succeeds, Contacts are updated, but Cases are not
   Account save fails and no Contacts or Cases are updated

24. A Platform Developer needs to write an Apex method that will only perform an action if a record is assigned to a specific Record Type. Which two options allow the developer to dynamically determine the ID of the required Record Type by its name? Choose 2 answers

   Execute a SOQL query on the RecordType object
   Hardcode the ID as a constant in an Apex class
   Make an outbound web services call to the SOAP API
   Use the getRecordTypeInfosByName() method in the DescribesObjectResult class

25. How many levels of child records can be returned in a single SOQL query from one parent object?

   1
   3
   5
   7

26. A developer created a Visualforce page and a custom controller with methods to handle different buttons and events that can occur on the page.What should the developer do to deploy to production?

   Create a test class that provides coverage of the Visualforce page
   Create a test class that provides coverage of the custom controller
   Create a test page that provides coverage of the Visualforce page
   Create a test page that provides coverage of the custom controller

27. Which two statements can a developer use to throw a custom exception of type MissingFieldValueException?

   throw new MissingFieldValueException('Problem occurred');
   throw (MissingFieldValueException, 'Problem occurred');
   throw Exception(new MissingFieldValueException());
   throw new MissingFieldValueException();

28. A change set deployment from a sandbox to production fails due to a failure in a managed package unit test. The developer spoke with the managed package owner and they determined it is a false positive and can be ignored. What should the developer do to successfully deploy?

   Edit the managed package's unit test
   Select "Fast Deploy" to run only the tests that are in the change set
   Select "Run local tests" to run only the tests that are in the change set
   Select "Run local tests" to run all tests in the org that are not in the managed package

29. Which two components are available to deploy using the Metadata API?

   Web-to-Lead
   Lead Conversion Settings
   Web-to-Case
   Case Settings

30. A developer wants to handle the click event for a lightning:button component. The onclick attribute for the component references a JavaScript function in which resource in the component bundle?

   helper.js
   renderer.js
   handler.js
   controller.js

31. A developer needs to provide a way to mass edit, update, and delete records from a list view. In which two ways can this be accomplished? Choose 2 answers

   Configure the user interface and enable both inline editing and enhanced lists
   Create a new Visualforce page and Apex Controller for the list view that provides mass edit, update, and delete functionality
   Download an unmanaged package from the AppExchange that provides customizable mass edit, update, and delete functionality
   Download a managed package from the AppExchange that provides customizable Enhanced List Views and buttons

32. Which two statements are acceptable for a developer to use inside procedural loops? 

   Account a = (SELECT ID, Name FROM Account WHERE Id = icon.AccountId LIMIT 1];
   delete contactList;
   contactList.remove(i);
   Contact con = new Contact();

16 comments:

  1. Please comment if you have any query

    ReplyDelete
  2. Regarding question, "Which is a valid Apex assignment?".
    Float is not a primitive data type in the Apex. Correct answer should be Double x = 35.

    ReplyDelete
  3. 7. A developer needs to create an audit trail for records that are sent to the recycle bin. Which type of trigger is most appropriate to create?

    Wouldn't this be "after delete"
    "and to affect changes in other records, such as logging into an audit table or firing asynchronous events with a queue." (SF)

    ReplyDelete
  4. could someone send me this dumps with all questions
    pr.saini@ymail.com

    ReplyDelete
  5. 11. A developer uses an after update trigger on the Account object to update all the Contacts related to the Account. The trigger code shown below is randomly failing.

    Is A) SOQL query is located inside of the for loop

    ReplyDelete
    Replies
    1. Which declarative process automation feature supports iterating over multiple records?

      is Flows

      Delete
  6. can you post the recent dumps

    ReplyDelete
  7. for question 30, Why it is not Controller.js?

    ReplyDelete
  8. it should be controller.js i am also thinking

    ReplyDelete
  9. For question 8, It should be Test tab in developer console and Apex classes set up page. Apex test execution will have a link to Apex class set up page to see the individual class code coverage.

    ReplyDelete
    Replies
    1. but here it says the overall code coverage not individual ones so I think the Apex test execution is correct

      Delete
  10. For Question 30, controller.js will also be a correct one right?

    ReplyDelete
  11. A developer wants to handle the click event for a lightning:button component. The onclick attribute for the component references a JavaScript function in which resource in the component bundle?

    correct answer is controller.js

    helper.js is the answer for question: A developer has javascript code that needs to be called by controller functions in multiple
    components by extending a new abstract component. Which resource in the abstract
    component bundle allows the developer to achieve this

    ReplyDelete