Platform Developer II Mock 7 26/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 7 1. ABC Company has an Apex process that makes multiple extensive database operation and web service callouts. The database processes and web services can take a length time to run and must be run sequentially. How should the developer write this Apex code without running into governor limits and system limitations? Use multiple @future methods for each process and callout. Use Apex Scheduler to scheduled each process. Use Limits class to stop entire process once governor limits are reached. Use Queueable Apex to chain the jobs to run sequentially. Ninguna 2. 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 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 Use the asyncSend() method of the HTTP class to send the request in async context 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. What must be added to get the data? Add @wire(getData, {name: $name'}) to the account field and delete loadData ( ) because it is not needed. Add @wire(getData, (name: $name')} to the account field and this, account = getData ( ) ; to t loadData ( ) function. Add getData ({ name; this,name}) , then (result=> { this.account = result}) to the LeadData ( ) function. Add this, account = getData (this,name); to the loadData ( ) function. Ninguna 4. Recently a Salesforce org's integration failed because it exceeded the number of allowed API calls in a 24-hour period. The integration handles a near real-time, complex insertion of data into Salesforce. The flow of data is as follows: * The integration looks up Contact records with a given email address and, if found, the integration adds a Task to the first matching Contact it finds. If a match is not found, the integration looks up Lead records with a given email address and, if found, the integration adds a Task to the first matching Lead it finds. * If a match is not found, the integration will create a Lead and a Task for that newly created Lead. What is one way in which the integration can stay near real-time, but not exceed the number of allowed API calls in a 24- hour period? Create several Apex InboundEmailHandlers to accept calls from the third-party system, thus bypassing the API limits. Use the REST API as well as the SOAP API to effectively double the API calls allowed in a 24- hour period. write a custom Apex web service that, given an email address, does all of the logic the integration code was doing. Create an Inbound Message that, using Flow, can do all of the logic the integration code was doing. Ninguna 5. How long is field history retained? 36 Months 24 Months 18 Months 12 Months 6 Months Ninguna 6. What is a potential design issue with the following code? 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: Apex CPU time limit exceeded error 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 Ninguna 7. Which interface needs to be implemented by a Lightning Component so that it may be displayed in modal dialog by clicking a button on a Lightning Record page? Lightning:editAction Lightning:quickAction Force: lightningQuickAction Force:lightningEditAction Ninguna 8. 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 2 answers Page Layouts should never be deployed via Change Sets, as this causes Workflows and Field- level Security to be reset and fields to disappear. 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 over each other, thus replacing entire Page Layouts and Workflows in Production The administrators are deploying their own Change Sets, thus deleting each other's fields from the objects in production. 9. 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? Define a method that creates test data and annotate with @testSetup. Define a method that creates test data and annotate with @createData Reduce the amount of test methods in the class. Ensure proper usage of test data factory In all test methods. Ninguna 10. pic No test methods will be executed during deployment. Using a formula field reduces maintenance overhead. A formula field will calculate the value retroactively for existing records. A test class that validates the formula field is needed for deployment. 11. Which annotation exposes an Apex class as a RESTful web service? @AuraEnabled @RemoteAction @RestResource @HttpInvocable Ninguna 12. 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? use the Database.Insert method with allOrNone set to False. use setSavePoint() and rollback() with a try/catch block. Disable validation rules on Contacts and set default values with a Trigger. use the Database.Delete method if the Contact insertion fails. Ninguna 13. 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 Controller Standard List/Set Controller Controller Extensions Custom Controller Ninguna 14. A developer Is tasked with ensuring that email addresses entered into the system for Contacts and for a Custom Object called Survey_Response__c do not belong to a list of blacklisted domains. The list of blacklisted domains will be stored In a custom object for ease of maintenance by users. Note that the Survey_Response__c object is populated via a custom visualforce page. What is the optimal way to implement this? Implement the logic in an Apex trigger on Contact and also implement the logic within the Custom visualforce page controller. Implement the logic in a helper class that is called by an Apex trigger on Contact and from the Custom Visualforce page controller. Implement the logic in the Custom Visualforce page controller and call that method from an Apex trigger on Contact. Implement the logic in a Validation Rule on the Contact and a validation Rule on the Survey_Response__c object. Ninguna 15. 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 re-queried the Account record after updating the Opportunity. The test class is not using System.runAs() to run tests as a Salesforce administrator. 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. Ninguna 16. A developer must create a custom pagination solution for accessing approximately 2000 records and displaying 50 records on each page. Data from Salesforce will be accessed via an API and not via Apex. How can the developer meet these requirements? (Choose two.) Use OFFSET in SOQL queries Use a StandardSetController Use CURSOR 50 in SOQL queries Use LIMIT 50 in SOQL queries 17. Global with sharing class MyRemoter { public String accountName { get; set; } public static Account account { get; set; } public AccountRemoter(} {} @RemoteAction global static Account getAccount (String acccuntName) { account = [SELECT Id, Name, NumberOfEmployees FROM Account WHERE Name = :accountName]; return account; } } Consider the Apex class above that defines a RemoteAction used on a Visualforce search page. Which code snippet will assert that the remote action returned the correct Account? Account a = MyRemoter.getAccount ('TestAccount'): System.assertEquals{ 'TestAccount', a.Name }; MyRemoter remote = new MyRemoter(); Account a = remote.getAccount ({'TestAccount'); System.assertEquals, 'TestAcccunt', a.Name -; MyRemoter remote = new MyRemoter('TestAccount'}; Account a = remote.getAccount {);System.assertEquals(, ''TestAccount', a.Name -; Account a = controller.getAccount('TestAccount'); System.assertEquals(, 'TestAccount', a.Name } Ninguna 18. Which of the following variables are not transmitted in the view state? (Choose two.) Transient Private Static Public 19. Ninguna 20. 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? Ninguna 21. Invokable methods accept sObjects as parameters. False True Ninguna 22. A developer 15 tasked with creating an application-centric feature on which end-users can access and update information. This feature must be available in lightning Experience while working seamlessly in multiple device form factors, such as desktops, phones, and tablets. Additionally, the feature must support Addressable URL Tabs and interact with the Salesforce Console APIs. What arm two approaches a developer can take to build the application and support the business requirements? Choose 2 answers Create application using Aura Components. Create the application using Lightning web Components wrapped in Aura Components. Create the application using Lightning Experience Builder. Create the application using Aura Components wrapped in Lightning Web Components. 23. Which of the following exceptions cannot be caught and will force an error? (Choose three.) LimitException AssertException SObjectExceptions DMLException License exceptions ListException 24. The maximum view state size of a visualforce page is______________. 65kb 256kb 135kb 165kb 1mb Ninguna 25. What Salesforce tool lets you deploy/retrieve metadata, check status of apex jobs, and check responses of REST calls? Streaming API Force.com Migration Tool Workbench Developer Console Ninguna 26. In an organization that has multi-currency enabled, a developer is tasked with building a Lighting Component that displays the top ten Opportunities most recently access by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user's locale. What is the most effective approach to ensure values displayed respect the users locale settings? Use the FORMAT() function in the SOQL query. Use a wrapper class to format the values retrieved via SOQL. Use the FOR VIEW clause in the SOQL Query. Use REGEX expressions to format the values retrieved via SOQL. Ninguna 27. Ninguna 28. A developer has a Visual force page that automatically assign ownership of an Account to a queue save. The page appears to correctly assign ownership, but an assertion validating the correct ownership fails. What can cause this problem? The test class does not use the seeAllData=true annotation, The test class does not use the Bulk API for loading test data. The test class does not implement the Queueabfe interface. The test class does not retrieve the updated value from the database. Ninguna 29. A developer has a Visual force page that automatically assign ownership of an Account to a queue save. The page appears to correctly assign ownership, but an assertion validating the correct ownership fails. What can cause this problem? The test class does not use the seeAllData=true annotation, The test class does not use the Bulk API for loading test data. The test class does not implement the Queueabfe interface. The test class does not retrieve the updated value from the database. Ninguna 30. 1 Contact con = new Contact ( LastName =fSmith', Department = fAdminT) 2 insert con; 3 Contact insertedContact=[select Name from Contact where id=icon.Id]; 4 Savepoint sp_admin = Database.setSavepoint(); 5 con.Department = fHRf; 6 update con; 7 Database.rollback(sp_admin); 8 System.debug(Limits.getDmlStatements 0); Given the following code, what value will be output in the logs by line #8? 4 3 2 5 Ninguna 31. What are three benefits of using static resources in Visualforce and Lightning Components? Choose 3 answers 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. 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 are automatically minified. 32. No formatting; displays all errors on a page A single message, without formatting, that can be associated with a specific component on the page Standard Salesforce formatting, shows all errors that occur on page. Can add more messages through the "ApexPages.addMessage" function Standard Salesforce formatting, throws a specific message on a page Ninguna 33. A developer gets an error saying 'Maximum Trigger Depth Exceeded.' What is a possible reason to get this error message? Trigger is recursively invoked more than 16 times. There are numerous DML operations in the trigger logic. The SOQL governor limits are being hit. A Process Builder is running that sends mass emails. Ninguna 34. A developer receives the exception 'SOQL query not selective enough' when performing a query on an object with a large amount of dat a. Which step should be taken to resolve the issue? Move the SOQL query to within an asynchronous process. Use an ID in the WHERE clause of the SOQL query. Perform the SOQL query via a call to the REST API. Perform the SOQL query as part of a FOR loop. Ninguna 35. A company manages information about their product offerings in custom objects named Catalog and Catalog Item. Catalog Item has a master-detail field to Catalog, and each Catalog may have as many as 100,000 Catalog Items. Both custom objects have a CurrencylsoCode Text field that contains the currency code they should use. If a Catalog's CurrencylsoCode changes, all of its Catalog Items' CurrencylsoCodes should be changed as well. What should a developer use to update the CurrencylsoCodes on the Catalog Items when the Catalog's CurrencylsoCode changes^5 A Database.Schedulable and Database.Batchable class that queries the Catalog Item object and updates the Catalog Items if the Catalog CurrencylsoCode is different A Database.Schedulable and Database.Batchable class that queries the Catalog object and updates the Catalog Items if the Catalog CurrencylsoCode is different An after insert trigger on Catalog Item that updates the Catalog Items if the Catalog's CurrencylsoCode is different An after insert trigger on Catalog that updates the Catalog Items if the Catalog's CurrencylsoCode is different Ninguna 36. Choose the correct definition for . No formatting; displays all errors on a page A single message, without formatting, that can be associated with a specific component on the page Standard Salesforce formatting, shows all errors that occur on page. Can add more messages through the "ApexPages.addMessage" function Standard Salesforce formatting, throws a specific message on a page Ninguna 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 the transient keyword for the List variables used in the custom controller. 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 lazy loading to load the data on demand, instead of in the controller's constructor. Ninguna 38. Which type of controller is best suited when you want to add custom functionality to a standard controller page, or when you want reusable functionality throughout pages? Controller Extensions Custom Controller Standard List/Set Controller Standard Controller Ninguna 39. What is the transaction limit for SOQL queries? 200 (synchronous), 100 (async) 20 (synchronous), 200 (async) 150 (synchronous), 200 (async) 100 (synchronous), 200 (async) 150 (synchronous), 20 (async) Ninguna 40. How long is field history retained? 36 Months 6 Months 24 Months 12 Months 18 Months Ninguna 41. A Lightning Component functions in preview mode and needs to be used inside a Lightning App Builder page, but it is not available. What change should be applied to the component? Look for errors in the logic in the JavaScript controller. Delete the component, metadata, and Apex controller and recreate them. Refresh the sandbox and upgrade it to the latest API version. Expose it in the markup using the implements and access attributes. Ninguna 42. A developer wants to call an Apex Server-side Controller from a Lightning Aura Component. What are two limitations to the data being returned by the Controller? Choose 2 answers A custom Apex Class can be returned, but only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned. Basic data types are supported, but defaults, such as maximum size for a number, are defined by the objects that they map to. Only Basic data types and sObjects are supported as return types for Apex Controllers called by Lightning Aura Components. A Lists of Custom Apex Classes cannot be returned by Apex Controllers called by Lightning Aura Components. 43. The test method above tests an Apex trigger that the developer knows will make a lot of queries when a lot of Account are simultaneously updated to be customer. The test method fails at the Line 20 because of too many SOQL queries What is the correct way to fix this? Add TesLstartTest() before and Test.stop Test() after both Line 7 of the code and Line 20 of the code. Add TeststartTest() before Line 18 of the code and add Test.stopTest() after line 18 of the code. Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced. Replace most of the Apex Trigger with Process Builder processes to reduce the number of queries in the trigger. Ninguna 44. 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 @testSetup method in the test class. Move the prerequisite reference data setup to the constructor for the test class. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method. Ninguna 45. What is the best practice to initialize a Visualforce page in a test class? Use Test.currentpage, getParameter, put (MyTestPage); Use Test, setCurrentPage(Page.MyTestPage); Use controller,currentPage, setPage (MyTestPage) Use Test.setCurrentpage,MyTestPage; Ninguna 46. This sales team needs a custom Visualforce page to enter sales orders. When a product is selected on the Visualforce page, a web service is invoked to determine if the product is in stock, and the result is displayed on the page. How can a developer write this page to display the result of the web service and ensure governor limits for concurrent usage are not exceeded? Use an Apex trigger with callout=true annotation. Use visualforce Remoting to handle the web service callout. Use Continuation that is invoked when a Submit button is clicked. Use the Salesforce Metadata API in the web service callout. Ninguna 47. pic Publish an event on an event channel. Fire an application event. Publish a message on a message channel. Fire a custom component event. Ninguna 48. A developer wrote an Apex method to update a list of Contacts and wants to make it available for use by Lightning web components. Which annotation should the developer add to the Apex method to achieve this? @RemoteAction(cacheable=true) @RemoteAction @AuraEnable @AuraEnabled Ninguna 49. In a VisualForce page with a VisualForce component that has rendered set to false when the page loads, how can a developer ensure it will show on a re-render? Perform a full page refresh since rendered elements cannot be re-rendered without refreshing. Set the re-render attribute of the component to true. Set the rendered attribute of the component to true and re-render the component. Set the rendered attribute of the component to true and re-render a parent component. Ninguna 50. A custom field Exec_Count_c of type Number is created on an Account object. An account record with value of "1" for a: Exec__Count_c is saved. A workflow field update is defined on the Exec_Count_c field, to increment its value every time an account record is created or updated. The following trigger is defined on the account: trigger ExecOrderTrigger on Account (before insert, before update, after insert, after update){ for (Account accountlnstance: Trigger.New){ if (Trigger . isBefore){ accountlnstance Exec_Count_c += 1; } System, debug (accountlnstance.Exec_Count_c); } } 1,2,3,4 1,2,3,3 2,2,3,3 2, 2, 4, 4 Ninguna 51. A company processes Orders within their Salesforce instance. When an Order's status changes to 'Paid' it must notify the company's order management system (OMS). The OMS exposes SOAP web service endpoints to listen for when to retrieve the data from Salesforce. What is the optimal method to implement this? Generate the Partner WSDL and use it to make a callout to the OMS. Generate the Enterprise WSDL and use it to make a callout to the OMS. Create an Apex trigger and make a callout to the OMS from the trigger. Create an Outbound Message that contains the session ID and send it to the OMS. Ninguna 52. What is a consideration when using bind variables with dynamic SOQL? (Choose two.) Dynamic SOQL cannot reference fields on bind variables Bind variables must be public or global Bind variables must be in local scope Dynamic SOQL cannot use bind variables 53. The Metadata API___________. Is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAII, insert, update, upsert, or delete many records asynchronously by submitting batches Provides a powerful, convenient, and simple REST-based web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it's an excellent choice of technology for use with mobile applications and web projects Is used to create, retrieve, update or delete records, such as accounts, leads, and custom objects, and allows you to maintain passwords, perform searches, and much more Is used to retrieve, deploy, create, update, or delete customizations for your org. The most common use is to migrate changes from a sandbox or testing org to your production environment Ninguna 54. A developer has created a solution using the SOAP API for authenticating Communities users. What is needed when issuing the login() Call? (Choose two.) Session Id Security Token Username and Password Organization Id 55. Universal Containers has an existing automation where a custom record called Account Plan is created upon an Account being marked as a Customer. Recently, a Workflow Rule was added so that whenever an Account is marked as a Customer, a 'Customer Since' date field is updated with today's date. Now, since the addition of the Workflow Rule, two Account Plan records are created whenever the Account is marked as a Customer. What might cause this to happen? The Process Builder responsible for the record creation fires before and after the Workflow rule. The Workflow Rule responsible for the record creation fires twice because the 'Customer Since' field Update Is marked as 'Re-evaluate Workflow Rules After Field Change The Apex Trigger responsible for the record creation does not use a static variable to ensure It only fires once. The Apex Trigger responsible for the record creation is not bulk sate and calls insert inside of a for loop. Ninguna 56. After a Platform Event is defined in a Salesforce org, events can be published via which two mechanisms? Choose 2 answers Internal Apps can use Process Builder. internal Apps can use Outbound Messages External Apps use an API to publish event messages External Apps can use the standard Streaming API. 57. A developer needs to send Account records to an external system for backup purposes. The process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web service. The web service can only receive, at most, one record per call. Which feature should be used to implement these requirements? @future Queueable Process Builder workflow Ninguna 58. A developer has created a Visualforce page that uses a third-party JavaScript framework. The developer has decided to supply data to the JavaScript functions using JavaScript Remoting for Apex Controllers. What is the correct syntax to declare a remote method in Apex? (Choose two.) @RemoteAction global static String getTable() @RemoteAction global String getTable() @RemoteAction public static String getTable() @RemoteObject global static String getTableQ 59. In which of the following scenarios would it be acceptable to use programmatic sharing instead of declarative sharing? (Choose three.) 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 Every record created by sales users needs to be visible to their respective manager 60. A developer has a page with two extensions overriding the Standard controller for Case. What will happen when a user clicks the command button? Save from CaseExtensionOne will be executed Save from CaseExtensionTwo will be executed All of the three Save methods will be executed Save from Case Standard Controller will be executed Ninguna 61. How can a developer efficiently incorporate multiple JavaScript libraries, such as JQuery and MomenUS, in a Lightning Component? Join multiple assets from a static resource. Use CONs with script attributes Implement the libraries in separate helper files. Use JavaScript remoting and script tags. Ninguna 62. A developer needs test data for Apex test classes. What can the developer use to provide test data to the test methods? (Choose two.) myDataFactory.createTestRecords (10) List Is = Test.loadDat (Lead.sObjectType, $Resource + 'myTestLeads f); List Is = Test.loadData (Lead.sObjectType, fmyTestLeads f); Database.createTestRecords (10) 63. A developer Is asked to develop a new AppExthange application. A feature of the program creates Survey records when a Case reaches a certain stage and Is of a certain Record Type. This feature needs to be configurable, as different Salesforce instances require Surveys at different times. Additionally, the out-of-the-box AppExchange app needs to come with a set of best practice settings that apply to most customers. What should the developer use to store and package the custom configuration settings for the app? Process Builder Custom Metadata Custom Objects Custom Settings Ninguna 64. Consider the following code snippet, depicting an Azure component: Which two interfaces can the developer implement to make the component available as a quick action? Choose 2 answers. Force:lightningQuickActionWithoutHeader Force:lightningQuickAction Force:hasObjectName Force:hasRecordId Lightning QuickActionAPI 65. Ninguna 66. Universal Containers needs to integrate with a Heroku service that resizes product images submitted by users. What are two alternatives to implement the integration and protect against malicious calls to Heroku app's endpoint? Choose 2 answers Create a Workflow Rule with an Outbound Message and select Send Session ID so that the Heroku app can use it to send the resized images back to Salesforce. Create a Workflow Rule with an Outbound Message allowing the Heroku app to automatically store the resized images in Salesforce. Create a trigger that uses an @future Apex HTTP callout passing JSON serialized data; therefore the Heroku app can automatically reply back to the callout with the resized images in Salesforce. Create a trigger that uses an @future Apex HTTP callout passing JSON serialized data and some form of pre-shared secret key. so that the Heroku app can authenticate requests and store the resized images in Salesforce. Time's upTime is Up!