Platform Developer I Mock 2 09/12/2022 by Miquel Espinosa 0 Comments Welcome to your Platform Developer I Mock 2 An Apex method, getAccounts, that returns a List of Accounts given a searchTerm, is available for Lightning Web components to use. What is the correct definition of a Lightning Web component property that uses the getAccounts method? @AuraEnabled (getAccounts, { searchTerm: '$searchTerm' } ) accountList; @wire (getAccounts, '$searchTerm') accountList; @wire (getAccounts, { searchTerm: '$searchTerm' }) accountList; @AuraEnabled(getAccounts, '$searchTerm') accountList; Ninguna Refer to the following code snippet for an environment has more than 200 Accounts belonging to the 'Technology' industry: for(Account thisAccount : [Select Id, Industry FROM Account LIMIT 150]){ if(thisAccount.Industry == 'Technology' ){ thisAccount.Is_Tech__c = true; } update thisAccount; } When he code executes which two events occur as a result of the Apex transaction? Choose 2 answers If executed in a synchronous context, the apex transaction is likely to fail by exceeding the DML governor limit. The Apex transaction fails with the following message: "SObject row was retrieved via SOQL without querying the requested field:Account.Is_Tech__ c" . If executed in an asynchronous context, the apex transaction is likely to fail by exceeding the DML governor limit. The Apex transaction succeeds regardless of any uncaught exception and all processed accounts are updated. Universal Containers wants Opportunities to be locked from editing when reaching the Closed/Won stage. Which two strategies should a developer use to accomplish this? Choose 2 answers Use a validation rule. Use the Process Automation settings. Use a trigger. Use Flow Builder. What is the result of the following code? Account a = new Account( ); Database. insert(a, false) The record will not be created and no error will be reported . The record will be created and no error will be reported. The record will be created and a message will be in the debug log. The record will not be created and an exception will be thrown. Ninguna A developer needs to create a custom interface in Apex. Which three considerations must the developer keep in mind while developing the Apex interface? Choose 3 answers A method implementation can be defined within the Apex Interface. New methods can be added to a public interface within a released package. The Apex class must be declared using the interface keyword. The Apex class access modifier can be set to Private, Public, or Global. A method defined in an Apex interface cannot have an access modifier. What will be the output in the debug log in the event of a QueryException during a call to the aQuery method in the following example? class myClass { class CustomException extends QueryException { } public static Account aQuery( ) { Account theAccount; try { system. debug( ' Querying Accounts. '); theAccount = [SELECT Id FROM Account WHERE CreatedDate > TODAY] ; } catch (CustomException eX) { system.debug(' Custom Exception. '); } catch (QueryException eX) { system.debug('Query Exception. '); } finally { system.debug('Done. '); } return theAccount ; } } Querying Accounts. Query Exception. Querying Accounts. Custom Exception. Done. Querying Accounts. Query Exception. Done. Querying Accounts. Custom Exception. Ninguna A developer wants to invoke an outbound message when a record meets a specific criteria. Which three features satisfy this use case? Choose 3 answers Process builder can be used to check the record criteria and send an outbound message without Apex Code. Visual Workflow can be used to check the record criteria and send an outbound message without Apex Code. Process builder can be used to check the record criteria and send an outbound message with Apex Code. Approval Process has the capability to check the record criteria and send an outbound message without Apex Code. Workflows can be used to check the record criteria and send an outbound message. A developer is creating a page that allows users to create multiple Opportunities. The developer is asked to verify the current user's default Opportunity record type, and set certain default values based on the record type before inserting the record. How can the developer find the current user's default record type? Use the Schema.userInfo.Opportunity.getDefaultRecordType( ) method. Query the Profile where the ID equals userInfo.getProfileID( ) and then use the profile.Opportunity.getDefaultRecordType( ) method. Use Opportunity.SObjectType.getDescribe( ).getRecordTypeInfos( ) to get a list of record types, and iterate through them until isDefaultRecordTypeMapping( ) is true. Create the opportunity and check the opportunity.recordType before inserting, which will have the record ID of the current user's default record type. Ninguna The sales management team at Universal Containers requires that the Lead Source field of the Lead record be populated when a Lead is converted. What should be used to ensure that user populates the Lead Source field prior to converting a Lead? Validation Rule Formula Field Process Builder Workflow Rule Ninguna What is the result of the following code snippet? public void doWork(Account acct){ for (Integer i = 0; i <= 200; i++){ insert acct; } } 0 Accounts are inserted. 1 Account is inserted. 200 Accounts are inserted. 201 Accounts are inserted. Ninguna How many Accounts will be inserted by the following block of code? for(Integer i = 0; i< 500; i++){ Account a = new Account (Name= 'New Account ' +i); insert a; } 500 0 100 150 Ninguna What are two ways that a controller extension can be specified on a Visualforce page? Choose 2 answers apex:page controller="Account" extensions="myControllerExtension" apex:page extends="myControllerExtension" apex:page controller="Account, myControllerExtension" apex:page standardController="Account" extensions="myControllerExtension" How does the Lightning Component framework help developers implement solutions faster? By providing an Agile process with default steps By providing device-awareness for mobile and desktops By providing code review standards and processes By providing change history and version control Ninguna Which two are best practices when it comes to Aura components and application event handling? Choose 2 answers Reuse the event logic in a component bundle, by putting the logic in the helper. Handle low-level events in the event handler and re-fire them as higher-level events. Use component events to communicate actions that should be handled at the application level. Try to use application events as opposed to component events. A developer created a Visualforce page and custom controller to display the account type field as shown below. Custom controller code: public with sharing class customCtrlr { private Account theAccount; public String actType; public customCtrlr( ) { theAccount = [SELECT Id, Type FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('Id')]; actType = theAccount.Type; } } Visualforce page snippet: The Account Type is {!actType} The value of the account type field is not being displayed correctly on the page. Assuming the custom controller is properly referenced on the Visualforce page, what should the developer do to correct the problem? Add a getter method for the actType attribute. Convert theAccount.Type to a String. Add with sharing to the custom controller. Change theAccount attribute to public. Ninguna Which action causes a before trigger to fire by default for Accounts? Importing data using the Data Loader and the Bulk API Converting Leads to Contact accounts Updating addresses using the Mass Address update tool Renaming or replacing picklists Ninguna How should a custom user interface be provided when a user edits an Account in Lightning Experience? Override the Account's Edit button with a Lightning component. Override the Account's Edit button with a Lightning Flow. Override the Account's Edit button with a Lightning Action. Override the Account's Edit button with a Lightning page. Ninguna Which three web technologies can be integrated into a Visualforce page? JavaScript HTML Java CSS PHP Which three steps allow a custom SVG to be included in a Lightning web component? Choose 3 answers Reference the getter in the HTML template. Upload the SVG as a static resource. Import the SVG as a content asset file. Import the static resource and provide a getter for it in JavaScript. Reference the import in the HTML template. A developer needs to create a baseline set of data(Accounts, Contacts, Products, Assets) for an entire suite of tests allowing them to test independent requirements various types of Salesforce Cases. Which approach can efficiently generate the required data for each unit test? Create a mock using the Stub API. Add @IsTest(seeAllData=true) at the start of the unit test class. Create test data before Test.startTest( ) in the unit test. Use @TestSetup with a void method. Ninguna Which two statements are true about using the @testSetup annotation in an Apex test class? Choose 2 answers Test data is inserted once for all test methods in a class. The @testSetup annotation is not supported when the @isTest(SeeAllData=True) annotation is used. A method defined with the @testSetup annotation automatically executes before each test method in the test class is executes. Records created in the test setup method cannot be updated in individual test methods. A developer needs to have records with specific field values in order to test a new Apex class. What should the developer do to ensure the data is available to the test? Use SOQL to query the org for the required data. Use Anonymous Apex to create the required data. Use Test.loadData( ) and reference a CSV file. Use Test.loadData( ) and reference a static resource. Ninguna While working in a sandbox an Apex test fails when run in the Test Framework, but the Apex test logic succeeds with no exceptions or errors when run in the Developer Console. Why did the method fail in the sandbox test framework but succeed in the Developer Console? The test method does not use System.runAs to execute as a specific user. The test method is calling an @future method. The test method has a syntax error in the code. The test method relies on existing data in the sandbox. Ninguna When using SalesforceDX, what does a developer need to enable to create and manage scratch orgs? Sandbox Dev Hub Environment Hub Production Ninguna A development team wants to use a deployment script to automatically deploy to a sandbox during their development cycles. Which two tools can they use to run a script that deploys to a sandbox? Choose 2 answers Change Sets SFDX CLI Developer Console Ant Migration Tool Which scenario is valid for execution by unit tests? Execute anonymous Apex as a different user. Generate a Visualforce PDF with getContentAsPDF( )· Load data from a remote site with a callout. Set the created date of a record using a system method. Ninguna Which Salesforce org has a complete duplicate copy of the production org including data and configuration? Full Sandbox Developer Pro Sandbox Production Partial Copy Sandbox Ninguna How can a developer check the test coverage of active Process Builders and Flows before deploying them in a Change Set? Use the Flow Properties page. Use SOQL and the Tooling API. Use the ApexTestResult class. Use the Code Coverage Setup page. Ninguna While writing an Apex class that creates Accounts, a developer wants to make sure that all required fields are handled properly. Which approach should the developer use to be sure that the Apex class works correctly? Add the business logic to a test class. Include a try/catch block to the Apex class. Perform a code review with another developer. Run the code in an Execute Anonymous block. Ninguna Universal Containers has an order system that uses an Order Number to identify an order for customers and service agents. Order records will be imported into Salesforce. How should the Order Number field be defined in Salesforce? Indirect Lookup Lookup Number with External ID Direct Lookup Ninguna A developer is integrating with a legacy on-premise SQL database. What should the developer use to ensure the data being integrated is matched to the right records in Salesforce? Lookup field External ID field Formula field External Object Ninguna A developer is migrating a Visualforce page into a Lightning web component. The Visualforce page shows information about a single record. The developer decides to use Lightning Data Service to access record data. Which security consideration should the developer be aware of Lightning Data Service handles sharing rules and field-level security. Lightning Data Service ignores field-level security. The isaccessible() method must be used for field-level access checks. The with sharing keyword must be used to enforce sharing rules. Ninguna UC uses a Master-Detail relationship and stores the availability date on each Line Item of an Order and Orders are only shipped when all of the Line Items are available. Which method should be used to calculate the estimated ship date for an Order? Use a LATEST formula on each of the latest availability date fields. Use a CEILING formula on each of the latest availability date fields. Use a MAX Roll-Up Summary field on the latest availability date fields. Use a DAYS formula on each of the availability date fields and a COUNT Roll-Up Summary field on the Order. Ninguna A developer created these three roll-up summary fields on the custom object, Project__c: Total_Timesheets__c Total_Approved_Timesheets__c Total_Rejected_Timesheet__c The developer is asked to create a new field that shows the ratio between rejected and approved timesheets for a given project. What are two benefits of choosing a formula field instead of an Apex trigger to fulfill the request? Choose 2 answers A test class will validate the formula field during deployment. Using a formula field reduces maintenance overhead. A formula field will calculate the value retroactively for existing records. A formula field will trigger existing automation when deployed. What should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contacts that have the company name "UC"? SELECT lead(id, name), account(id, name), contact(id, name) FROM Lead, Account, Contact WHERE Name = 'UC' FIND 'UC' IN Name Fields RETURNING lead (id, name), account (id, name), contact (id, name) SELECT Lead.id, Lead.Name, Account.Id, Account.Name, Contact.Id, Contact.Name FROM Lead, Account, Contact WHERE CompanyName = 'UC' FIND 'UC' IN CompanyName Fields RETURNING lead(id, name), account(id, name), contact(id, name) Ninguna The values 'High', 'Medium', and 'Low' are identified as common values for multiple picklists across different objects. What is an approach a developer can take to streamline maintenance of the picklists and their values, while also restricting the values to the ones mentioned above? Create the Picklist on each object and use a Global Picklist Value Set containing the values. Create the Picklist on each object as a required field and select "Display values alphabetically, not in the order entered". Create the Picklist on each object and select "Restrict picklist to the values defined in the value set". Create the Picklist on each object and add a validation rule to ensure data integrity. Ninguna When importing and exporting data into Salesforce, Which two statement are true? Choose 2 answers Data import wizard is a client application provided by Salesforce. Developer and Developer Pro sandboxes have different storage limits. Bulk API can be used to import large data volumes in development environments without bypassing the storage limits. Bulk API can be used to bypass the storage limits when importing large data volumes in development environments. A developer needs to join data received from an integration with an external system with parent records in Salesforce. The data set does not contain the Salesforce IDs of the parent records, but it does have a foreign key attribute that can be used to identify the parent. Which action will allow the developer to relate records in the data model without knowing the salesforce ID? Create and populate a custom field on the parent object marked as an External ID. Create a custom field on the child object of type Lookup. Create a custom field on the child object of type External Relationship. Create and populate a custom field on the parent object marked as Unique. Ninguna What is an example of a polymorphic lookup field in Salesforce? The Leadld and Contactld fields on the standard Campaign Member object A custom field, Link__c, on the standard Contact object that looks up to an Account or a Campaign The Whatld field on the standard Event object The Parentld field on the standard Account object Ninguna A PrimaryId__c custom field exists on the Candidate__c custom object. The field is used to store each candidate's id number and is marked as Unique in the schema definition. As part of a data enrichment process, UC has a CSV file that contains updated data for all candidates in the system. The file contains each Candidate's primary id as a data point. UC wants to upload this information into Salesforce, while ensuring all data rows are correctly mapped to a candidate in the system. Which technique should the developer implement to streamline the data upload? Create a before insert trigger to correctly map the records. Upload the CSV into a custom object related to Candidate__c. Update the Primaryld__c field definition to mark it as an External Id. Create a Process Builder on the Candidate__c object to map the records. Ninguna What is fundamental different between a Mater-Detail relationship and a Lookup relationship? In a Master-Detail relationship, when a record of a master object is deleted, the detail records are not deleted. A Master-Detail relationship detail record inherits the sharing and security of its master record. In a Lookup relationship, the field value is mandatory. In a Lookup relationship when the parent record is deleted, the child records are always deleted. Ninguna A SSN__c custom field exists on the Candidate __c custom object. The field is used to store each candidate's social security number and is marked as Unique in the schema definition. As part of a data enrichment process, Universal Containers has a CSV file that contains updated data for all candidates in the system. The file contains each Candidate's social security number as a data point. Universal Containers wants to upload this information into Salesforce, while ensuring all data rows are correctly mapped to a candidate in the system. Which technique should the developer implement to streamline the data upload? Upload the CSV into a custom object related to Candidate__c. Update the SSN__c field definition to mark it as an External Id. Create a before insert trigger to correctly map the records. Create a process Builder on the Candidate__c object to map the records. Ninguna A developer wants to import 500 Opportunity records into a sandbox. Why should the developer choose to use Data Loader instead of Data Import Wizard? Data Import Wizard does not support Opportunities. Data Import Wizard can not import all 500 records. Data Loader runs from the developer's browser. Data Loader automatically relates Opportunities to Accounts. Ninguna Which two are phases in the Aura application event propagation framework? Choose 2 answers Default Emit Control Bubble UC wants Opportunities to no longer be editable when reaching the Closed/Won stage. How should a developer accomplish this? Use a validation rule. Use the Process Automation settings. Use Flow Builder. Mark fields as read-only on the page layout. Ninguna A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration that reads task records is periodically reporting errors. Which change should the developer make to ensure the integration is not affected with minimal impact to business logic? Use the Database method with allOrNone set to false. Deactivate the trigger before the integration runs. Use a try-catch block after the insert statement. Remove the Apex class from the integration user's profile. Ninguna Which annotation exposes an Apex class as a RESTful web service? @AuraEnabled @RestResource @RemoteAction @HttpInvocable Ninguna UC hires a developer to built a custom search page to help users find the Accounts they want. Users will be able to search on Name, Description, and a custom comments field. Which consideration should the developer be aware of when deciding between SOQL and SOSL? Choose 2 answers. SOQL is able to return more records. SOSL is faster for text searches. SOQL is faster for text searches. SOSL is able to return more records. What is the value of the Trigger.old context variable in a Before Insert trigger? A list of newly created sObjects without IDs Undefined An empty list of sObjects null Ninguna 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) insert(records, false) Database.insert(records, false) Ninguna AggregateResult[ ] groupedResults = [ SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug( 'Campaign ID' + ar.get('CampaignId')); System.debug( 'Average amount' + ar.get('expr0')); } Example 2: AggregateResult[ ] groupedResults = [ SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug( 'Campaign ID' + ar.get('CampaignId')); System.debug( 'Average amount' + ar.get('theAverage')); } Example 3: AggregateResult[ ] groupedResults = [ SELECT CampaignId, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug( 'Campaign ID' + ar.get('CampaignId')); System.debug( 'Average amount' + ar.get.AVG()); } Example 4: AggregateResult[ ] groupedResults = [ SELECT CampaignId, AVG(Amount) theAverage FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResults) { System.debug( 'Campaign ID' + ar.get('CampaignId')); System.debug( 'Average amount' + ar.theAverage); } Which two examples above use the System.debug statements to correctly display the results from the SOQL aggregate queries? Choose 2 answers Example 1 Example 2 Example 3 Example 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? Change the function signature to be private static. Add static to the server-side method signature. Decorate the server-side method with (static=true). Decorate the server-side method with (static=false). Ninguna An Approval Process is defined in the Expense_Item__c object. A business rule dictates that whenever a user changes the Status to 'Submitted' on an Expense_Export__c record, all the Expense_Item__c records related to the expense report must enter the approval process individually. What approach should be used to ensure the business requirement is met? Create a Process Builder on Expense_Report__c with an 'Apex' action type to submit all related Expense_Item__c records when the criteria is met. Create two Process Builder, one on Expense_Report__c to mark the related Expense_Item__c to submit the records for approval. Create a Process Builder on Expense_Report__c with a 'Submit for Approval' action type to submit all related Expense_Item__c records when the criteria is met. Create a Process Builder on Expense_Report__c to mark the related Expense_Item__c as submittable and a trigger on Expense_Item__c to submit the records for approval. Ninguna A workflow updates the value of a custom field for an existing Account. How can a developer access the updated custom field value from a trigger? By writing a Before Insert trigger and accessing the field value from Trigger.new By writing an After Update trigger and accessing the field value from Trigger.old By writing a Before Update trigger and accessing the field value from Trigger.new By writing an After Insert trigger and accessing the field value from Trigger.old Ninguna In the following example, which sharing context will myMethod execute when it is invoked? public Class myClass { public void myMethod( ) { /* implementation */ } } Sharing rules will be inherited from the calling context. Sharing rules will not be enforced for the running user. Sharing rules will be enforced for the running user. Sharing rules will be enforced by the instantiating class. Ninguna Which action may cause triggers to fire? Updates to Feed Items Cascading delete operations Renaming or replacing a picklist entry Changing a user's default division when the transfer division option is checked Ninguna Instead of sending emails to support personnel directly from Salesforce, UC wants to notify an external system in the event that an unhandled exception occurs. What is the appropriate publish/subscribe logic to meet this requirement? Publish the error event using the addError( ) method and write a trigger to subscribe to the event and notify the external system. Publish the error event using the Eventbus.publish( ) method and have the external system subscribe to the event using CometD. Publish the error event using the addError( ) method and have the external system subscribe to the event using CometD. Have the external System subscribe to the BatchApexError event, no publishing is necessary. Ninguna Time's up