EMT Practice Test

1. Question Content...


Question List

Question1: A developer is debugging the following code to determinate why Accounts are not being created Account a = new Account(Name = 'A'); Database.insert(a, false); How should the code be altered to help debug the issue?

Question2: A developer in a Salesforce org with 100 Accounts executes the following code using the Developer console:
Account myAccount = new Account(Name = 'MyAccount');Insert myAccount;For (Integer x = 0; x < 250; x++)
{Account newAccount = new Account (Name='MyAccount' + x);try {Insert newAccount;}catch (Exception ex) {System.debug (ex) ;}}insert new Account (Name='myAccount'); How many accounts are in the org after this code is run?

Question3: When using SalesforceDX, what does a developer need to enable to create and manage scratch orgs?

Question4: A developer needs to know if all tests currently pass in a Salesforce environment. Which feature can the developer use? (Choose 2)

Question5: A developer needs to create records for the object Property__c. The developer creates the following code block:List propertiesToCreate = helperClass.createProperties();try { // line 3 } catch (Exception exp ) {
//exception
handling }Which line of code would the developer insert at line 3 to ensure that at least some records are created, even if a few records have errors and fail to be created?

Question6: An org has an existing Visual Flow that creates an Opportunity with an Update records element. A developer must update the Visual Flow also created a Contact and store the created Contact's ID on the Opportunity.

Question7: Manage package can be created in which type of org?

Question8: Candidates are reviewed by four separate reviewers and their comments and scores which range from 1 (lowest) to 5 (highest) are stored on a review record that is a detail record for a candidate what is the best way to indicate that a combined review score of 15 of better is required to recommend that the candidate come in for an interview?

Question9: What is a characteristic of the Lightning Component Framework? Choose 2 answers:

Question10: How many levels of child records can be returned in a single SOQL query from one parent object?

Question11: What is a benefit of the Lightning Component framework?Choose 3 answers

Question12: Application Events follow the traditional publish-subscribe model. Which method is used to fire an event?

Question13: A developer uses a Test Setup method to create an Account named 'Test'. The first test method deletes the Account record. What must be done in the second test method to use the Account?

Question14: A developer writes a before insert trigger.How can the developer access the incoming records in the trigger body?

Question15: What actions types should be configured to display a custom success message?

Question16: Which action can a developer take to reduce the execution time of the following code? List<account> allaccounts = [select id from account]; list<account> allcontacts = [select id, accountid from contact]; for (account a :allaccounts){ for (contact c:allcontacts){ if(c.accountid = a.id){ //do work } } }

Question17: Universal Containers has large number of custom applications that were built using a third-party javaScript framework and exposed using Visualforce pages. The Company wants to update these applications to apply styling that resembles the look and feel of Lightning Experience. What should the developer do to fulfill the business request in the quickest and most effective manner?

Question18: A developer encounters APEX heap limit errors in a trigger.
Which two methods should the developer use to avoid this error? (Choose two.)

Question19: What is true of a partial sandbox that is not true of a full sandbox? Choose 2 answers

Question20: Which exception type cannot be caught ?

Question21: A developer is asked to create a PDF quote document formatted using the company's branding guidelines, and automatically save it to the Opportunity record.
Which two ways should a developer create this functionality? (Choose two.)

Question22: When creating a record with a Quick Action, what is the easiest way to post a feed item?

Question23: What are two testing consideration when deploying code from a sandbox to production? Choose 2 answers

Question24: How can a custom type be identified as unique when added to a Set?

Question25: Given the code block: Integer x; For(x=0;x<10; x+=2) { If(x==8) break; If(x==10) break; } System.debug(x); Which value will the system debug statement display?

Question26: Which two condition cause workflow rules to fire? Choose 2 answers

Question27: A developer wants to display all of the available record types for a Case object. The developer also wants to display the picklist values for the Case.Status field. The Case object and the Case.Status field are on a custom Visualforce page. Which action can the developer perform to get the record types and picklist values in the controller? (Choose 2)

Question28: If apex code executes inside the execute() method of an Apex class when implementing the Batchable interface, which statement are true regarding governor limits? Choose 2 answers

Question29: Which is a valid Apex assignment?

Question30: The sales management team requires that the lead source field of the Lead record be populated when Lead is converted. What would a developer use to ensure that a user populates the Lead source field?

Question31: How should a developer make sure that a child record on a custom object, with a lookup to the Account object, has the same sharing access as its associated account?

Question32: In which two trigger types can a developer modify the new sObject records that are obtained by the trigger.new context? Choose 2 answers

Question33: Which two statements are acceptable for a developer to use inside procedural loops?

Question34: From which 2 locations can a developer determine the overall code coverage for a sandbox?

Question35: Which two queries can a developer use in a Visualforce controller to protect against SOQL injection vulnerabilities? Choose 2 answers

Question36: A company would like to send an offer letter to a candidate, have the candidate sign it electronically, and then send the letter back.What can a developer do to accomplish this?

Question37: Universal Containers requires Service Representatives to update all Cases at least one every three days. To make sure of this policy is obeyed, a developer has been asked to implement a field that displays the number of days since the last Case update. What should the developer use to configure the solution?

Question38: A developer tasked with creating a schema to track Movies, Actors, and contracts. A single movie can have many contracts and a single actor can have many contracts. Each contract is owned and actively managed by a single user. Which schema should be created to enable user to easily manage the contract they own; without requiring access to the movie or the actor records?

Question39: A developer needs an Apex method that can process Account or Contact records. Which method signature should the developer use?

Question40: Which scenario is invalid for execution by unit tests?

Question41: Where can debug log filter settings be set?Choose 2 answers

Question42: A developer needs to provide a way to mass edit,update, and delete records from a list view in which two ways can this be accomlpished? choose 2 answers

Question43: A developer uses a before insert trigger on the Lead object to fetch the Territory__c object, where the Territory__c.PostalCode__c matches the Lead.PostalCode. The code fails when the developer uses the Apex Data Loader to insert 10,000 Lead records. The developer has the following code block: Line-01: for (Lead l :
Trigger.new){Line-02: if (l.PostalCode != null) {Line-03: List<Territory__c> terrList = [SELECT Id FROM Territory__c WHERE PostalCode__c = :l.PostalCode];Line-04: if(terrList.size() > 0) Line-05: l.Territory__c = terrList[0].Id; Line-06: }Line-07: }Which line of code is causing the code block to fail?

Question44: A developer created a Visualforce page with a custom controller to show a list of accounts. The page uses the
<apex:SelecList> component, with a variable called "selection", to show the valid values for Account.Type.
The page uses an <apex:pageBlockTable> component to display the list of accounts, where the iteration variable is "acct". The developer wants to ensure that when a user selects a type on the <apex : selectList> component, only accounts with that type are shown on the page. What should the developer do to accomplish this?

Question45: Which statement generates a list of Leads and Contacts that have a field with the phrase 'ACME'?

Question46: A developer runs the following anonymous code block:List<Account> acc = [SELECT Id FROM Account LIMIT 10];Delete acc;Database.emptyRecycleBin(acc);system.debug(Limits.getDMLStatements()+ ', '
+Limits.getLimitDMLStatements());What is the result?

Question47: A developer has the controller class below.

Which code block will run successfully in an execute anonymous window?

Question48: A developer wrote a unit test to confirm that a custom exception works properly in a custom controller, but the test failed due to an exception being thrown.
Which step should the developer take to resolve the issue and properly test the exception?

Question49: What would a developer do to update a picklist field on related Opportunity records when a modification to the associated Account record is detected?

Question50: A developer is asked to create a custom visualforce page that will be used as a dashboard component. Which three are valid controller options for this page? Choose 3 answers

Question51: Universal Containers wants to back up all of the data and attachments in its Salesforce org once month. Which approach should a developer use to meet this requirement?

Question52: Which three steps allow a custom SVG to be included in a Lightning web component? Choose 3 answers

Question53: For which three items can a trace flag be configured? (Choose three.)

Question54: How would a developer change the field type of a custom field on the Account object from string to an integer?

Question55: Which Salesforce feature allows a developer to see when a user last logged in to Salesforce if real-time notification is not required?

Question56: How should a custom user interface be provided when a user edits an Account in Lightning Experience?

Question57: What is the result of the debug statements in testMethod3 when you create test data using testSetup in below code?

Question58: developer created this Apex trigger that calls MyClass .myStaticMethod: trigger myTrigger on Contact(before insert) ( MyClass.myStaticMethod(trigger.new, trigger.oldMap); } The developer creates a test class with a test method that calls MyClass.mystaticMethod, resulting in 81% overall code coverage. What happens when the developer tries to deploy the trigger and two classes to production, assuming no other code exist?

Question59: A platform developer needs to implement a declarative solution that will display the most recent closed won date for all opportunity records associated with an account. Which field is required to achieve this declaratively?

Question60: Which two platform features allow for the use of unsupported languages? Choose 2 answers

Question61: Universal Containers (UC) uses a custom object called Vendor. The Vendor custom object has a Master-Detail relationship with the standard Account object. Based on some internal discussion, the UC administrator tried to change the Master-Detail relationship to a Lookup relationship but was not able todo so. What is apossible reason that this change was not permitted?

Question62: A developer executes the following query in Apex to retrieve a list of contacts for each account:
List<account> accounts = [Select ID, Name, (Select ID, Name from Contacts) from Account] ; Which two exceptions may occur when it executes? (Choose two.)

Question63: Account acct = {SELECT Id from Account limit 1}; Given the code above, how can a developer get the type of object from acct?

Question64: A developer has javascript code that needs to be called by controller functions in multiple components by extending a new abstract component. Which resource in the abstract component bundle allows the developer to achieve this

Question65: A developer must implement a CheckPaymentProcessor class that provides check processing payment capabilities that adhere to what defined for payments in the PaymentProcessor interface. public interface PaymentProcessor { void pay(Decimal amount); } Which is the correct implementation to use the PaymentProcessor interface class?

Question66: A developer uses an 'after update' trigger on the Account object to update all the Contacts related to the Account. The trigger code shown below is randomly failing.
List<Contacts> theContacts = new List<Contacts>(); for(Account a : Trigger.new){ for(Contact c : [SELECT Id, Account_Date__c FROM Contact WHERE AccountId = :a.Id]){ c.Account_Date__c = Date.today(); theContacts.add(c);
}
} updates theContacts;
Which line of code is causing the code block to fail?

Question67: Which governor limit applies to all the code in an apex transaction?

Question68: What are the supported content sources for custom buttons and links? (Choose 2 Answers)

Question69: custom picklist field, Food_Preference__c, exist on a custom object. The picklist contains the following options: 'Vegan','Kosher','No Preference'. The developer must ensure a value is populated every time a record is created or updated. What is the most efficient way to ensure a value is selected every time a record is saved?

Question70: The initial value for a number field on a record is 1. A user updated the value of the number field to 10. This action invokes a workflow field update, which changes the value of the number field to 11. After the workflow field update, an update trigger fires.What is the value of the number field of the object that is obtained from Trigger.old?

Question71: The Review_c object have a lookup relationship to the job_Application_c object. The job_Application_c object has a master detail relationship up to the position_c object. The relationship is based on the auto populated defaults?
What is the recommended way to display field data from the related Review _C records a Visualforce page for a single Position_c record? Select one of the following:

Question72: A developer has an integer variable called maxAttempts. The developer meeds to ensure that once maxAttempts is initialized, it preserves its value for the lenght of the Apex transaction; while being able to share the variable's state between trigger executions. How should the developer declare maxAttempts to meet these requirements?

Question73: What is the return data type when ApexPages.currentPage().getParameters() is used to retrieve URL parameters from a visualforce controller?

Question74: A developer must create a Lightning component that allows user to input Contact record information to create a Contact record, including a Salary__c custom field. What should the developer use, along with a lightning-record-edit-form, so that Salary__c field functions as a currency input and is only viewable and editable by users that have the correct field level permissions on Salary__c?

Question75: Which code block returns the ListView of an Account object using the following debug statement?
system.debug(controller.getListViewOptions() );

Question76: The following Apex method is part of the ContactService class that is called from a trigger: public static void setBusinessUnitToEMEA(Contact thisContact){ thisContact.Business_Unit__c = "EMEA" ; update thisContact; } How should the developer modify the code to ensure best practice are met?

Question77: A developer needs to include a visualforce page in the detail section of a page layout for the account object, but does not see the page as an available option in the page layout editorwhich attribute must the developer include in the <apex:page> tag to ensure the visualforce page can be embedded in a page layout

Question78: A developer wants to create a custom object to track Customer Invoices.How should Invoices and Accounts be related to ensure that all Invoices are visible to everyone with access to an Account?

Question79: A developer creates an Apex helper class to handle complex trigger logic. How can the helper class warn users when the trigger exceeds DML governor limits?

Question80: An sObject named Application_c has a lookup relationship to another sObject named Position_c. Both Application _c and Position_c have a picklist field named Status_c.When the Status_c field on Position_c is updated, the Status_c field on Application_c needs to be populated automatically with the same value, and execute a workflow rule on Application_c.How can a developer accomplish this?

Question81: In the code below, which type does String inherit from? String s = 'Hello World';

Question82: To which primitive data type in Apex is a currency field atomically assigned?

Question83: A developer created an Apex trigger using the Developer Console and now wants to debug codeHow can the developer accomplish this in the Developer Console?

Question84: Which type of controller should a developer use to include a list of related records for a Custom Object record on a Visualforce page without needing additional test coverage?

Question85: What is the maximum number of SOQL queries used by the following code? List<Account> aList = [SELECT Id FROM Account LIMIT 5]; for (Account a : aList){ List<Contact> cList = [SELECT Id FROM Contact WHERE AccountId = :a.Id); }

Question86: Which two operations can be performed using a formula field? Choose 2 answers

Question87: Given the following block code: try{ List <Accounts> retrievedRecords = [SELECT Id FROM Account WHERE Website = null]; }catch(Exception e){ //manage exception logic } What should a developer do to ensure the code execution is disrupted if the retrievedRecordslist remains empty after the SOQL query?

Question88: What should be used to create scratch orgs?

Question89: A developer creates a custom controller and custom Visualforce page by using the following code block:public class myController {public String myString;public String getMyString() {return 'getmyString';}public String getStringMethod1() {return myString;}public String getStringMethod2() {if (myString == null)myString =
'Method2';return myString;}}{!myString}, {!StringMethod1}, {!StringMethod2}, {!myString}What does the user see when accessing the custom page?

Question90: Which three code lines are required to create a Lightning component on a Visualforce page? Choose 3 answers

Question91: A developer created a Visualforce page and custom controller to display the account type field as shown below. Custom controller code: public 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 property referenced on the Visualforce page, what should the developer do to correct the problem?

Question92: Which three data types can be returned from an SOQL statement?

Question93: Which statement about change set deployments is accurate? (Choose 3)

Question94: A platform developer needs to write an apex method that will only perform an action if a record is assigned to a specific record type. Which two options allow the developer to dynamically determine the ID of the required record type by its name? Choose 2 answers

Question95: Which approach should a developer use to add pagination to a Visualforce page?

Question96: In the Lightning Component framework, where is client-side controller logic contained?

Question97: A developer working on a time management application wants to make total hours for each timecard available to applications users. A timecard entry has a Master-Detail relationship to a timecard. Which approach should the developer use to accomplish this declaratively?

Question98: The sales team at Universal Containers would like to see a visual indicator appear on both Account and Opportunity page layouts to alert salespeople when an Account is late making payments or has entered the collections process. What can a developer implement to achieve this requirement without having to write custom code?

Question99: The Sales Management team hires a new intern. The intern is not allowed to view Opportunities, but needs to see the Most Recent Closed Date of all child Opportunities when viewing an Account record. What would a developer do to meet this requirement?

Question100: A developer is asked to set a picklist field to 'Monitor' on any new Leads owned by a subnet of Users.
How should the developer implement this request?