Platform Developer II Mock 6 26/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 6 1. 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 Move the SOQL to fetch the account record outside of the for loop. Use Trigger.old instead of Trigger.new. Move business logic inside the Opportunity trigger. Move the DML outside of the for loop. 2. A developer needs to design a custom object that will be integrated into a back-end system. What should the developer do to ensure good data quality and to ensure that data imports, integrations, and searches perform well? (Choose two.) Configure a custom field as unique Configure a custom field as indexed Configure a custom field as external ID Configure a custom field as Salesforce ID 3. Which method should be used to convert a Date to a String in the current user's locale? Date.parse String. valueOf Date.format String.format 4. What is the transaction limit for the number of records per DML statement? There is no limit 50,000 20,000 5,000 10,000 5. A developer receives an error when trying to call a global server-side method using the @remoteAction decorator. How can the developer resolve the error? Add static to the server-side method signature. Decorate the server-side method with (static=false) Change the function signature to be private static. Decorate the server-side method with (static=true). 6. A company decides that every time an Opportunity is created, they want to create a follow up Task and assign it to the Opportunity Owner. What should a developer use to implement the requirements? A trigger on Task A trigger on Opportunity A Process Builder on Opportunity A Process Builder on Task 7. A Visualforce Page throws an Attempt to dereference a null object error for a Contact. What change In the controller will fix the error? Change the setters signature to return a Contact. Change the getter's signature to be static Contact. Declare a static final Contact at the top of the controller. Use a condition in the getter to return a new Contact if it is null. 8. The "Webservice" keyword___________. Used for any member variables included All of the above Can be used on all classes Method must be static, and class must be global 9. A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on the Opportunity's Account whenever an Opportunity is dosed. In the test class for the trigger, the assertion to validate the Last Sold Date field fails. What might be causing the failed assertion? The test class has not defined an Account owner when inserting the test data. The test class has not implemented seeAIIData-truwh the test method. The test class is not using System.runAs() to run tests as a Salesforce administrator. The test class has not re-queried the Account record after updating the Opportunity. 10. A developer is creating unit tests for code that makes SOAP web service callouts. The developer needs to insert some test data as part of the unit tests setup. What are three actions to enable this functionality? (Choose three.) Surround the data insertion with Test.startTest(), Test.stopTest() Surround the callout with TeststartTest(), Test.stopTest() Implement the WebServiceMock interface Update code to call Test.setMock() Implement the HttpCalloutMock interface 11. A company has a custom object, Sales Demo Request, that has a lookup to an Opportunity. It is required that a Sales Demo Request record be created when an Opportunity's Probability is greater than 50%. What is the optimal way to automate this? Use an Apex Trigger on Opportunity. Build a Process on Opportunity Create a Workflow on Opportunity. Build a Flow on Opportunity. 12. What tool in the Developer Console contains information on SOQL query Cardinality? Query Plan Tool Log Inspector Checkpoints tab View State Tab Query Editor 13. A developer has a Batch Apex process, Batch_Account_Sales, that updates the sales amount for 10,000 Accounts on a nightly basis. The Batch Apex works as designed In the sandbox. However, the developer cannot get code coverage on the Batch Apex class. The test class is below: What is causing the code coverage problem? The account creation already sets the sates amount to 0. The batch needs more than one account record created. The executeBatch must fail within test. startTest ( ) and - test. stopTest(). The batch process will not recognize new accounts created in the same session 14. A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue? Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there. Add a before insert trigger on Account to set the value of the required field. Change the required field to be a validation rule that excludes the System Administrator profile. Add the required field to the data setup for all of the unit tests. 15. Which technique can run custom logic when a Lightning web component is loaded? Use an aura:handler "init" event to call a function. Use the renderedCallback ( ) method. Use the connectedCallback () method. Call SA.enqueueAction passing in the method to call. 16. The Apex method is executed in an environment with a large data volume count for Accounts, and the query Is performing poorly. Which technique should the developer Implement to ensure the query performs optimally, while preserving the entire result set? Annotate the method with the @Future annotation. Break down the query into two individual queries and Join the two result sets. Create a formula field to combine the CreatedDate and RecardType value, then filter based on the formula. Use the Database.queryLocator method to retrieve the accounts. 17. What are three benefits of using static resources in Visualforce and Lightning Components? Choose 3 answers Static resource files do not count against an organization's quota of data storage. Relative paths can be used in files in static resource archives to refer to other content within the archive. Static resource files can be packaged into a collection of related files in a zip or jar archive. Static resource files can be referenced by using the $Resource global variable instead of hardcoded IDs. Static resource files are automatically minified. 18. What is a consideration when testing batch Apex? (Choose two.) Test methods must call the batch execute() method once Test methods must execute the batch with a scope size of less than 200 records Test methods must run the batch between TeststartTestQ and Test.stopTestQ Test methods must use the @isTest (SeeAIIData=true) annotation 19. What is a potential design issue with the following code? The code will result in a System.LimitException: Apex CPU time limit exceeded error SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity The code will result in a System.LimitException : Too many script statements error The code will result in a System.DmException:Entity_is_Deleted error 20. A company requires an external system to be notified whenever an account is updated. What LimitException could the following code trigger? System.LimitException: Too many future calls System.LimitException: Too many SOQL queries System.CalloutException: Callout from triggers are currently not supported System.LimitException: Too many callouts 21. Universal Containers wants to use an external Web Service provided by a third-party vendor to validate that shipping and billing addresses are correct. The current vendor uses basic password authentication, but Universal Containers might switch to a different vendor who uses OAuth. What would allow Universal Containers to switch vendors without updating the code to handle authentication? Custom Setting (List) Dynamic Endpoint Custom Metadata Named Credential 22. A developer notices the execution of all the test methods in a class takes a long time to run, due to the initial setup of ail the test data that is needed to perform the tests. What should the developer do to speed up test execution? Reduce the amount of test methods in the class. Define a method that creates test data and annotate with @testSetup. Define a method that creates test data and annotate with @createData Ensure proper usage of test data factory In all test methods. 23. As part of point-to-point integration, a developer must call an external web service which, due to high demand, takes a long time to provide a response. As part of the request, the developer must collect key inputs from the end user before making the callout. Which two elements should the developer use to implement these business requirements? Choose 2 answers Screen now Lightning web component Apex method that returns a Continuation object Process Builder 24. Which statement is true regarding the use of user input as part of a dynamic SOQL query? Free text input should not be allowed, to avoid SOQL injection The string should be URL encoded by the input form to prevent errors Quotes should be escaped to protect against SOQL injection The String.format() method should be used to prevent injection 25. What is the transaction limit on the max timeout for all callouts? 60 seconds 120 seconds 60 seconds (synchronous); 200 seconds (async) There is no limit 120 seconds (synchronous); 200 seconds (async) 26. Refer to the code snippet below: When a Lightning web component is rendered, a list of opportunity that match certain criteria should be retrieved from the database and displayed to the end-user. Which three considerations must the developer implement to make the fetchOpps method available within the Lightning web component? The fetchOpps method cannot mutate the result set retrieved from the database. The fecthOpps method must be annotated with the @ AuraEnabled annotation. The fetchOpps method must be annotated with the @InvocableMethod annotation. The fetchOpps method must specify the (cacheable =true) attribute The fetchOpps method must specify the (continustion-true) attribute 27. When a Lightning web component is rendered, a list of opportunity that match certain criteria should be retrieved from the database and displayed to the end-user. Which three considerations must the developer implement to make the fetchOpps method available within the Lightning web component? The fetchOpps method cannot mutate the result set retrieved from the database. The fecthOpps method must be annotated with the @ AuraEnabled annotation. The fetchOpps method must be annotated with the @InvocableMethod annotation. The fetchOpps method must specify the (cacheable =true) attribute The fetchOpps method must specify the (continustion-true) attribute 28. pic Use REGEX expressions to format the values retrieved via SOQL. Use the FOR VIEW clause in the SOQL Query. Use a wrapper class to format the values retrieved via SOQL. Use the FORMAT() function in the SOQL query. 29. A developer is creating a page in App Builder that will be used in the Salesforce mobile app. Which two practices should the developer follow to ensure the page operates with optimal performance? Choose 2 answers Limit five visible components on the page. Limit the number of Tabs and Accordion components. Analyze the page with Performance Analysis for App Builder. Limit 25 fields on the record detail 30. When developing a Visualforce page that will be used by a global organization that does business in many languages and many currencies, which feature should be used? (Choose three.) getLocalCurrency() convertCurrency() Global Labels Custom Labels Translation Workberic 31. Which is a valid Apex REST Annotation? (Choose two.) HttpUpsert HttpDelete HttpPatch HttpAction 32. Which use case is an appropriate fit for the future asynchronous Apex method? (Choose two.) A developer has long-running methods and needs to prevent delaying an Apex transaction A developer needs to segregate DML operations and bypass the mixed save DML error A developer has jobs that need larger query results than regular transactions allow A developer has long-running jobs with large data volumes that need to be performed in batches 33. Universal Containers wants to be able to bring up an Account detail page and view a table of containers currently being rented. The user wants to be able to dick on a container In the table and quickly edit and save the location of the container. In addition to this, the page should have a section that shows the location of each container on a map. Universal Containers wants the map to re-render whenever the location of a container is changed. What can a developer use to accomplish this task? Two Lightning Components leveraging Application Events Two Lightning Components leveraging Platform Events Two Visualforce Page Components leveraging Application Events A single visualforce Page leveraging Platform Events 34. 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? Call the Apex class method from a testMethod instead of the testSetup method. Use system.assert() in testSetup to verify the values are being returned. Verify the user has permissions passing a user into System.runAs(). Add @testVisible to the method in the class the developer is testing. 35. What is the transaction limit for the number of DML statements allowed? 20 2,000 100 (synchronous), 200 (async) 200 (synchronous), 100 (async) 150 36. A developer created three Rollup Summary fields: Total_timesheets_c, Total_Approved_timesheet_c and Total_project_Timesheet_c in the custom object, project _c Now, the developer is tasked with created a new field to show the ratio between and approved. what are two benefits using formula field instead of apex trigger A test class that validates the formula field is needed for deployment. A formula field will calculate the value retroactively for existing records. No test methods will be executed during deployment. Using a formula field reduces maintenance overhead. 37. A visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance? use lazy loading to load the data on demand, instead of in the controller's constructor. use an in the page to load all of the data asynchronously. use Javascript to move data processing to the browser instead of the controller. Use the transient keyword for the List variables used in the custom controller. 38. A developer writes the following code: While testing the code, the developer receives the following error message: System.CalloutException : You have uncommitted work pending What should the developer do? (Choose two.) Ensure all callouts are completed prior to executing DML statements Use Database.insert (order, true) to immediately commit any database changes Move the web service callout into an future method Use the asyncSend() method of the HTTP class to send the request in async context 39. Which two objects can be inserted in the same transaction? (Choose two.) Opportunity and User Account and Group Case and CaseComment Account and AccountShare 40. A developer is integrated with a legacy on-premises SQL database. What should the developer use to ensure the data being integrated is matched to the right records in Salesforce? Formula field External Object Lookup field External Id field 41. A corporation has many different Salesforce orgs, with some different objects and some common objects, and wants to build an application that can create, retrieve, and update common object records in all of the different orgs. Which method of integration should the application use? Metadata API SOAP API with the Enterprise WSDL SOAP API with the partner WSDL Apex REST Web Service 42. A company has a web page that needs to get Account record information, given its Salesforce record ID, from JavaScript on the page and then display it. Which method of integration is optimal? SOAP API REST API Apex REST Web Service Apex SOAP Web Service 43. 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? Static resources Custom metadata Custom settings System.Cookie class 44. When developing a Lightning web component, which setting displays lightning-layout-items in one column on small devices, such as mobile phones, and in two columns on tablet-size and desktop- size screens? Set size-"6" small-device-size-"12" Set size-"12" medium-device-size="6" Set size=M6" mobile-device-size="12" Set size-"12" tablet-device-size-"6" 45. Which statement is true regarding savepoints? Reference to savepoints can cross trigger invocations. Static variables are not reverted during a rollback. Savepoints are not limited by DML statement governor limits You can roll back to any savepoint variable created In any order 46. What is a benefit of JavaScript remoting over Visualforce Remote Objects? Supports complex server-side application logic Does not require any Apex code Allows for specified re-render targets Does not require any JavaScript code 47. A developer creates a Lightning web component to allow a Contact to be quickly entered- However, error messages are not displayed. Which component should the developer add to the form to display error messages? aura:messages lightning-error lightning-messages apex:messages 48. Consider the above trigger intended to assign the Account to the manager of the Account''s region. Which two changes should a developer make in this trigger to adhere to best practices? Choose 2 answers Use a Map accountMap instead of List accountList. Remove the last line updating accountList as it is not needed. Use a Map to cache the results of the Region__c query by Id. Move the Region__c query to outside the loop. 49. The Contact object in an org is configured with workflow rules that trigger field updates. The fields are not updating, even though the end user expects them to. The developer creates a debug log to troubleshoot the problem. What should the developer specify in the debug log to see the values of the workflow rule conditions and debug the problem? ERROR level for the Database log category INFO level for the Workflow log category INFO level for the Database log category ERROR level for the Workflow log category 50. In which of the following scenarios would it be acceptable to use programmatic sharing instead of declarative sharing? (Choose three.) Every record created by sales users needs to be visible to their respective manager There is an existing, external system of truth for user access assignments which will continue to drive access and be integrated with salesforce Team functionality is required on custom objects Poor performance when using native sharing components You need to change record access to read/write for all users utilising a lightning component 51. A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory assignments are completed in the external system. What is the optimal way to update the Accounts from the external system? Bulk API Apex REST Web Service SOAP API Composite REST API 52. Universal Containers needs to integrate with their own, existing, internal custom web application. The web application accepts JSON payloads, resizes product images, and sends the resized images back to Salesforce. What should the developer use to implement this integration? A workflow rule with an outbound message that contains a session ID A flow that calls an @future method that allows callouts A platform event that makes a callout to the web application An Apex trigger that calls an @future method that allows callouts 53. look pic Implement Test.isRunningtest ( ) to prevent chaining jobs during test execution. Enclose System.enqueueJob (new orderQueueable Job ( }) within Test. starttest and Test, stoptest () Implement seeAllData-true to ensure the Queueable )ob is able to run in bulk mode. Ensure the running user of the test class has, at least, the View All permission on the Order object 54. A company's support process dictates that any time a Case is closed with a Status of 'Could not fix,' an Engineering Review custom object record should be created and populated with information from the Case, the Contact, and any of the Products associated with the Case. What is the correct way to automate this using an Apex trigger? A before update trigger that creates the Engineering Review record and inserts it An after update trigger that creates the Engineering Review record and inserts it An after upsert trigger that creates the Engineering Review record and inserts it 55. An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary' to control this feature. The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters. What is the optimal way to implement these requirements? Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger on Contact for the last name logic. write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic. write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic. write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic. 56. Choose the correct definition for apex:actionFunction. Can be associated with an AJAX request (actionFunction/actionSupport/actionPoller) and shows content conditionally depending on the status of the request (in progress/complete). Use the "id" field to specify name; use "status" field on related components to connect them Adds AJAX support to another component (e.g. onClick, onMouseUp, onFocus, etc.) Allows for controller methods to be called directly from Javascript. Must be| encapsulated in tags. Unlike actionSupport, these functions can be called directly from Javascript code B Sends an AJAX request according to the time interval you specify. If this ever gets re-rendered, it resets Signifies which components should be processed by the server when an AJAX request is generated 57. Refer to re code segment above. When following best practices for writing Apex taggers, which two lots are wrong or cause for concern? Choose 2 answers Line 6 Line 11 Line 20 Line 16 58. A company has code to update a Request and Request Lines and make a callout to their external ERP system's REST endpoint with the updated records. The CalloutUtil. makeRestCallout fails with a 'You have uncommitted work pending. Please commit or rollback before calling out' error. What should be done to address the problem? Change the CalloutUtil.makeRestCallout to an @future method Move the CalloutUtil.makeRestCallout method call below the catch block. Remove the Database.setSavepoint and Database.rollback. Change the CalloutUtil.makeRestCallout to an @InvocableMethod method. 59. A user receives the generic "An internal server error has occurred" while interacting with a custom Lightning Component. What should the developer do to ensure a more meaningful message? Add an error-view component to the markup. Use ProcessBuilder to catch the error. Use an AuraHandledException in a try/catch block. Add an onerror event handler to the tag. 60. During the Visualforce Page execution, what step follows immediately after "Evaluate constructors on controller and extensions"? Evaluate constructors, extensions, and expression on attribute definitions on any custom components present Create the view state Evaluate expressions, attribute actions, and other method calls (getters/setters) on main page Send HTML to Browser Time is Up! Time's up