Platform Developer II Mock 4 26/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 4 1. A developer has a page with two extensions overriding the Standard controller for Case. Each extension has a method called Save. The page has a command button as defined: Each extension has a method called Save. The page has a command button as defined: apex:commandButton value="Save" action="{!save}"/ What will happen when a user clicks the command button? Save from Case Standard Controller will be executed. Save from CaseExtensionOne will be executed. Save from CaseExtensionTwo will be executed. All of the three Save methods will be executed. 2. A developer wrote an Apex class to make several callouts to an external system. If the URLs used in these callouts will change often, which feature should the developer use to minimize changes needed to the Apex class? Remote Site Settings Session Id Named Credentials Connected Apps 3. Which type of controller is best suited when you want all of the basic DML functions from an object's normal new/edit page? Standard List/Set Controller Standard Controller Controller Extensions Custom Controller 4. Which use case is an appropriate fit for the future asynchronous Apex method? (Choose two.) A developer has jobs that need larger query results than regular transactions allow A developer needs to segregate DML operations and bypass the mixed save DML error A developer has long-running jobs with large data volumes that need to be performed in batches A developer has long-running methods and needs to prevent delaying an Apex transaction 5. A company recently deployed a Visualforce page with a custom controller that has a data grid of information about Opportunities in the org. Users report that they receive a "Maximum view state size limit" error message under certain conditions. According to Visualforce best practice, which three actions should the developer take to reduce the view state? (Choose three.) Use the transient keyword in the Apex controller for variables that do not maintain state Use filters and pagination to reduce the amount of data Use the private keyword in the controller for variables Use the final keyword in the controller for variables that will not change Refine any SOQL queries to return only data relevant to the page 6. A company wants to implement a new call center process for handling customer service calls. It requires service reps to ask for the caller's account number before proceeding with the rest of their call script. Following best practices, what should a developer use to meet this requirement? Apex Trigger Flow Builder Process Builder Approvals 7. 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? Does the screen need to be rendered as a PDF? Does the screen need to be accessible from the Lightning Experience UI? Will the screen make use of a JavaScript framework? Will the screen be accessed via a mobile app? 8. Which are relevant practices while analyzing the timeline of different types of transactions in the execution overview panel? (Choose two.) Log lines in the execution log panel can be analyzed for details about specific events The performance tree should be use to analyze events further starting from the one that take the least amount of time The execution tree can be used with the execution log to filter and get specific information about events Multiple short bursts of Apex events should be analyzed since they can add up to a significant amount of time 9. What is a benefit of JavaScript remoting over Visualforce Remote Objects? Does not require any Apex code Allows for specified re-render targets Does not require any JavaScript code Supports complex server-side application logic 10. Given the code above, which two changes need to be made in the Apex Controller for the code to work' Choose 2 answers Annotate the entire class as @AuraEnabled instead of just the single method. Change the argument from JSONObject to String. Remove line 06 from the Apex Controller and use firstName In the return. Change the method signature to be global static, not public static. 11. A company recently deployed a Visualforce page with a custom controller that has a data grid of information about Opportunities in the org. Users report that they receive a ''Maximum view state size limit'' error message under certain conditions. According to Visualforce best practice, which three actions should the developer take to reduce the view state? Choose 3 answers Use the final keyword In the controller for variables that will not change. Use the private keyword in the controller for variables Refine any SOQL queries to return only data relevant to the page. Use filters and pagination to reduce the amount of data. Use the transient keyword in the Apex controller for variables that do not maintain state. 12. The test method above calls an @future method that increments the Number_of_Times_Viewed__c value. The assertion is failing because the Number_of_Times_Viewed__c equals 0. What is the optimal way to fix this? Change the initialization to acct.Number_Of_Times_Viewed__c = 1. Add Test.startTest() before and Test.stopTest() after insert acct Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c). Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed. 13. A developer is writing unit tests for the following method: Which assertion would be used in a negative test case? System.assertEquals (true, isFreezing('O') System.assertEquals(null, isFreezing('asdf)) System.assertEquals(true, isFreezingClOO')) System.assertEquals(true, isFreezing(null)) 14. Which of the following about Dynamic Apex is incorrect? You can retrieve the sObject type from an Id by calling .getSObjectTypeQ getDescribe() can get you a variety of info on a particular object/field Schema.getGlobalDescribeQ gives you a map of all sObject In dynamic SOQL, you can use bind variables and bind variable fields 15. What is the transaction limit for the number of records using QueryLocator? 100,000 5,000,000 50,000 50,000,000 There is no limit 16. A developer i$ tasked Dy Unversai Containers to build out a system to track the container repair process. Containers should be tracked as they move through the repair process, starting when a customer reports an issue and ending when the container is returned to the customer. Which solution meets these business requirements while following best practices? involve a Salesforce administrator and build out a declarative solution that works in Salesforce desktop and mobile. Build an automated Lightning Application using Application Events to ensure data integrity. Use Flow Builder to develop a Sites page for customers to submit repair requests and track the status of their request. Use Platform Events with Workflow Rules and RFID integration to ensure proper tracking of the containers. 17. A developer wants to use an Aura component with a custom action. What should be considered in order to do this? The component must implement the flexipage:availableForRecordHome interface A default value must be provided for each component attribute marked as required The component's JavaScript controller must handle a method on initialization The class "slds-modal_ _container" must be added to the top-level element of the component 18. Which of the following exceptions cannot be caught and will force an error? (Choose three.) LimitException AssertException SObjectExceptions DMLException License exceptions ListException 19. Part of a custom Lightning Component displays the total number of Opportunities in the org, which is in the millions. The Lightning Component uses an Apex Controller to get the data it needs. What is the optimal way for a developer to get the total number of Opportunities for the Lightning Component? COUNT() SOQL aggregate query on the Opportunity object SUM() SOQL aggregate query on the Opportunity object SOQL for loop that counts the number of Opportunities records Apex Batch job that counts the number of Opportunity records 20. An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed end Won. This trigger is working great, except (due to a recent acquisition) historical Opportunity records need to be loaded into the Salesforce instance. When a test batch of records are loaded, the Apex trigger creates Contract records. A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created. What is the most extendable way to update the Apex trigger to accomplish this? Use a Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data. Add the Profile ID of the user who loads the data to the trigger so the trigger will not fire for this user. Use a List Custom Setting to disable the trigger for the user who loads the data. Add a Validation Rule to the Contract to prevent Contract creation by the user who loads the data. 21. A developer has built a multi-page wizard using a single Custom Controller to query and update data. Users are complaining that the pages are loading slowly. What will improve performance? (Choose three.) Using actionRegion and rerender Setting the Apex Page attribute cache=true Reducing the view state Using selective queries 22. Which annotation exposes an Apex class as a RESTful neb service? @RestResource @AuraEnabled @RemoteAction @HttpInvocabte 23. A developer has generated Apex code from a WSDL for an external web service. The web service requires Basic authentication. What code should the developer use to authenticate? Http.setHeader ('Authorization' , 'Basic QthZGprjpchVulHNchFtZQ') stub.inputHttpHeaders_x.put('Authorization' , 'Basic QthZGprjpchVulHNchFtZQ') Http.setAuthentication('Basic QthZGprjpchVulHNchFtZQ') stub.authentication.put ('Authorization','Basic QthZGprjpchVulHNchFtZQ') 24. What are three benefits of using static resources in Visualforce and Lightning Components? Choose 3 answers Static resource files are automatically minified. 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 referenced by using the $Resource global variable instead of hardcoded IDs. Static resource files can be packaged into a collection of related files in a zip or jar archive. 25. 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 executeBatch must fail within test. startTest ( ) and - test. stopTest(). The account creation already sets the sates amount to 0. The batch needs more than one account record created. The batch process will not recognize new accounts created in the same session 26. If the "PageReference.setRedirect" Apex function is set to True, what type of request is made? If PageReference points to the same controller and subset of extensions, postback request, otherwise get request Get request Postback request 27. What are three benefits of using declarative customizations over code? Choose 3 answers Declarative customizations are not subject to governor limits. Declarative customizations cannot generate run time errors. Declarative customizations generally require less maintenance. Declarative customizations do not require user testing. Dectarative customizations will automatically update with each Salesforce release. 28. During the order of execution of a Visualforce page GET request, what happens after this step: Evaluate constructors on controllers and extensions? Evaluate constructors and expressions on custom components. Create view state if exists. Send the HTML response to the browser. Evaluate expressions, action attributes, and method calls. 29. What is a best practice when unit testing a controller? (Choose two.) Set query parameters by using getParameters().put Simulate user interaction by leveraging Test.setMock() Access test data by using seeAllData=true Verify correct references by using getURL() 30. A developer has a page with two extensions overriding the Standard controller for Case. What will happen when a user clicks the command button? All of the three Save methods will be executed Save from CaseExtensionOne will be executed Save from CaseExtensionTwo will be executed Save from Case Standard Controller will be executed 31. UC has created a picklist field called Country on three separate custom objects. UC has a requirement to maintain a consistent list of values for this field on each object. Which feature should the app builder use? Global Picklist Value Set Next Best Action State and Country Picklist Field Update 32. What is a valid request for the following REST method: @HttpPost global static void myPostMethod(String sl,Integer il, Boolean bl, String b2) Choose 2 answers "il" : 123, "S1" : "my first string", "S2" : "my second string", "bl" : false "my first string" 123 "my second string" false my first string 123 my second string false Sl" : "my first string", 11" : "123", "b1" : "false", "S2" : "my second string" 33. A customer has a single Visualforce page that allows each user to input up to 1500 sales forecasts and instantly view pivoted forecast calculations. Users are complaining that the page is loading slowly, and they are seeing error messages regarding heap and view state limits. What are three recommendations to optimize page performance? (Choose three.) Specify the list of sales forecasts as transient Segregate calculation functionality from input functionality Create formula fields to compute pivoted forecast calculations Use JavaScript Remoting instead of controller actions Implement pagination and reduce records per page 34. trigger AssignOwnerByRegion on Account ( before insert, before update ) { List accountList = new List(); for( Account anAccount : trigger.new ) { Region__c theRegion = [ SELECT Id, Name, Region Manager__c FROM Region__c WHERE Name = :anAccount.Region_Name__c ]; anAccount.OwnerId = theRegion.Region_Manager__c; accountList.add( anAccount ); } update accountList; } 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 two.) Use a Map to cache the results of the Region__c query by Id. Use a Map accountMap instead of List accountList. Remove the last line updating accountList as it is not needed. Move the Region__c query to outside the loop. 35. Which statement is true about scheduled Apex? Choose 3 answers Scheduled Apex only supports asynchronous callouts through the use of @future methods and Apex Batches. Scheduled Apex is executed only when system resources are available. Scheduled Apex classes can only be defined by extending the Schedule base class. There is no limit on Scheduled Apex jobs because they are executed asynchronously The schedule of an Active scheduled Apex class cannot be updated through the Salesforce User Interface. 36. 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? Build a Process on Opportunity Build a Flow on Opportunity. Create a Workflow on Opportunity. Use an Apex Trigger on Opportunity. 37. A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue? Move the prerequisite reference data setup to a TestDataFactory and call that from each test method. Move the prerequisite reference data setup to a static method in the test class and call that from each test method. Move the prerequisite reference data setup to the constructor for the test class. Move the prerequisite reference data setup to a @testSetup method in the test class. 38. What is the value of "i" printed by the System.debug statement, if the value of "j" is 2 at the end of the transaction? insert new Account[]{new Account(Name = 'yyy'), new Account(Name = 'yyy')}; integer i = 0; integer j; for (Account[] tmp : [SELECT Id FROM Account WHERE Name = 'yyy']) j=tmp.size(); i++; System.debug(i); 0 1 2 3 39. What is the transaction limit for the number of records using QueryLocator? 50,000 50,000,000 100,000 5,000,000 There is no limit 40. 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? Will the screen be accessed via a mobile app? Does the screen need to be rendered as a PDF? Will the screen make use of a JavaScript framework? Does the screen need to be accessible from the Lightning Experience UI? 41. What is a controller value that will NOT be saved in the viewstate of a Visualforce page? Choose 3 answers A variable of a type that is a custom Apex class. A variable of a type that is a collection of SObjects. A variable declared with the Static keyword. A system-generated object such as a Schema Describe object. A variable declared with the Transient keyword. 42. Which API can be used to execute unit tests? (Choose three.) Tooling API Test API Streaming API Metadata API SOAP API 43. Code must have X% overall code coverage. X = 100 X = 75 X = 65 X = 50 44. A developer must create a custom pagination solution. While users navigate through pages, if the data is changed from elsewhere, users should still see the cached results first accessed. How can the developer meet these requirements? Use @Cache annotation. Use a StandardSetController. Use OFFSET WITH CACHE in SOQL queries Use OFFSET in SOQL queries. 45. A company requires that a child custom record is created when an Order record is inserted. The company's administrator must be able to make changes to the solution. What is the recommended solution for implementing this requirement? Create an Apex Trigger to create the custom child record when the Order is inserted. Create a Force.com Workflow Rule to create the custom child record when the Order is inserted. Create a Lightning Process to create the custom child record when the Order is inserted. Create a Visual Workflow that will create the custom child record when the Order is inserted. 46. A developer is asked to build a solution that will automatically send an email to the Customer when an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The criteria to send the email should be evaluated after all Workflow Rules have fired. What is the optimal way to accomplish this? Use a Workflow Email Alert. Use a SingleEmailMessage() with an Apex Trigger. Use an Email Alert with Process Builder. Use a MassEmailMessage() with an Apex Trigger. 47. A large company uses Salesforce across several departments. Each department has its own Salesforce Administrator. It was agreed that each Administrator would have their own sandbox in which to test changes. Recently, users notice that fields that were recently added for one department suddenly disappear without warning. Also, Workflows that once sent emails and created tasks no longer do so. Which two statements are true regarding these issues and resolution? (Choose two.) Page Layouts should never be deployed via Change Sets, as this causes Workflows and Field- level Security to be reset and fields to disappear. The administrators are deploying their own Change Sets over each other, thus replacing entire Page Layouts and Workflows in Production. A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to production. The administrators are deploying their own Change Sets, thus deleting each other's fields from the objects in production. 48. A developer has created a Team Member sObject that has a Master-Detail relationship to a Project sObject and a Lookup relationship to the User sObject. The developer must ensure that a User listed on a Team Member record has Read-Write access to the parent Project record. How can the developer accomplish this if the Project sObject has a Private sharing model and thousands of Project records? Create a Controller that uses the Without Sharing keyword Create a Project Sharing Rule that shares to the Team Member Group Create a Team Member Trigger that inserts Project_Share records Create a Criteria-Based Sharing Rule on the Project sObject 49. A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue? Move the prerequisite reference data setup to a static method in the test class and call that from each test method. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method. Move the prerequisite reference data setup to a @testSetup method in the test class. Move the prerequisite reference data setup to the constructor for the test class. 50. A developer has been asked to prevent Accounts from being deleted if there is a related Contact that has the Do_Not_Delete_c checkbox checked. How can the developer accomplish this? Create a Validation Rule on the Account object. Create a Before Delete Trigger on the Contact object Create a Before Delete Trigger on the Account object. Create a Validation Rule on the Contact object. 51. A developer wants to use an Aura component with a custom action. What should be considered in order to do this? A default value must be provided for each component attribute marked as required The class "slds-modal_ _container" must be added to the top-level element of the component The component must implement the flexipage:availableForRecordHome interface The component's JavaScript controller must handle a method on initialization 52. look at pic Example 2 Example 1 Example 3 Example 4 53. 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.) Use the asyncSend() method of the HTTP class to send the request in async context Use Database.insert (order, true) to immediately commit any database changes Ensure all callouts are completed prior to executing DML statements Move the web service callout into an @future method 54. Choose the correct definition for Adds AJAX support to another component (e.g. onClick, onMouseUp, onFocus, etc.) 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 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 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 55. A company has a custom object, Order__c, that has a required, unique, external ID field called Order_Number__c. Which statement should be used to perform the DML necessary to insert new records and update existing records in a List of Order__c records? upsert orders; merge orders; upsert orders Order_Number__c; merge orders Order_Number__c; 56. The "Webservice" keyword___________. Method must be static, and class must be global All of the above Used for any member variables included Can be used on all classes 57. 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 onerror event handler to the tag. Use an AuraHandledException in a try/catch block. Use ProcessBuilder to catch the error. Add an error-view component to the markup. 58. The maximum view state size of a visualforce page is______________. 135kb 165kb 256kb 65kb 1mb 59. What is the transaction limit on the number of callouts? 50 There is no limit 100 150 200 60. 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 Visualforce Page Components leveraging Application Events Two Lightning Components leveraging Platform Events A single visualforce Page leveraging Platform Events 61. A Lightning web component exists in the system and displays information about the record in context as a modal. Salesforce administrators need to use this component within the Lightning App Builder. Which two settings should the developer configure within the xml resource file? Choose 2 answers Set the IsExposed attribute to True. Specify the target to be lightning__AppPage. Specify the target to be lightning__RecordPage. Set the IsVisible attribute to True. Time is Up! Time's up