Platform Developer II Mock 9 27/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 9 1. 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? 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 A Database.Schedulable and Database.Batchable class that queries the Catalog Item object and updates the Catalog Items if the Catalog CurrencylsoCode is different An after insert trigger on Catalog that updates the Catalog Items if the Catalog's CurrencylsoCode is different Ninguna 2. 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 Visualforce Page Components leveraging Application Events Two Lightning Components leveraging Application Events Two Lightning Components leveraging Platform Events A single visualforce Page leveraging Platform Events Ninguna 3. 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. Perform the SOQL query as part of a FOR loop. Perform the SOQL query via a call to the REST API. Use an ID in the WHERE clause of the SOQL query. Ninguna 4. 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.) Move the web service callout into an @future method Use Database.insert (order, true) to immediately commit any database changes Use the asyncSend() method of the HTTP class to send the request in async context Ensure all callouts are completed prior to executing DML statements 5. Which of the following exceptions cannot be caught and will force an error? (Choose three.) LimitException AssertException SObjectExceptions DMLException License exceptions ListException 6. 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); } } 2,2,3,3 2, 2, 4, 4 1,2,3,3 1,2,3,4 Ninguna 7. If you have a method "doStuff(List records)", which is a valid call? doStuff(List records); doStuff(Account acct); doStuff([Select Id From Account]); doStuff(sObject obj); Ninguna 8. Which scenario requires a developer to use an Apex callout instead of Outbound Messaging? The callout needs to be asynchronous. The Target system uses a REST API. The Target system uses a SOAP API. The callout needs to be invoked from a Workflow Rule. Ninguna 9. 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. Exhibit. What must be added to get the data? Add this.account = getData (this.name); to the loadData ( ) function. Add getData ({ name; this.name}) , then (result=> { this.account = result}) to the LeadData ( ) function. 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. Ninguna 10. What is a benefit of JavaScript remoting over Visualforce Remote Objects? Allows for specified re-render targets Does not require any JavaScript code Does not require any Apex code Supports complex server-side application logic Ninguna 11. 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 a Validation Rule on the Contact and a validation Rule on the Survey_Response__c object. 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 an Apex trigger on Contact and also implement the logic within the Custom visualforce page controller. Implement the logic in the Custom Visualforce page controller and call that method from an Apex trigger on Contact. Ninguna 12. A lead developer is creating tests for a Lightning web component. The component re-renders when a property called bypassSelection. changes its value. What should the developer use to the test that the component re-renders successfully when the property changes? Windows, set State ( ) Promise. resolve ( ) dispatchEvent (new CustomEvent (' bypassSelection')) Windows, Setinterval ( ) Ninguna 13. What is a consideration when testing batch Apex? (Choose two.) Test methods must run the batch between TeststartTestQ and Test.stopTestQ Test methods must call the batch execute() method once Test methods must use the @isTest (SeeAIIData=true) annotation Test methods must execute the batch with a scope size of less than 200 records 14. A developer is using a third-party JavaScript library to create a custom user interface in Visualforce. The developer needs to use JavaScript to get data from a controller method in response to a user action. How can the developer accomplish this? Use to create a JavaScript wrapper for the controller method Use the $Controller global variable to access the controller method via JavaScript Use the @RemoteAction annotation on the method definition with JavaScript Remoting Use to enable JavaScript support for the controller method Ninguna 15. There are user complaints about slow render times of a custom data table within a visualforce page that loads thousands of Account records at once. What can a developer do to help alleviate such issues? Use the transient keyword in the Apex code when querying the Account records. Upload a third-party data table library as a static resource. Use the standard Account List controller and implement pagination. Use JavaScript remoting to query the accounts. Ninguna 16. 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? 3 2 4 5 Ninguna 17. A developer must create a way for external partners to submit millions of leads into Salesforce per day-How should the developer meet this requirement? Publicly expose a Visualforce page via Force.com Sites Publicly expose an Apex Web Service via Force.com Sites Create a web service on Heroku that uses Heroku Connect Host a Web-to-Lead form on the company website Ninguna 18. 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 19. What is the transaction limit for the number of SOSL queries? There is no limit 100 (synchronous), 200 (async) 20 200 (synchronous), 100 (async) 2,000 Ninguna 20. Which type of controller is best suited when you want all of the basic DML functions from an object's normal new/edit page and want to include multiple records? Custom Controller Standard Controller Controller Extensions Standard List/Set Controller Ninguna 21. Just prior to a new deployment, the Salesforce Administrator who configured a new order fulfillment process in a developer sandbox suddenly left the company. The users had fully tested all of the changes in the sandbox and signed off on them. Unfortunately, although a Change Set was started, it was not complete. A developer is brought in to help finish the deployment. What should the developer do to identify the configuration changes that need to be moved into production? In Salesforce setup, look at the last modified date for every object to determine which should be added to the Change Set. Use the Metadata API and a supported development IDE to push all of the configuration from the sandbox into production to ensure no changes are lost. Leverage the Setup Audit Trail to review the changes made by the departed Administrator and identify which changes should be added to the Change Set. Set up Continuous Integration and a Git repository to automatically merge all changes from the sandbox metadata with the production metadata. Ninguna 22. 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? Flow Builder Process Builder Apex Trigger Approvals Ninguna 23. What is a benefit of using a WSDL with Apex? Allows for web services to be tested and achieve code coverage Allows for classes to be imported into Salesforce Enables the user to not pass a Session ID where it is not necessary Reduces the number of callouts to third-party web services Ninguna 24. Universal Containers wants to use a Customer Community with Customer Community Plus licenses so their customers can track how many of containers they are renting and when they are due back. Many of their customers are global companies with complex Account hierarchies, representing various departments within the same organization. One of the requirements is that certain community users within the same Account hierarchy be able to see several departments' containers, based on a junction object that relates the Contact to the various Account records that represent the departments. Which solution solves these requirements? A Visualforce page that uses a Custom Controller that specifies without sharing to expose the records A Custom Report Type and a report Lightning Component on the Community Home Page An Apex Trigger that creates Apex Managed Sharing records based on the junction object's relationships A Custom List View on the junction object with filters that will show the proper records based on owner Ninguna 25. A customer requires that when the billing address field on an Account gets updated, the address field on all its related contact records should reflect the same update. How can this requirement be met with minimal customizations? Create a Lightning Process on Account to update related child Contact records Create an After Trigger on Account to upd|ate its related contact records on update Create a scheduled batch job that updates all contact address fields based on the related account record. Create a Workflow Rule on Account to update related child Contact records Ninguna 26. A developer wants to write a generic Apex method that will compare the Salesforce Name filed between any two object records, for example to compare the Name field of an Account and an Opportunity; or the name of an Account and a Contact. How should the developer do this? Use the salesforce metadata API to extract the value of each object and compare the name fields Cast each object into an sObject and use sObject.get(Name') to compare the Name fields. Use a String.replace( ) method to parse the contents of each Name field. Invoke a Schema,describe() function to compare the values of each Name field. Ninguna 27. Which two queries are selective SOQL queries and can be used for a large data set of 200,000 Account records? Choose 2 answers SELECT id FROM ACCOUNT WHERE id IN (list of Account Ids) SELECT id FROM ACCOUNT WHERE Name = Null SELECT id FROM ACCOUNT WHERE Name = Null AND Customer_Number_c= 'ValueA' SELECT id FROM ACCOUNT WHERE Name = !: ' ' 28. An Apex Trigger creates a Contract record every time an Opportunity record is marked as Closed and 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 disable the Trigger for the user who does the data loading. add the Profile Id of the user who does the data loading to the Trigger so the Trigger won't fire for this user. Add a Validation Rule to the Contract to prevent Contract creation by the user who does the data loading. Use a List Custom Setting to disable the Trigger for the user who does the data loading. Ninguna 29. A developer wants to retrieve and deploy metadata, perform simple CSV export of query results, and debug Apex REST calls by viewing JSON responses. Which tool should the developer use? Workbench Workbench Force.com Migration Tool Developer Console Ninguna 30. Code must have X% overall code coverage. X= 100 X = 75 X = 50 X = 65 Ninguna 31. Employee_c is a Child object of Company_c. The Company_c object has an external Id field Company_ld_c. How can a developer insert an Employee_c record linked to Company_c with a Company_ld_c of '999'? Employee_c emp = new Employee_c(Name=fDeveloperf); emp.Company_r = new Company _ r(Company Id c=f999f) insert emp; Employee_c emp = new Employee_c(Name=fDeveloperf); emp.Company_r = f999f insert emp; Employee_c emp = new Employee_c(Name=fDeveloperf); emp.Company_c = f999f insert emp; Employee_c emp = new Employee_c(Name=fDeveloperT); emp. Company_c = new Company_c(Company_Id_c=f 999 T) insert emp; Ninguna 32. 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? Custom Objects Custom Metadata Custom Settings Process Builder Ninguna 33. A developer wrote a test class that successfully asserts a trigger on Account. It fires and updates data correctly in a sandbox environment. A salesforce admin with a custom profile attempts to deploy this trigger via a change set into the production environment, but the test class fails with an insufficient privileges error. What should a developer do to fix the problem? Verify that Test, statement ( ) is not inside a For loop in the test class. Add system.runAd ( ) to the best class to execute the trigger as a user with the correct object permissions. Add seeAllData=true to the test class to work within the sharing model for the production environment. Configure the production environment to enable ''Run All tests as Admin User.'' Ninguna 34. Which statement is considered a best practice for writing bulk safe Apex Triggers? Add records to collections and perform DML operations against these collections. Instead of DML statements, use the Database methods with allOrNone set to False. Add LIMIT 50000 to every SOQL statement Perform all DML operations from within a Future Method. Ninguna 35. What is the correct order of execution for Visualforce Page "get" requests (initial page visit)? Evaluate constructors on controller and extensions 2) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 3) Evaluate expressions, attribute actions, and other method calls (getters/setters) on main page 4) If there's a element, create the view state 5) Send HTML to Browser Evaluate constructors on controller and extensions 2) If there's a element, create the view state 3) Evaluate expressions, attribute actions, and other method calls (getters/setters) on main page 4) Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 5) Send HTML to Browser Evaluate constructors, extensions, and expression on attribute definitions on any custom components present 2) Evaluate constructors on controller and extensions 3) Evaluate expressions, attribute actions, and other method calls (getters/setters) on main page 4) If there's a element, create the view state 5) Send HTML to Browser Ninguna 36. messages are rendering on the page. Which component should be added to the Visualforce page to display the message? apex:pageMessages apex:message for="info" apex:pageMessage severity="info" apex:facet name="messages" Ninguna 37. The progress of an apex job queued is using the System.enqueueJob method and needs to be monitored. Which options are valid? (Choose two.) Query the AsyncApexJob record Use the Apex Jobs page in setup Use the Scheduled Jobs page in setup Query the Queueable Apex record 38. A company needs to automatically delete sensitive information after 7 years. This could delete almost a million records every day. How can this be achieved? Schedule an @future process to Query records older than 7 years, and then recursively invoke itself in 1,000 record batches to delete them. Use aggregate functions to query for records older than 7 years, and then delete the AggregateResult objects. Schedule a batch Apex process to run every day that Queries and deletes records older than 7 years. Perform a SOSL statement to find records older than 7 years, and then delete the entire result set. Ninguna 39. Line 1 public class AttributeTypes Line 2 { Line 3 private final String[] arrayItems; Line 4 Line 5 @AuraEnabled Line 6 public List getStringArray() { Line 7 Strings+ arrayItems = new String*+, 'red', 'green', 'blue' -; Line 8 return arrayItems; Line 9 } Line 10 } Consider the Apex controller above that is called from a Lightning Aura Component. What is wrong with it? Lines 1 and 6: class and method must be global Line 8: method must first serialize the list to JSON before returning Line 1: class must be global Line 6: method must be static Ninguna 40. What is a best practice when unit testing a controller? (Choose two.) Verify correct references by using getURL() Simulate user interaction by leveraging Test.setMock() Set query parameters by using getParameters().put Access test data by using seeAIIData=true 41. 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. 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. Use the REST API as well as the SOAP API to effectively double the API calls allowed in a 24- hour period. Ninguna 42. Which annotation exposes an Apex class as a RESTful neb service? @RemoteAction @RestResource @AuraEnabled @HttpInvocabte Ninguna 43. A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation? Profile RecordType User Report Ninguna 44. 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 a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of 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 Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic. 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. Ninguna 45. What is the transaction limit on the max Salesforce CPU time? 60 seconds There is no limit 100 seconds (synchronous); 200 seconds (async) 10 seconds (synchronous); 60 seconds (async) 100 seconds Ninguna 46. A company wants to create a dynamic survey that navigates users through a different series of questions based on their previous responses. What is the recommended solution to meet this requirement? Custom Lightning Application Lightning Process Builder Visualforce and Apex Dynamic Record Choice Ninguna 47. A company uses Opportunism to track sales to their customers and their org has millions of Opportunities. They want to begging to track revenue over time through a related Revenue object. As part of their initial implementation, they want to perform a one-time seeding of their data by automatically creating and populating Revenue records for Opportunities, based on complex logic. They estimate that roughly 100,000 Opportunities will have revenue records and populated. What is the optimal way to automate this? Use Database.exetcuteBatch() to invoke a Database.Batchable class. Use Database.executeBatch() to invoke a Queueable dass. Use System.scheduleJob() to schedule a Database.Scheduleable class. Use System.enqueueJob() to Invoke a Queueable class. Ninguna 48. Which statement is true regarding the use of user input as part of a dynamic SOQL query? The string should be URL encoded by the input form to prevent errors Free text input should not be allowed, to avoid SOQL injection Quotes should be escaped to protect against SOQL injection The String.format() method should be used to prevent injection Ninguna 49. Which statement is true about using ConnectApi namespace (also called Chatter in Apex)? (Choose two.) Chatter in Apex methods do not run in system mode; they run in the context of the current user Chatter in Apex operations are synchronous, and they occur immediately Chatter in Apex methods honor the 'with sharing' and 'without sharing' keywords Many test methods related to Chatter in Apex require the IsTest (SeeAIIData=true) annotation 50. Which statement is true regarding both Flow and Lightning Process? (Choose two.) Can use Apex that implements the Process.Plugin interface Are both server-side considerations in the Order of Execution Are able to be embedded directly into Visualforce pages Can use Apex methods with the @lnvocableMethod annotation 51. 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? Use Flow Builder to develop a Sites page for customers to submit repair requests and track the status of their request. Build an automated Lightning Application using Application Events to ensure data integrity. involve a Salesforce administrator and build out a declarative solution that works in Salesforce desktop and mobile. Use Platform Events with Workflow Rules and RFID integration to ensure proper tracking of the containers. Ninguna 52. 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 REGEX expressions to format the values retrieved via SOQL. 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. Ninguna 53. What Visualforce tag can be used to display custom messages in pages using the Salesforce Ul styling for errors, warnings, and other types of messages? apex:error apex:pageMessage apex:message apex:customMessage Ninguna 54. How many Territories can an instance of salesforce have? 1000 200 100 500 400 Ninguna 55. A company represents their customers as Accounts in Salesforce. All customers have a unique Customer_Number__c that is unique across all of the company's systems. They also have a custom Invoice__c object, with a Lookup to Account, to represent invoices that are sent out from their external system. This company wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer is paying their bills on time. What is the optimal way to implement this? Query the Account Object upon each call to insert invoice data to fetch the Salesforce ID corresponding to the Customer Number on the invoice Create a cross-reference table in the custom invoicing system with the Salesforce Account ID of each Customer and insert invoice data nightly. Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an External ID and Upsert invoice data nightly. Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce without custom code. Ninguna 56. 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? Lightning QuickActionAPI Force:hasRecordId Force hasObjectName Force:lightningQuickActionWithoutHeader Force:lightningQuicAction 57. The "Webservice" keyword___________. Method must be static, and class must be global Can be used on all classes Used for any member variables included All of the above Ninguna 58. 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 Process Builder on Task A Process Builder on Opportunity A trigger on Opportunity Ninguna 59. A developer created an Apex class that makes outbound RESTful callout. The following was created to send a fake response in Apex test methods. Which method can be called to return this fake response in the test methods? Test.createStub Test.setTestData testSetup TestsetMock Ninguna 60. A developer has been asked to create code that will meet the following requirements: Receives input of: Map<ld, Project_c), List Performs a potentially long-running callout to an outside web service Provides a way to confirm that the process executed successfully Which asynchronous feature should be used? Queueable interface Schedulable interface Database.AllowCallouts interface @future (callout=true) Ninguna Time's upTime is Up!