Platform Developer II Mock 5 26/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 5 1. @isTest static void testAccountUpdate() { Account acct = new Account({Name = 'Test'); acct.Integration Updated_c = false; insert acct; CalloutUtil.sendAccountUpdate (acct.Id); Account acctAfter = [SELECT Id, Integration Updated_c FROM Account WHERE Id = :acct.Id] [0]; System.assert(true, acctAfter.Integration_Updated_c); } The test method above calls a web service that updates an external system with Account information and sets the Account's Integration_Updated__c checkbox to True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts." What is the optimal way to fix this? Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate. 2. 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 Developer Console Workbench 3. 4. A developer created a Lightning web component that uses a Lightning-record-edit-form to collect information about Leads. Users complain that they only see one error message at a time when they save a Lead record. Which best practice should the developer use to perform the validations, and allow more than one error message to be displayed simultaneously? Process Builder Client-side validation Apex REST Custom validation rules 5. 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 6. 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? Set the re-render attribute of the component to true. Set the rendered attribute of the component to true and re-render a parent component. Set the rendered attribute of the component to true and re-render the component. Perform a full page refresh since rendered elements cannot be re-rendered without refreshing. 7. What is the transaction limit for the number of records for SOQL queries? 50,000 20,000 10,000 5,000 There is no limit 8. A developer is tasked with creating a Lightning web component that is responsive on various devices. which two components should help accomplish this goal? lightning-layout-item lightning-layout lightning-navigation lightning-input-location 9. A developer writes a lightning web component that displays a dropdown list of all custom objects in the org from which a user will select Apex method prepares and returns data to the component. What should the developer do to determine which objects to include m the response? Use the getCustomObject ( ) method from the Schema class. Check the isCustom ( ) value on the sObject describe result. Import the list of all custom objects from @salesforce/schema. Check the getObjectType () value for Custom' or 'Standard' on the sObject describe result. 10. 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 CaseExtensionTwo will be executed All of the three Save methods will be executed Save from Case Standard Controller will be executed Save from CaseExtensionOne will be executed 11. 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 force:lightningQuickActionButton interface. The class "slds-modal__container" must be added to the top-level element of the component. The component's JavaScript controller must handle a method on initialization. A default value must be provided for each component attribute marked as required. 12. As part of a new integration, a developer is asked to implement a new custom search functionality that is capable of performing unrestricted queries and can account for all values within a custom picklist field, type__z, on the Opportunity object. The search feature must also account for NULL values. The organization-wide default for the Opportunity object is set to Public Read-Only, and a new custom index has. been created for the Type__c field. There are more than 5 million Opportunity records within the environment. and a considerable amount of the existing records have NULL values for the picklist Which technique should the developer implement to maximize performance when querying NULL values? Use the OS operator to combine WHERE clauses to strictly search for each value within the picklist, including Type__c ' NULL. Create a formula field that substitutes NULL values for a string of text, create an index for the formula field, then use the formula within the WHERE clause. Perform two SOQL queries; one to query Opportunities where Type__c - NULL, and another to query where Type_: - HBLL, then join the result set using Apex. Use a SOSL query to return ALL opportunities that have a value of NULL in any field. 13. 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? MyRemoter remote = new MyRemoter('TestAccount'}; Account a = remote.getAccount {);System.assertEquals(, ''TestAccount', a.Name -; MyRemoter remote = new MyRemoter(); Account a = remote.getAccount ({'TestAccount'); Account a = controller.getAccount('TestAccount'); System.assertEquals(, 'TestAccount', a.Name } ; Account a = MyRemoter.getAccount ('TestAccount'): System.assertEquals{ 'TestAccount', a.Name }; 14. 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 allowing the Heroku app to automatically store the resized images in Salesforce. 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 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. 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. 15. 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? 2 4 5 3 16. During the order of execution of a Visualforce page GET request, what happens after this step? Evaluate constructors on controllers and extensions During the order of execution of a Visualforce page GET request, what happens after this step? Evaluate constructors on controllers and extensions Send the HTML response to the browser Create view state if exists Evaluate expressions, action attributes, and method calls 17. Which of the following exceptions cannot be caught and will force an error? (Choose three.) LimitException AssertException SObjectExceptions DMLException License exceptions ListException 18. 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? Upload a third-party data table library as a static resource. Use the transient keyword in the Apex code when querying the Account records. Use the standard Account List controller and implement pagination. Use JavaScript remoting to query the accounts. 19. A developer is building a Visualforce page that interacts with external services. Which interface should the developer implement to test this functionality? (Choose two.) HTTPCalloutMock HTTPResponseMock HTTPRequestMock StaticResourceCalloutMock 20. check pic Does the screen need to be accessible from the Lightning Experience UI? 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? 21. A developer creates an application event that has triggered an infinite loop. What may have caused this problem? The event has multiple handlers registered in the project. The event Is fired from a custom renderer. The event handler calls a trigger. An event is fired ontouchend" and is unhandled. 22. Which statement should be used to allow some of the records in a list of records to be inserted if others fail to be inserted? insert records Database.insert(records, false) Database.insert(records, true) insert (records, false) 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 lazy load for occasionally accessed data. Use the Lightning Data Service. Use layoutTypes : ['Full'] to display a set of fields. Use getRecordUi to obtain metadata. Use (cacheable-true) whenever possible. 24. 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 the $Controller global variable to access the controller method via JavaScript Use to create a JavaScript wrapper for the controller method Use to enable JavaScript support for the controller method Use the @RemoteAction annotation on the method definition with JavaScript Remoting 25. An org has a custom object, Registeration_c that has a lookup relationship to the Opportunity object. What should a developer use to create a stand-alone Vlsualforce page that displays the Registration__c records related to an Opportunity. A standard controller A standard controller with a controller extension A custom controler A controler extension 26. A company represents their customers as Accounts that have an External ID field called Customer_Number__c. They have a custom Order (Order__c) object, with a Lookup to Account, to represent Orders that are placed in their external order management system (OMS). When an order is fulfilled in the OMS, a REST call to Salesforce should be made that creates an Order record in Salesforce and retates it to the proper Account. What is the optimal way to implement this? Perform a REST GET on the Account and a REST POST to update the Order__c with the Account's record ID. Perform a REST POST to update the Order__c and specify the Account's Customer_Number__c in it. Perform a REST PATCH to upsert the Order__c and specify the Account's Customer_Number__c in it. Perform a REST GET on the Account and a REST PATCH to upsert the Order__c with the Accounts record ID. 27. 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 LIMIT 50 in SOQL queries Use CURSOR 50 in SOQL queries Use a StandardSetController 28. 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? The test method above tests an Apex trigger that the developer knows will make a lot of queries when a lot of Accounts are simultaneously updated to be customers. The test method fails at the Line 20 because of too many SOQL queries. What is the correct way to fix this? Replace most of the Apex Trigger with Process Builder processes to reduce the number of queries in the trigger. Add TeststartTest() before Line 18 of the code and add Test.stopTest() after line 18 of the code. Add TesLstartTest() before and Test.stop Test() after both Line 7 of the code and Line 20 of the code. Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced. 29. 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? Use the ANT migration tool, the custom metadata API, or the Dataloader. Deserialize the data untyped and then process it. Use middleware to flatten the JSON and consume it as a new custom object. Declare a class with three levels and deserialize the JSON typed with this class. 30. Universal Containers requested the addition of a third-party Map widget to an existing Lightning web component. Which two actions should the developer take to implement this requirement? Choose 2 answers Upload the third-party JavaScript library as a static resource that Imports Into the component. Use a content distribution network and Include tags In the component. Import the third-party JavaScript module directly Into the component. Import loadscript from lightning platformResourceLoader. 31. What tool in the Developer Console contains information on SOQL query Cardinality? Query Plan Tool Log Inspector Checkpoints tab View State Tab Query Editor 32. A lead developer for a Salesforce organization needs to develop a page-centric application that allows the user to interact with multiple objects related to a Contact The application needs to implement a third-party JavaScript framework such as Angular, and must be made available in both Classic and Lightning Experience. Given these requirements, what is the recommended solution to develop the application? Aura Components Visualforce Lightning Web Components Lightning Experience Builder 33. A developer is inserting, updating, and deleting multiple lists of records in a Single transaction and wants to ensure that any error prevents all execution. How should the developer implement error exception handling in their code to handle this? Use Database.setSavepoint() and Database.rollBack() with a Try/Catch statement. Use a Try/Catch statement and handle DML cleanup in the catch statement. Use Database methods to obtain lists of Database.SaveResults. Use a Try/Catch and use sObject.addError() on any failures. 34. Consider the code above. When a user clicks on the Link of a Contact's name, what happens? Nothing happens: the commandLink is missing an action attribute. The outputPanel refreshes, showing the Contacts details. The page refreshes, showing the Contact's details. A new page opens, showing the Contact's details. 35. The REST API___________. 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 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 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 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 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. Use the Database.Insert method with allOrNone set to False. Disable Validation rules on Contacts and set default values with a Trigger. Use setSavePoint() and rollback() with a try/catch block. 37. 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 blocked domains. The list of blocked 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 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 Implement the logic in a Validation Rule on the Contact and a Validation Rule on the Survey_Response_ _c object 38. 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 a scheduled batch job that updates all contact address fields based on the related Account record. Create an After Trigger on Account to update its related contact records on update. Create a Workflow Rule on Account to update related child Contact records. 39. If you have a method "doStuff(List records)", which is a valid call? doStuff([Select Id From Account]); doStuff(sObject obj); doStuff(Account acct); doStuff(List records); 40. What is the transaction limit on the number of "sendEmail" method calls? 20 10 50 100 There is no limit 41. A developer built a Component to be used at the front desk for guests to self-register upon arrival at a kiosk. The developer is now asked to create a Component for the Utility Tray to alert Users whenever a guest has arrived at the front desk. What should be used? Application Event DML Operation Component Event Changelog 42. 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. 43. A developer needs to create a Lightning page for entering Order Information. An error message should be displayed if the zip code entered as part of the Order's shipping address is not numeric. What is a recommended way for the error message be displayed to the end user? Use the tag to display errors. Use the tag to display errors. 44. Choose the correct definition for 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 Signifies which components should be processed by the server when an AJAX request is generated 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 Sends an AJAX request according to the time interval you specify. If this ever gets re- rendered, it resets 45. A developer has refactored an application and renamed an Apex class in a sandbox and now needs to deploy the changes to production. How can this be accomplished? Choose 2 answers Use a changeset to both delete the old Apex class and deploy the new Apex class to production. Deploy the new Apex class with the Force.com Migration Tool and set the old name in destructiveChanges.xml. Deploy the new Apex class, and then log in to the production environment and manually delete the class. 46. 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=fDeveloperT); emp. Company_c = new Company_c(Company_Id_c=f 999 T) insert emp; 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; 47. A developer is asked to update data in an org based on new business rules. The new rules state that Accounts with the type set to 'Customer' should have a status of 'Active', and Accounts with the type set to 'Prospect' should have a status of 'Pending'. No other changes to data should be made. Which code block will accurately meet the business requirements? Map statusMap = new Map{'Customer'=>'Active', 'Prospect'=>'Pending'} List accountUpdates = new List(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( statusMap.containsKey(a.Type) ) { a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; } accountUpdates.add(a); } update accountUpdates; Map statusMap = new Map{'Customer'=>'Active','Prospect'=>'Pending'} List accountUpdates = new List(); for ( Account a : [SELECT Id, Type FROM Account WHERE Status IN :statusMap.keySet()]){ a.Status = statusMap.get(a.Type); accountUpdates.add(a); } update accountUpdates; List accountUpdates = new List(); for ( Account a : [SELECT Id, Type FROM Account]){ a.Status = a.Type == 'Customer' ? 'Active' : 'Pending'; accountUpdates.add(a); } update accountUpdates; List accountUpdates = new List(); for ( Account a : [SELECT Id, Type FROM Account]){ if ( String.isNotBlank(a.Type) && a.Type == 'Customer' ){ a.Status = 'Active'; } if ( String.isNotBlank(a.Type) && a.Type == 'Prospect' ){ a.Status = 'Pending'; } accountUpdates.add(a); } update accountUpdades; 48. 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 Total; {multiple quantit,y unitprice)} in the template. Add calculate Total() {return quantity * unitPrice;} to the javaScript and Total : {calculate Total()} in the template. 49. Refer to re code segment above. When following best practices for writing Apex taggers, which two lots are wrong or cause for concern? Choose 2 answers Line 20 Line 11 Line 16 Line 06 50. Which are relevant practices while analyzing the timeline of different types of transactions in the execution overview panel? (Choose two.) Multiple short bursts of Apex events should be analyzed since they can add up to a significant amount of time 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 51. Which technique can run logic when an Aura Component is loaded? Call $A. enqueueAction passing in the method to call. Use the connectedCallback(0 method. Use an aura:handler 'init'' event to call a function. Use the standard doinit function in the controller. 52. Which of the following object types can be used with a Web Service? Lists Maps Matcher objects Pattern objects Sets Exception objects 53. A developer is tasked with creating a Lightning web component that allows users to create a Case for a selected product, directly from a custom Lightning page. The input fields in the component are displayed in a non-linear fashion on top of an image of the product to help the user better understand the meaning of the fields. Which two components should a developer use to implement the creation of the Case from the Lightning web component? lightning-input lightning-record-edit-form lightning-input-field lightning-record-form 54. Consider the following queries. For these queries, assume that there are more than 200,000 Account records. These records include soft-deleted records; that is, deleted records that are still in the Recycle Bin. Note that there are two fields that are marked as External Id on the Account. These fields are Customer_Number__c and ERP_Key__c. Which two queries are optimized for large data volumes? Choose 2 answers SELECT Id FROM Account WHERE Id IN : aListVariable SELECT Id FROM Account WHERE Name != NULL SELECT Id FROM Account WHERE Name != ' ' AND Customer Number c = 'ValueA' SELECT Id FROM Account WHERE Name != ' ' AND IsDeleted = false 55. A company accepts orders for customers in their enterprise resource planning (ERP) crder__c records with a lookup field to Account. The Account object has an External ID field, ERP_Customer_ID__c. What should the integration use to create new Order__c records that will automatically be related to the correct Account? Upsert on the Order__c object and specify the ERP_Customer_ID__c. Upsert on the Account and specify the ERP_Customer_ID__c. Insert on the Order__c object followed by an update on the Order__c object. Merge on the Order__c object and specify the ERP_Customer_ID__c. 56. What are the ways a developer can create test data of Contacts? (Choose two.) Test.loadTestRecords(Contact.sObjectType, 'staticResource') Test.createTestData () myDataFactory.createContacts(10) Test.loadData(Contact.sObjectType, 'staticResource') 57. What is the transaction limit on the number of Apex jobs added to the queue? There is no limit 150 200 50 100 58. A developer is tasked by Universal 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? 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 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. 59. Universal Containers decided to use Salesforce to manage a new hire interview process. A custom object called candidate as created with organization-wide default set to Private. A lookup on the Candidate object sets an employee as an the viewer user The record cannot be shared with the current setup The record can be shared using a sharing rule. The record can be shared an Apex class. The record can be shared using a permission set. 60. 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? Connected Apps Remote Site Settings Session Id Named Credentials 61. The REST 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 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 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 62. Where in a query can you use Geolocation and Distance? (Choose two.) Select clause Filter clause Group By clause Order By clause 63. Consider the code above. When a user clicks on the Link of a Contact's name, what happens? A new page opens, showing the Contact's details. The outputPanel refreshes, showing the Contacts details. Nothing happens: the commandLink is missing an action attribute. The page refreshes, showing the Contact's details. Time is Up! Time's up