Platform Developer II Mock 8 27/01/2023 by Miquel Espinosa 0 Comments Welcome to your Platform Developer II Mock 8 1. An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed end Won. This trigger is working great, except (due to a recent acquisition) historical Opportunity records need to be loaded into the Salesforce instance. When a test batch of records are loaded, the Apex trigger creates Contract records. A developer is tasked with preventing Contract records from being created when mass loading the Opportunities, but the daily users still need to have the Contract records created. What is the most extendable way to update the Apex trigger to accomplish this? Add a Validation Rule to the Contract to prevent Contract creation by the user who loads the data. Use a List Custom Setting to disable the trigger for the user who loads the data. Add the Profile ID of the user who loads the data to the trigger so the trigger will not fire for this user. Use a Hierarchy Custom Setting to skip executing the logic inside the trigger for the user who loads the data. Ninguna 2. Choose the correct definition for apex:actionFunction. 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 Allows for controller methods to be called directly from Javascript. Must be encapsulated in apex:form tags. Unlike actionSupport, these function apex:actionPoller can be called directly from Javascript code Ninguna 3. Sometimes events on Salesforce need to be handled by an external system due to the scale or type of process being executed. Consider the use case of a user in Salesforce needing to get pricing for an order they are building in Salesforce while on the phone with a customer. The pricing logic already exists in a third-party system. Instead of recreating this logic in Salesforce, it will be leveraged by making a request of the third-party system. The response, in this case the pricing, will be returned and stored back in Salesforce. What is the optimal solution? A Visualforce page that can make a real-time Apex callout to display and save the pricing back in Salesforce An ETL tool to process batches of newly saved Orders every few minutes to store the pricing back in Salesforce An Apex trigger that upon saving the Order will make a real-time Apex callout, saving the pricing back in Salesforce A Process Builder process and Outbound Message to fetch the pricing upon save and store the pricing in Salesforce Ninguna 4. 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? Add static to the server-side method signature. Decorate the server-side method with (static=false) Change the function signature to be private static. Decorate the server-side method with (static=true). Ninguna 5. Universal Containers wants to use an external Web Service provided by a third-party vendor to validate that shipping and billing addresses are correct. The current vendor uses basic password authentication, but Universal Containers might switch to a different vendor who uses OAuth. What would allow Universal Containers to switch vendors without updating the code to handle authentication? Custom Setting (List) Custom Metadata Named Credential Dynamic Endpoint Ninguna 6. The Contact object in an org is configured with workflow rules that trigger field updates. The fields are not updating, even though the end user expects them to. The developer creates a debug log to troubleshoot the problem. What should the developer specify in the debug log to see the values of the workflow rule conditions and debug the problem? ERROR level for the Database log category ERROR level for the Workflow log category INFO level for the Database log category INFO level for the Workflow log category Ninguna 7. What is the transaction limit on the recursive trigger depth? There is no limit 16 3 10 17 Ninguna 8. A developer has written the following method: static void processList(List input){ Which code block can be used to call the method? for Account acc : [SELECT Id, Name FROM Account]) processList([SELECT Id, Name FROM sObject WHERE Type = 'Account']) processList (acc) Ninguna 9. A company has a custom object, Sales Demo Request, that has a lookup to an Opportunity. It is required that a Sales Demo Request record be created when an Opportunity's Probability is greater than 50%. What is the optimal way to automate this? Build a Flow on Opportunity. Use an Apex Trigger on Opportunity. Build a Process on Opportunity Create a Workflow on Opportunity. Ninguna 10. What is the transaction limit for the number of records for SOQL queries? 10,000 5,000 50,000 There is no limit 20,000 Ninguna 11. Universal Containers implements a private sharing model for the Convention_Attendence_c custom object. As part of a new quality assurance effort, the company created an Event___Reviewer__c user lookup field on the object. Management wants the event reviewer to automatically gain Read/write access to every record they are assigned to. What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record? Create an After Insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing. Create a Before Insert trigger on the Convention Attendee custom object, and use Apex Sharing Reasons and Apex Managed Sharing. Create a criteria-based sharing rule on the Convention Attendee custom object to share the records the a group of Event Reviewers. Create criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers. Ninguna 12. What tool in the Developer Console contains information on SOQL query Cardinality? Checkpoints tab Query Editor Query Plan Tool View State Tab Log Inspector Ninguna 13. What is the transaction limit for the number of records per DML statement? 5,000 10,000 50,000 20,000 There is no limit Ninguna 14. What is the transaction limit on the max timeout for all callouts? 60 seconds (synchronous); 200 seconds (async) 60 seconds There is no limit 120 seconds (synchronous); 200 seconds (async) 120 seconds Ninguna 15. 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 Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce without custom code. 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. Ninguna 16. 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, true) Database.insert(records, false) insert (records, false) Ninguna 17. What is a benefit of JavaScript remoting over Visualforce Remote Objects? Does not require any Apex code Supports complex server-side application logic Allows for specified re-render targets Does not require any JavaScript code Ninguna 18. The head of recruiting at Universal Containers wants to provide all internal users the ability to search for open positions by role, department, and location via a new recruiting app, In addition to search, users of the app should be able to refer a fried, apply for a position, and review the status of their current submissions. The app should be made available in Salesforce Mobile, but offline access is not required. Given these requirements, what is the recommended approach to developer the app? Salesforce SDK Visualforce Lightning Web Components Lightning Experience Builder Ninguna 19. A developer writes the following Apex trigger so that when a Case is closed, a single Survey record is created for that Case. The issue is that multiple Survey_c records are being created per Case. What could be the cause of this issue? A user is editing the record multiple times A user is creating the record as Closed A workflow rule is firing with a Create Task action A workflow rule is firing with a Field Update action Ninguna 20. A developer is writing a Visualforce page to display a list of all of the checkbox fields found on a custom object. What is the recommended mechanism the developer should use to accomplish this? Schema Class Schema Builder Metadata API Apex API Ninguna 21. A company has a Request__c object that has a lookup to the Opportunity object and a custom field. Status__c, with values of Open,' Closed, and Invalid.' An Opportunity should not be allowed to be deleted if there are any Request__c records related to it that have a Status__c value of Open or 'Closed.' what is the optimal way to enforce the requirement to prevent deletion? A Process on Opportunity An Apex Trigger on Opportunity An Apex Trigger on Request__c A Process on Request__c Ninguna 22. How can the DISTANCE and GEOLOCATION functions be used i|n SOQL queries? (Choose two.) To filter results based on distance from a latitude and longitude To order results by distance from a latitude or longitude To group results in distance ranges from a latitude and longitude To get the distance results from a latitude and longitude 23. Universal Containers (UC) wants to develop a customer community to help their customers log issues with their containers. The community needs to function for their German- and Spanish- speaking customers also. UC heard that it's easy to create an international community using Salesforce, and hired a developer to build out the site. What should the developer use to ensure the site is multilingual? Use Custom Metadata to translate custom picklist values. Use Custom Objects to translate custom picklist values. Use Custom Settings to ensure custom messages are translated properly. Use Custom Labels to ensure custom messages are translated property. Ninguna 24. 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 Apex Trigger responsible for the record creation is not bulk sate and calls insert inside of a for loop. The Apex Trigger responsible for the record creation does not use a static variable to ensure It only fires once. 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 Process Builder responsible for the record creation fires before and after the Workflow rule. Ninguna 25. Which tag should a developer use to display different text while an apex:commandButton is executing versus not executing? ApexactionStatus ApexactionSupper apexactionPoller ApexpageMessages Ninguna 26. A company exposes a REST web service and wants to establish two-way SSL between Salesforce and the REST web service. A certificate signed by an appropriate certificate authority has been provided to the developer. What modification is necessary on the Salesforce side? (Choose two.) Update the code to use HttpRequest.setClientCertificateName() Configure two-factor authentication with the provided certificate Create an entry for the certificate in Certificate and Key Management Update the code to use HttpRequest.setHeaderQ to set an Authorization header. 27. 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 28. A Lightning web component exists in the system and displays information about the record in context as a modal. Salesforce administrators need to use this component within the Lightning App Builder. Which two settings should the developer configure within the xml resource file? Set the IsExposed attribute to True. Set the IsVisible attribute to True. Specify the target to be lightning__RecordPage. Specify the target to be lightning__AppPage. 29. 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 30. 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 31. Universal Containers needs to integrate with their own, existing, internal custom web application. The web application accepts JSON payloads, resizes product images, and sends the resized images back to Salesforce. What should the developer use to implement this integration? A workflow rule with an outbound message that contains a session ID An Apex trigger that calls an @future method that allows callouts A Platform event that makes a callout to the web application A flow that calls an @future method that allows callouts Ninguna 32. A developer has a test class that creates test data before making a mock call-out, but now receives a you have uncommitted work pending. Please commit or callout before calling out error. What step should be taken to resolve the error? Ensure both the insertion and mock callout occur after the Test.startTest(). Ensure the records are inserted before the Test.startTest() statement and the mock callout after the Test.startTest(). Ensure both the insertion and mock callout occur after the Test.stopTest(). Ensure the records are inserted before the Test.startTest() statement and the mock callout occurs within a method annotated with @testSetup. Ninguna 33. Which two scenarios require an Apex method to be called imperatively from a Lightning web component? Choose 2 answers Calling a method that is external to the main controller for the Lightning web component Calling a method with the click of a button Calling a method that makes a web service callout Calling a method that is not annotated with cacheable=true 34. 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 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. Deserialize the data untyped and then process it. Use the ANT migration tool, the custom metadata API, or the Dataloader. Ninguna 35. 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 Lists of Custom Apex Classes cannot be returned by Apex Controllers called by Lightning Aura Components. A custom Apex Class can be returned, but only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned. Only Basic data types and sObjects are supported as return types for Apex Controllers called by Lightning Aura Components. Basic data types are supported, but defaults, such as maximum size for a number, are defined by the objects that they map to. 36. 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? Developer Console Force.com IDE Force.com Migration Tool Workbench Ninguna 37. When testing batch classes, what must a developer do? (Choose two.) Use seeAIIData=true Encapsulate code in Test.startTest and Test.stopTest Call the class* "execute" method Limit the amount of records you test to < 200 38. A corporation has many different Salesforce orgs, with some different objects and some common objects, and wants to build an application that can create, retrieve, and update common object records in all of the different orgs. Which method of integration should the application use? SOAP API with the Enterprise WSDL Apex REST Web Service Metadata API SOAP API with the partner WSDL Ninguna 39. A company uses a custom-built enterprise resource planning (ERP) system to handle order management. The company wants Sales Reps to know the status of orders so that if a customer calls to ask about their shipment, the Sales Rep can advise the customer about the order's status and tracking number if it is already shipped. Which two methods can make this ERP order data visible in Salesforce? Choose 2 answers Use Salesforce Connect to view real-time Order data in the ERP system. Ensure real-time order data is in Salesforce using the Streaming API. Write a cron job In Salesforce to poll the ERP system for order updates. Have the ERP system push the data into Salesforce using the SOAP API. 40. Where in a query can you use Geolocation and Distance? (Choose two.) Filter clause Group By clause Order By clause Select clause 41. Universal Containers allows customers to log into a Salesforce Community and update their orders via a custom Visualforce page. Universal Containers' sales representatives can edit the orders on the same Visualforce page. What should a developer use in an Apex test class to test that record sharing is enforced on the Visualforce page? Use System.profllels() to test as an administrator and a community user, Use System.runAs() to test as an administrator and a community user. Use System.profilels() to test as a sales rep and a community user. Use System.runAs() to test as a sales rep and a community user. Ninguna 42. A company has the Lightning Component above that allows users to dick a button to save their changes and redirects them to a different page. Currently, when the user hits the Save button the records are getting saved, but they are not redirected. Which three techniques can a developer use to debug the JavaScript? Choose 3 answers Use Developer Console to view the debug log. Use consde.log() messages in the JavaScript. Use Developer Console to view checkpoints. Use the browser's dev tools to debug the JavaScript. Enable Debug Mode for Lightning components for the user. 43. The Bulk API__________. 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 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 Ninguna 44. A developer is creating unit tests for code that makes SOAP web service callouts. The developer needs to insert some test data as a part of the unit tests setup. What are three actions to enable this functionality? (Choose three.) Implement the WebServiceMock interface Implement the HttpCalloutMock interface Update code to call Test.setMock() Surround the data insertion with Test.startTest(), Test.stopTest() Surround the callout with TeststartTest(), Test.stopTest() 45. 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. An event is fired ontouchend" and is unhandled. The event Is fired from a custom renderer. The event handler calls a trigger. Ninguna 46. if the "PageReference.setRedirect" Apex function is set to False, what type of request is made? Postback request If PageReference points to the same controller and subset of extensions, postback request, otherwise get request Get request Ninguna 47. 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 external ID Configure a custom field as unique Configure a custom field as Salesforce ID Configure a custom field as indexed 48. PIC 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 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. Ninguna 49. 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? Standard List/Set Controller Controller Extensions Custom Controller Standard Controller Ninguna 50. 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.) Turning off the standard stylesheet Reducing the view state Using selective queries Using actionRegion and rerender Setting the Apex Page attribute cache=true 51. 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 Query the Queueable Apex record Use the Scheduled Jobs page in setup 52. A company has many different unit test methods that create Account records as part of their data setup. A new required field was added to the Account and now all of the unit tests fail. What is the optimal way for a developer to fix the issue? Add the required field to the data setup for all of the unit tests. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set the required field there. Change the required field to be a validation rule that excludes the System Administrator profile. Add a before insert trigger on Account to set the value of the required field. Ninguna 53. Which two relationship queries use the proper syntax? Choose 2 answers SELECT Name, (SELECT LastName FROM Contacts) FROM Account SELECT Id, Name, Account __r.Name FROM Contact WHERE Account r.Industry = 'Media' SELECT Id, Name, Account.Name FROM Contact WHERE Account.Industry = 'Media' SELECT Name, (SELECT LastName FROM Contacts__r) FROM Account 54. A Developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this? Decorate the server-side method with @AuraEnabled(storable=true). Set a cookie in the browser for use upon return to the page. Call the setStorable() method on the action in the JavaScript client-side code. Decorate the server-side method with @AuraEnabled(cacheable=true). Ninguna 55. @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() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate. Add if (!Test.isRunningTest()) around CalloutUtil.sendAccountUpdate. Ninguna 56. If the "PageReference.setRedirect" Apex function is set to True, what type of request is made? Postback request If PageReference points to the same controller and subset of extensions, postback request, otherwise get request Get request Ninguna 57. 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 force:hasRecordedId interface. Ensure the component implements the force:lighningQuickAction.interface. Ensure the access attribute of the aura:component tag is st t Global. Ensure the component implements the lightning:actionOverride interface. Ninguna 58. pic The callout could take longer than 60 seconds to complete. over 10 callouts will be made in a single transaction. The callouts will be made in an Apex Test class. The callouts will be made in an Apex Trigger. Ninguna 59. A company has a web page that needs to get Account record information, given its Salesforce record ID, from JavaScript on the page and then display it. Which method of integration is optimal? REST API SOAP API Apex SOAP Web Service Apex REST Web Service Ninguna 60. An Apex trigger creates an Order__c record every time an Opportunity is won by a Sales Rep. Recently the trigger is creating two orders. What is the optimal method for a developer to troubleshoot this? add system.debug() statements to the code and use the Developer Console logs to trace the code. Run the Apex Test Classes for the Apex trigger to ensure the code still has sufficient code coverage. Set up debug logging for every Sales Rep, then monitor the logs for errors and exceptions. Turn off all Workflow Rules, then turn them on one at time to see which one causes the error. Ninguna Time's upTime is Up!