Platform Developer II Mock 1 25/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 1 1. Which method should be used to convert a Date to a String in the current user's locale? Date.parse String.format String. valueOf Date.format 2. A company has a custom object. Request__c. that has a field, Completed__c. and a Lookup to Opportunity, Opportunity__c. Which SOQL query will get a unique list of all of the Opportunity records that have a Completed Request? SELECT Id FROM Opportunity WHERE Id IN SELECT Id FROM Request__c WHERE Completed = true) SELECT Opportunity__c FROM Request__c WHERE Completed__c = true SELECT Id FROM Opportunity WHERE Id IN (SELECT Opportunity__c FROM Request__c WHERE Completed__c = true) SELECT Opportunity__c FROM Request__c WHERE Id IN (Select Id FROM Request__c WHERE Completed__c = true) 3. During the order of execution of a Visualforce page GET request, what happens after this step? Evaluate constructors on controllers and extensions Evaluate expressions, action attributes, and method calls Evaluate constructors and expressions on custom components Create view state if exists Send the HTML response to the browser 4. What is the transaction limit on the number of "sendEmail" method calls? 20 10 50 100 There is no limit 5. A company has a custom object. Order__c, that has a custom picklist field. Status__c, with values of New, In Progress," or Fulfilled and a lookup field, Contact_c, to Contact. Which SOQL query wrii return a unique list of all the Contact records that have no Fulfilled Orders? SELECT iD FROM Contact WHERE id NOT IN (SELECT id From order_c WHERE_c = Fulfilled') SELECT Contact_c FROM Order_c Where Status_c ;Fulfilled' SELECT Contact_c From order_c Where id NOT IN (SELECT id FROM_c Where States_c + Fulfilled') SELECT id FROM Contact WHERE id NOT IN (SELECT Contact _c FROM order_c Where Status_c = fulfilled') 6. 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 this, account = getData ( ) ; to t loadData ( ) function. Add this, account = getData (this.name); to the loadData ( ) function. Add @wire(getData, {name: $name'}) to the account field and delete loadData ( ) because it is not needed. Add getData ({ name; this,name}) , then (result=> { this.account = result}) to the LeadData ( ) function. 7. Given the following containment hierarchy: What is the correct way to communicate the new value of a property named ''passthrough'' to my- parent component if the property is defined within my-child-component? let cEvent = new customEvent('passthrough', { detail: 'this.passthrough' }); this.dispatchEvent (cEvent); let cEvent = new CustomEvent ('passthrough', { detail: this.passthrough }); let cEvent = new CustomEvent ($passthrough); this.dispatchEvent (cEvent); let cEvent = new CustomEvent ('passthrough'); this.dispatchEvent(cEvent); 8. What is the transaction limit on the number of callouts? 200 100 50 150 There is no limit 9. A developer is writing code that requires making callouts to an external web service. Which scenario necessitates that the callout be made in an @future method? The callouts will be made in an Apex Test class. The callouts will be made in an Apex Trigger. Over 10 callouts will be made in a single transaction. The callout could take longer than 60 seconds to complete. 10. A custom Aura component, AddressValidation,cmp,exists in the system. The Salesforce admin for the organization is unable to find and select the component while creating a quick action for the Account sObject. What should the developer do to ensure that AddressValidation,cmp can be selected when creating a quick action? Ensure the component implements the lightning:actionOverride interface. Ensure the component implements the force:lighningQuickAction.interface. Ensure the access attribute of the aura:component tag is set to Global. Ensure the component implements the force:hasRecordedId interface. 11. A developer has written the following method: static void processList(List input){ Which code block can be used to call the method? for Account ace : [SELECT Id, Name FROM Account]) processList ([FIND 'Acme" 'RETURNING Account]) processList (ace) processList([SELECT Id, Name FROM sObject WHERE Type = 'Account']) 12. 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 has long-running jobs with large data volumes that need to be performed in batches 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 13. Universal Containers wants to use a Customer Community with Customer Community Plus licenses to allow their customers access to track how many containers they have rented and when they are due back. Universal Containers uses a Private sharing model for External users. Many of their customers are multi-national corporations with complex Account hierarchies. Each account on the hierarchy represents a department within the same business. One of the requirements is to allow certain community users within the same Account hierarchy to see several departments' containers, based on a custom junction object that relates the Contact to the various Account records that represent the departments. Which solution solves these requirements? An Apex trigger that creates Apex managed sharing records based on the junction object's relationships A Visualforce page that uses a custom controller that specifies wither sharing to expose the records Lightning web component on the Community Home Page that uses Lightning Data Services. A custom list view on the junction object with filters that will show the proper records based on owner 14. A developer is building a Lightning web component that displays quantity, unit price, and the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit price. What must be added to display the total? Add Total: {quantity * UnitPrice} in the template. Add get total() { return quantity * unitPrice;} to the JavaScript and Total: {total} in the template. Add calculate Total() {return quantity * unitPrice;} to the javaScript and Total : {calculate Total()} in the template. Add Total; {multiple quantit,y unitprice)} in the template. 15. What are the ways a developer can create test data of Contacts? (Choose two.) myDataFactory.createContacts(10) Test.loadData(Contact.sObjectType, 'staticResource') Test.loadTestRecords(Contact.sObjectType, 'staticResource') Test.createTestData () 16. A Developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this? Set a cookie in the browser for use upon return to the page. Decorate the server-side method with @AuraEnabled(cacheable=true). Call the setStorable() method on the action in the JavaScript client-side code. Decorate the server-side method with @AuraEnabled(storable=true). 17. A developer has requirement to query three fields (id, name, Type) from an Account and first and last names for all Contacts associated with the Account. Which option is the preferred optimized method to achieve this for the Account named 'Ozene Electronics'? List 1Contacts = new list ( ); for(Contact c ; 1Select firstname, lastname Account, Name Account,ID Account, Type from Contact where Account: Name=' electronics')) ( iContacts.add(c);) Account a = (SELECT ID, Name, Type from Account where name= Ozone Electronics;) list 1contacts = (SELECT firstname, lastname from Contacts where accountid=: a -ID0; Account a = (SELECT ID, Name, Type, (select contat,firstName, Contact,LastName from Account, Contacts) from Account where name; Ozone Electronic' Limit 1 ); List 1Accounts = (Select ID, Name, Type from Account Join (Select ID, firstname, lastname form Contact where contact account , name 'ozone electronics)); 18. Universal Containers uses a custom Lightning page to provide a mechanism to perform a step- by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERP_Number__c, that is then used in a query to find matching Accounts. A developer receives the exception 'SOQL query not selective enough. Which step should be taken to resolve the issue? Move the SOQL query to within an asyncronous process. Mark the ERP_Number__c field as required. Mark the lRP_Number__c field as an external ID. Perform the SOQL query as part of a for loop. 19. Which of the follow be used together in DML operations (transaction)? (Choose two.) Opportunity - User Account - AccountShare Account - Order Case - CaseComment 20. 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 Move the Region__c query to outside the loop. Remove the last line updating accountList as it is not needed. Use a Map accountMap instead of List accountList. Use a Map to cache the results of the Region__c query by Id. 21. What is the transaction limit on the max execution time? There is no limit 20 minutes 5 minutes 15 minutes 10 minutes 22. 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 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 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, thus deleting each other's fields from the objects in production. 23. Which three approaches should a developer Implement to obtain the best performance for data retrieval when building a Lightning web component? Choose 3 answers Use layoutTypes : ['Full'] to display a set of fields. Use the Lightning Data Service. Use (cacheable-true) whenever possible. Use getRecordUi to obtain metadata. Use lazy load for occasionally accessed data. 24. 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 Salesforce ID Configure a custom field as indexed Configure a custom field as external ID 25. 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 visualforce Remoting to handle the web service callout. Use an Apex trigger with callout=true annotation. Use Continuation that is invoked when a Submit button is clicked. Use the Salesforce Metadata API in the web service callout. 26. What is the best way to display field-level error messages in Lightning? auraxomponent apex:message ukoutputText ukinputDefaultError 27. 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 String getTable() @RemoteAction global static String getTable() @RemoteObject global static String getTableQ @RemoteAction public static String getTable() 28. A Visualforce page contains an industry select list and displays a table of Accounts that have a matching value in their Industry field. Add an within the . Add an within the . 29. 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 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 Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic. 30. A developer has built a multi-page wizard using a single Custom Controller to query and update dat a. Users are complaining that the pages are loading slowly. What will improve performance? (Choose three.) Using selective queries Reducing the view state Setting the Apex Page attribute cache=true Turning off the standard stylesheet Using actionRegion and rerender 31. 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? Decorate the server-side method with (static=true). Change the function signature to be private static. Add static to the server-side method signature. Decorate the server-side method with (static=false) 32. Given the following code: Assuming there were 10 Contacts and five Accounts created today, what is the expected result? System. LimitException: Too many SOQL Queries on Account. System. QueryException: Too many DML Statement errors on Contact System. LimitException: Too many SOQL Queries on Contract System. QueryException: List has more than one row after Assignment on Account. 33. 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 will automatically update with each Salesforce release. Declarative customizations do not require user testing. 34. A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property. What must be done in the component to get the data from Salesforce? Add the following code above record; @api (getRecord, {recordId: '$recordId' }). Get the fields in renderedCallback() and assign them to record. Add the following code above record; @wire (getRecord, { recordId: '$recordId', fields: '$fields' }) Add the following code above record; @wire (getRecord, { recordId: '$recordId' }). Get the fields in the renderedCallback() and assign them to record. Add the following code above record: @api (getRecord, { recordId: '$recordId', fields: '$fields' }) 35. A developer created a custom component to display an HTML table. The developer wants to be able to use the component on different Visualforce Pages and specify different header text for the table. Which tag should the developer use inside the component? 36. 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.Delete method if the Contact insertion fails. Disable validation rules on Contacts and set default values with a Trigger. use the Database.Insert method with allOrNone set to False. use setSavePoint() and rollback() with a try/catch block. 37. What is the transaction limit for the number of SOSL queries? 200 (synchronous), 100 (async) 100 (synchronous), 200 (async) 2,000 There is no limit 20 38. 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.) Global Labels Translation Workberic convertCurrency() Custom Labels getLocalCurrency() 39. A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page. Which feature of Apex code is required to facilitate this solution? REST API Dynamic Schema binding describeSObjects() SOSL queries 40. look at the pic Line 6: method must be static Line 8: method must first serialize the list to JSON before returning Line 1: class must be global Lines 1 and 6: class and method must be global 41. What is the best practice to initialize a Visualforce page in a test class? Use Test, setCurrentPage(Page.MyTestPage); Use Test.setCurrentpage,MyTestPage; Use Test.currentpage, getParameter, put (MyTestPage); Use controller,currentPage, setPage (MyTestPage); 42. Customer billing data must be added and updated into Salesforce from a remote system on a weekly basis. Additionally, customer activity information must be extracted from Salesforce and put it into an on-premises data warehouse on a weekly basis. Which approach should be used to import data into Salesforce and export data out of Salesforce, taking into consideration that these imports and exports can interfere with end-user operations during business hours and involve large amounts of data? Salesforce Connect to push data to and pull data from the remote systems Call-in directly from each remote system to Salesforce APIs to push and pull the data Replication via third-party ETL to push data into Salesforce and pull data out in batches Batch Apex, where Salesforce pushes data to and pulls data from the remote systems 43. What is the most efficient way in Visualforce to show information based on data filters defined by an end-user for a large volume of data? Use filter conditions in a SOQL query to limit data based on data filters Use an Apex controller to refine raw data based on data filters and store the result in a transient variable Use an Apex controller to refine raw data based on data filters and store the result in a static variable Use the rendered condition in Visualforce to limit data based on data filters 44. What level can a hierarchy custom setting be defined for? (Choose three.) Organization Profiles Groups Users Roles 45. For compliance purposes, a company is required to track long-term product usage in their org. The information that they need to log will be collected from more than one object and. over time, they predict they will have hundreds of millions of records. What should a developer use to implement this? Big objects Setup Audit Trail Field History Tracking Field Audit Trail 46. Refer to the code snippet below: As part of an Integration development effort, a developer is tasked to create an Apex method mat solely relies on the use of foreign identifiers In order to relate new contact records to existing Accounts in Salesforce. The account object contains a field marked as an external ID, the API Name of this field is Legacy_Id_c. What Is the most efficient way to instantiate the parentAccount: variable on line 02 to ensure the newly created contact is properly related to the Account? Account parentAccount = [SELECT Id FROM Account WHERE Legacy_Id__c = :externalIdentifier].Id Account parentAccount = new Account (Legacy_Id__c = externalIdentifier); Account parentAccount = [SELECT Id FROM Account WHERE Legacy_Id_c = :externalIdentifier); Account parentAccount = new Account(); parentAccount.Id = externalIdentifier; 47. 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. 48. 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: The batch process will not recognize new accounts created in the same session 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(). 49. The Account edit button must be overridden in an org where a subset of users still use Salesforce Classic. The org already has a Lightning Component that will do the work necessary for the override, and the client wants to be able to reuse it, How should a developer implement this? Override the edit button for Lightning with a Lightning Page; and for Classic, override the edit button with a Visualforce pag That contains the Lightning Component. Override the edit button for both Lightning and Classic with a Lightning Component. The edit button for both Lightning and Classic with a new Visualforce page. Override the edit button for Lightning with a Lightning Component; and for Classic, override the edit button with a Visualforce page that contains the Lightning Component. 50. look pic SOAP API Apex REST Web Service Bulk API Composite REST API 51. How should a developer verify that a specific Account record is being tested in a test class for a visualforce controller? Insert the Account in the test class, instantiate the page reference in the test class, then use System.currentPageReference().getParameters{}.put() to set the Account ID. Instantiate the page reference in the test class, insert the Account in the test class, then use System.setParentRecordld().get() to set the Account ID. Insert the Account into Salesforce, instantiate the page reference in the test class, then use System.setParentRecordId().get() to set the Account ID. Instantiate the page reference in the test class, insert the Account in the test class, then use seeAHData-true to view the Account. 52. 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 SingleEmailMessage() with an Apex Trigger. Use an Email Alert with Process Builder. Use a Workflow Email Alert. Usea MassEmailMessage() with an Apex Trigger. 53. How can the DISTANCE and GEOLOCATION functions be used i|n SOQL queries? (Choose two.) To get the distance results from a latitude and longitude To order results by distance from a latitude or longitude To filter results based on distance from a latitude and longitude To group results in distance ranges from a latitude and longitude 54. What is the correct order of execution for Visualforce Page "get" requests (initial page visit)? 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 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 55. 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=M6" mobile-device-size="12" Set size="12" medium-device-size="6" Set size="12" tablet-device-size="6" Set size="6" small-device-size="12" 56. When calling a RESTful web service, a developer receives a JSON payload that has a data hierarchy that is nested three levels deep. How can the developer describe the external data? Declare a class with three levels and deserialize the JSON typed with this class. Deserialize the data untyped and then process it. Use the ANT migration tool, the custom metadata API, or the Dataloader. Use middleware to flatten the JSON and consume it as a new custom object. 57. A developer is working on code that requires a call to an external web service from a batch. How should the developer enable this functionality? Implement an @future method for the callout, and invoke it from the batch Implement a custom System.CalloutException class Include Database.AllowCallout() in the class definition Specify "callout=true" in the batch implementation 58. A company wants to incorporate a third-party web service to set the Address fields when an Account is inserted, if they have not already been set. What is the optimal way to achieve this? Create a Process, call an Apex @InvocableMethod from it, and make the callout from that Apex method. Create a Process, call an Apex @future(callout=true) method from it, and make the callout from that Apex method. Create an after insert trigger, call an Apex @InvocableMethod method from it, and make the callout from that Apex method Create an after insert trigger, call an @future(callout=true) method from it, and make the callout from that Apex method. 59. 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? Create a Workflow on Opportunity. Use an Apex Trigger on Opportunity. Build a Process on Opportunity Build a Flow on Opportunity. 60. How should a developer assert that a trigger with an asynchronous process has successfully run? Create all test data in the test class, invoke Test.startTest() and Test.stopTest() and then perform assertions Create all test data, use @future In the test class, then perform assertions. Create at test data in the test class, use System.runAs() to invoke the trigger, then perform assertions. Insert records into Salesforce, use seeAllData-true, then perform assertions. Time is Up! Time's up