EMT Practice Test

1. Question Content...


Question List

Question1: Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity's Account?
A)

B)

C)

D)

Question2: A developer is developing a reuseable Aura Component that will reside on an sObject Lightning Page with the following HTML snippet:
<aura:component implements="force:hasRecordId,flexipage:availableForAIIPageTypesM>
<div>Hello!</div>
</aura:component>
How can the component's Controller get the context of the Lightning Page that the sObject is on without requiring additional test coverage?

Question3: A developer sees test failures in the sandbox but not in production. No code or metadata changes have been actively made to either environment since the sandbox was created.
Which consideration should be checked to resolve the issue?

Question4: During the Visualforce Page execution, what step follows immediately after "Evaluate constructors on controller and extensions"?

Question5: How would you test a web service?

Question6: Example 1: AggregateResult[] groupedResults = [SELECT Campaignid, AVG(Amount) FROM Opportunity GROUP BY CampaignId]; for (AggregateResult ar : groupedResuits) { System.debug ('Campaign ID' + ar.get('CampaignId'-); System.debug ('Average amount' + ar.get('exprd')); } Example 2: AggregateResult[] groupedResults = [SELECT Campaignid, AVG(Amount) theAverage FROM Opportunity GROUP BY Campaignid]; for (AggregateResult ar : groupedResuits) { 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 : groupedResuits) System.debug(*Campaign ID' + ar.get('CampaignId')); System.debug('Average amount' + ar.get.AVG(-); } Example 4:AggregateResult[] groupedResults = [SELECT CampaigniId, 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 of the examples above have correct System.debug statements? Choose 2 answers

Question7: What is the correct order of execution for Visualforce Page "postback" requests (when user interaction requires a page update)?

Question8: Line 1 public class AttributeTypes Line 2 { Line 3 private final String[] arrayItems; Line 4 Line 5 @AuraEnabled Line 6 public List<String> getStringArray() { Line 7 Strings+ arrayItems = new String*+, 'red', 'green', 'blue' -; Line 8 return arrayItems; Line 9 } Line 10 } Consider the Apex controller above that is called from a Lightning Aura Component. What is wrong with it?

Question9: 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?

Question10: A developer created a new trigger that inserts a Task when a new Lead is created. After deploying to production, an outside integration is periodically reporting errors.
Which change should the developer make to ensure the integration is not affected with minimal impact to business logic?

Question11: A developer created three Rollup Summary fields: Total_timesheets_c, Total_Approved_timesheet_c and Total_project_Timesheet_c in the custom object, project _c Now, the developer is tasked with created a new field to show the ratio between and approved

Question12: A managed package uses a list of country ISO codes and country names as references data in many different places.. managed package Apex code.
What is the optimal way to store and retrieve the list?

Question13: 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?

Question14: In an organization that has multi-currency enabled, a developer is tasked with building a Lighting Component that displays the top ten Opportunities most recently access by the logged in user. The developer must ensure the Amount and LastModifiedDate field values are displayed according to the user's locale.
What is the most effective approach to ensure values displayed respect the users locale settings?

Question15: A Visualforce Page throws an Attempt to dereference a null object error for a Contact. What change In the controller will fix the error?

Question16: If the "PageReference.setRedirect" Apex function is set to True, what type of request is made?

Question17: What is a benefit of using a WSDL with Apex?

Question18: What is the transaction limit on the number of Apex jobs added to the queue?

Question19: A developer is building a Visualforce page that interacts with external services.
Which interface should the developer implement to test this functionality? (Choose two.)

Question20: Which two relationship queries use the proper syntax? Choose 2 answers

Question21: 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?

Question22: When developing a Lightning web component, which setting displays lightning-layout-items in one column on small devices, such as mobile phones, and in two columns on tablet-size and desktop-size screens?

Question23: A developer is writing a complex application involving triggers, workflow rules, Apex classes, and processes. The developer needs to carefully consider the order of execution when developing the application.
1. Before Triggers
2. After Triggers
3. Post commit logic such as sending email
4. DML committed to the database
5. Workflow rules
6. Roll-up summary calculations
In what order do the following operations execute?

Question24: A customer has a single Visualforce page that allows each user to input up to 1500 sales forecasts and instantly view pivoted forecast calculations. Users are complaining that the page is loading slowly, and they are seeing error messages regarding heap and view state limits.
What are three recommendations to optimize page performance? (Choose three.)

Question25: A company requires an external system to be notified whenever an account is updated.

What LimitException could the following code trigger?

Question26: 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

Question27: An Apex class does not achieve expected code coverage. The testSetup method explicitly calls a method in the Apex class. How can the developer generate the code coverage?

Question28: When should you use the "transient" property on variables?

Question29: A developer receives complaints that the component loads slowly.
Which change can the developer implement to make the component perform faster?

Question30: What is the transaction limit on the recursive trigger depth?

Question31: 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.)

Question32: A company has a native iOS app for placing orders that needs to connect to Salesforce to retrieve consolidated information from many different objects in a JSON format. Which is the optimal method to implement this in Salesforce?

Question33: A developer must create a way for external partners to submit millions of leads into Salesforce per day-How should the developer meet this requirement?

Question34: A lead developer is creating tests for a Lightning web component. The component re-renders when a property called bypassSelection. changes its value.
What should the developer use to the test that the component re-renders successfully when the property changes?

Question35: During the order of execution of a Visualforce page GET request, what happens after this step? Evaluate constructors on controllers and extensions

Question36: A company recently deployed a Visualforce page with a custom controller that has a data grid of information about Opportunities in the org.
Users report that they receive a ''Maximum view state size limit'' error message under certain conditions.
According to Visualforce best practice, which three actions should the developer take to reduce the view state? Choose 3 answers

Question37: 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?

Question38: What is a recommended practice with regard to the Apex CPU limit? (Choose two.)

Question39: What is the correct syntax for calling a controller action from a Visualforce page and updating part of the page once the action is completed? (Choose two.)

Question40: A developer writes the following code:

While testing the code, the developer receives the following error message: System.CalloutException : You have uncommitted work pending What should the developer do? (Choose two.)

Question41: What is a valid request for the following REST method? (Choose two.)
@HttpPost global static void myPostMethod(String si, Integer il, Boolean bl, String 52)

Question42: A developer has working business logic code, but sees the following error in the test class:
You have uncommitted work pending. Please commit or rollback before calling out. What is a possible solution?

Question43: Customer billing data must be added and updated into Salesforce from a remote system on a weekly basis. Additionally, customer activity information must be extracted from Salesforce and put it into an on-premises data warehouse on a weekly basis.
Which approach should be used to import data into Salesforce and export data out of Salesforce, taking into consideration that these imports and exports can interfere with end-user operations during business hours and involve large amounts of data?

Question44: 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?

Question45: A developer is asked to build a solution that will automatically send an email to the Customer when an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The criteria to send the email should be evaluated after all Workflow Rules have fired. What is the optimal way to accomplish this?

Question46: Which three actions must be completed in a Lightning web component for a JavaScript file in a static resource to be loaded?
Choose 3 answers

Question47: A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?

Question48: 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?

Question49: A company has a custom object Sales_Help_Request__c that has a Lookup relationship to Opportunity. The Sales_Help_Request__c has a number field, Number_of_Hours__c, that represents the amount of time spent on the Sales_Help_Request__c.
A developer is tasked with creating a field, Total_Hours__c, on Opportunity that should be the sum of all of the Number_of_Hours__c values for the Sales_Help_Request__c records related to that Opportunity.
What should the developer use to implement this?

Question50: A company uses an external system to manage its custom account territory assignments. Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory assignments are completed in the external system. What is the optimal way to update the Accounts from the external system?

Question51: 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'?

Question52: A developer 15 tasked with creating an application-centric feature on which end-users can access and update information. This feature must be available in lightning Experience while working seamlessly in multiple device form factors, such as desktops, phones, and tablets. Additionally, the feature must support Addressable URL Tabs and interact with the Salesforce Console APIs.
What arm two approaches a developer can take to build the application and support the business requirements ^ Choose 2 answers

Question53: 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?

Question54: A developer has written an After Update trigger on Account. A workflow rule and field update cause the trigger to repeatedly update the Account records.
How should the developer handle the recursive trigger?

Question55: Which are relevant practices while analyzing the timeline of different types of transactions in the execution overview panel? (Choose two.)

Question56: What is a consideration when using bind variables with dynamic SOQL? (Choose two.)

Question57: The "Webservice" keyword___________.

Question58: The test method above calls an @future method that increments the Number_of_Times_Viewed__c value. The assertion is failing because the Number_of_Times_Viewed__c equals 0. What is the optimal way to fix this?

Question59: A developer needs to implement a system audit feature that allows users, assigned to a custom profile named "Auditors", to perform searches against the historical records in the Account object. The developer must ensure the search is able to return history records that are between 12 and 24 months old.
Given the code below, which select statement should be inserted below as a valid way to retrieve the Account History records ranging from 12 to 24 month old?
A)

B)

C)

D)

Question60: If you wanted to create a record following the update of another (with data from the source object), what is the most customizable approach?

Question61: 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?

Question62: A developer has been asked to create code that will meet the following requirements:
Receives input of: Map<ld, Project_c), List<Account>
Performs a potentially long-running callout to an outside web service
Provides a way to confirm that the process executed successfully
Which asynchronous feature should be used?

Question63: What are three benefits of using static resources in Visualforce and Lightning Components? Choose 3 answers

Question64: What is the correct order of execution for Visualforce Page "get" requests (initial page visit)?

Question65: Which use case is an appropriate fit for the @future asynchronous Apex method? (Choose two.)

Question66: 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

Question67: Exhibit.

What must be added to get the data?

Question68: A user receives the generic "An internal server error has occurred" while interacting with a custom Lightning Component. What should the developer do to ensure a more meaningful message?

Question69: An org contains two custom objects; Building__c and Office__c. Office__c has a Lookup field to Building__c.
A developer is asked to automatically populate the Number_of_Offices__c field on the Building__c object with the count of related Office__c records anytime an Office__c record s created or deleted. The developer cannot modify the field types.
Which solution meets the requirements?

Question70: If you have a method "doStuff(List<sObject> records)", which is a valid call?

Question71: What is the optimal syntax for adding a link to a case in a Visualforce page? (Choose two.)

Question72: What is the transaction limit for the number of records per DML statement?

Question73: Where in a query can you use Geolocation and Distance? (Choose two.)

Question74: 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?

Question75: A company uses Opportunism to track sales to their customers and their org has millions of Opportunities. They want to begging to track revenue over time through a related Revenue object.
As part of their initial implementation, they want to perform a one-time seeding of their data by automatically creating and populating Revenue records for Opportunities, based on complex logic. They estimate that roughly 100,000 Opportunities will have revenue records and populated.
What is the optimal way to automate this?

Question76: 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?

Question77: Which tag should a developer use to display different text while an <apex:commandButton> is executing versus not executing?

Question78: What is a best practice when unit testing a controller? (Choose two.)

Question79: Which statement is true regarding both Flow and Lightning Process? (Choose two.)

Question80: A company has a custom component that allows users to search for records of a certain object type by invoking an Apex Controller that returns a list of results based on the user's input, when the search Is completed, a searchComplete event is fired, with the results put in a results attribute of the event. The component is designed to be used within other components and may appear on a single page more than once.
What is the optimal code that should be added to fire the event when the search has completed?

Question81: How should a developer verify that a specific Account record is being tested in a test class for a visualforce controller?

Question82: Just prior to a new deployment, the Salesforce Administrator who configured a new order fulfillment process in a developer sandbox suddenly left the company. The users had fully tested all of the changes in the sandbox and signed off on them.
Unfortunately, although a Change Set was started, it was not complete. A developer is brought in to help finish the deployment.
What should the developer do to identify the configuration changes that need to be moved into production?

Question83: A developer must create a custom pagination solution. While users navigate through pages, if the data is changed from elsewhere, users should still see the cached results first accessed.
How can the developer meet these requirements?

Question84: @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?

Question85: What is a potential design issue with the following code?

Question86: Consider the controller code above that is called from a Lightning component and returns data wrapped in a class.

Consider the controller code above that is called from a Lightning component and returns data wrapped in a class.
The developer verified that the Queries return a single record each and there is error handing in the Lightning component, but the component is not getting anything back when calling the controller getSomeData().
What is wrong?

Question87: What is the transaction limit on the number of "sendEmail" method calls?

Question88: A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page.
Which Apex code feature is required to facilitate this solution'

Question89: A developer encounters an error that states that the Apex heap size is exceeded. Which technique may reduce heap size?

Question90: Which statement is true regarding savepoints?

Question91: Part of a custom Lightning Component displays the total number of Opportunities in the org, which is in the millions. The Lightning Component uses an Apex Controller to get the data it needs. What is the optimal way for a developer to get the total number of Opportunities for the Lightning Component?

Question92: An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary' to control this feature. The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters. What is the optimal way to implement these requirements?

Question93: Choose the correct definition for <apex:pageMessage>.

Question94: Which of the following variables are not transmitted in the view state? (Choose two.)

Question95: A company has a custom object. Request__c. that has a field, Completed__c. and a Lookup to Opportunity, Opportunity__c.
Which SOQL query will get a unique list of all of the Opportunity records that have a Completed Request?

Question96: The SOAP API_________.

Question97: A developer is writing unit tests for the following method:

Which assertion would be used in a negative test case?

Question98: 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

Question99: What is the transaction limit for the number of DML statements allowed?

Question100: The Contact object has a custom field called "Zone." Its data type is "Text" and field length is 3. What is the outcome after executing the following code snippet in the org?

Question101: Which of the following annotations is the right way jto invoke a single apex method?

Question102: After a Platform Event is defined in a Salesforce org, events can be published via which two mechanisms? Choose 2 answers

Question103: A company has reference data stored in multiple Custom Metadata records that represent default information for certain.
When a Contact is inserted, the default information should be set on the Contact from the Custom Metadata records .. Address information.
What is the optimal way to automate this?

Question104: 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?

Question105: Consider the code above.

When a user dicks on the Link of a Contact's name, what happens'

Question106: A developer has created a Visualforce page that uses a third-party JavaScript framework. The developer has decided to supply data to the JavaScript functions using JavaScript Remoting for Apex Controllers.
What is the correct syntax to declare a remote method in Apex? (Choose two.)

Question107: What should be added to the setup, in the location indicated, for the unit test above to create the controller extension for the test?
A)

B)

C)

D)

Question108: What Visualforce tag can be used to display custom messages in pages using the Salesforce Ul styling for errors, warnings, and other types of messages?

Question109: Within the System.Limit class, what would you call to get the total limit you can call in a single transaction?

Question110: A developer has created a Team Member sObject that has a Master-Detail relationship to a Project sObject and a Lookup relationship to the User sObject. The developer must ensure that a User listed on a Team Member record has Read-Write access to the parent Project record.
How can the developer accomplish this if the Project sObject has a Private sharing model and thousands of Project records?

Question111: 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?

Question112: A developer needs to send Account records to an external system for backup purposes. The process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web service. The web service can only receive, at most, one record per call. Which feature should be used to implement these requirements?