EMT Practice Test

1. Question Content...


Question List

Question1: Given the following trigger implementation:
trigger leadTrigger on Lead (before update){
final ID BUSINESS_RECORDTYPEID = '012500000009Qad';
for(Lead thisLead : Trigger.new){
if(thisLead.Company != null && thisLead.RecordTypeId != BUSINESS_RECORDTYPEID){ thisLead.RecordTypeId = BUSINESS_RECORDTYPEID;
}
}
}
The developer receives deployment errors every time a deployment is attempted from Sandbox to Production.
What should the developer do to ensure a successful deployment?

Question2: How many accounts will be inserted by the following block ofcode? for(Integer i = 0 ; i <
500; i++) { Account a = new Account(Name='New Account ' + i); insert a; }
* 0
87. Boolean odk;
Integer x;
if(abok=false;integer=x;){
X=1;
}elseif(abok=true;integer=x;){
X=2;
}elseif(abok!=null;integer=x;){
X=3;
)elseif{
X=4;}

Question3: Given the following Apex statement:
Account myAccount = [SELECT Id, Name FROM Account];
What occurs when more than one Account is returned by the SOQL query?

Question4: A developer has the following requirements:
Calculate the total amount on an Order.
Calculate the line amount for each Line Item based on quantity selected and price.
Move Line Items to a different Order if a Line Item is not stock.
Which relationship implementation supports these requirements?

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

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

Question7: What should a developer use to obtain the Id and Name of all the Leads. Accounts, and Contacts that hove the company name "Universal Containers"?

Question8: What is the order of operations when a record is saved in Salesforce?

Question9: Where are two locations a developer can look to find information about the status of asynchronous or future cals? Choose 2 answers

Question10: What is the result of the following code?

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

Question12: 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.

Question13: A developer needs to create a baseline set of data (Accounts, Contacts, Products, Assets) for an entire suite of test allowing them to test independent requirements various types of Salesforce Cases.
Which approach can efficiently generate the required data for each unit test?

Question14: A developer is creating a test coverage for a class and needs to insert records to validate functionality. Which method annotation should be used to create records for every method in the test class?

Question15: What can used to delete components from production?

Question16: A team of many developers work in their own individual orgs that have the same configuration at the production org. Which type of org is best suited for this scenario?

Question17: A developer considers the following snippet of code:

Based on this code, what is the value of x?

Question18: Which code displays the content of Visualforce page as PDF?

Question19: A Next Best Action strategy uses an Enchance Element that invokes an Apex method to determine a discount level for a Contact, based on a number of factors. What is the correct definition of the Apex method?

Question20: A developer needs to confirm that a Contact trigger works correctly without changing the organization's data.
what should the developer do to test the Contact trigger?

Question21: A developer creates a new Apex trigger with a helper class, and writes a test class that only exercises 95% coverage of new Apex helper class. Change Set deployment to production fails with the test coverage warning:
"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required" What should the developer do to successfully deploy the new Apex trigger and helper class?

Question22: A developer uses a loop to check each Contact in a list. When a Contact with the Title of
"Boss" is found, the Apex method should jump to the first line of code outside of the for loop.
Which Apex solution will let the developer implement this requirement?

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

Question24: A custom object Trainer_c has a lookup field to another custom object Gym___c.
Which SOQL query will get the record for the Viridian City gym and it's trainers?

Question25: Which two conditions cause workflow rules to fire? Choose 2 answers

Question26: The values 'High', 'Medium', and 'Low' are Identified as common values for multiple picklist across different object. What is an approach a developer can take to streamline maintenance of the picklist and their values, while also restricting the values to the ones mentioned above?

Question27: A developer writes a trigger on the Account object on the before update event that increments a count field. A workflow rule also increments the count field every time that an Account is created or updated. The field update in the workflow rule is configured to not re-evaluate workflow rules.
What is the value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account?

Question28: How should a developer write unit tests for a private method in an Apex class?

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

Question30: 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 a user populates the Lead Source field prior to converting a Lead?

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

Question32: A developer has a Visualforce page and custom controller to save Account records. The developer wants to display any validation rule violation to the user. How can the developer make sure that validation rule violations are displayed?

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

Question34: Which aspect of Apex programming is limited due to multitenancy?

Question35: What are three techniques that a developer can use to invoke an anonymous block of code? (Choose three.)

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

Question37: A Lightning component has a wired property, searchResults, that stores a list of Opportunities. Which definition of the Apex method, to which the searchResults property is wired, should be used?

Question38: A developer needs to save a List of existing Account records named myAccounts to the database, but the records do not contain Salesforce Id values. Only the value of a custom text field configured as an External ID with an API name of Foreign_Key__c is known.
Which two statements enable the developer to save the records to the database without an Id? (Choose two.)

Question39: Universal Containers stores Orders and Line Items in Salesforce. For security reason, financial representatives are allowed to see information on the Order such as order amount, but they are not allowed to see the Line items on the Order. Which type of relationship should be used?

Question40: Which code displays the contents of a Visualforce page as a PDF?

Question41: A developer needs to create a custom button for the Account object that, when clicked, will perform a series of calculation and redirect the user to a custom visualforce page.
Which three attributes need to be defined with values in the <apex:page> tag to accomplish this?
Choose 3 answers

Question42: A developer is asked to create a Visualforce page that displays some Account fields as well as fields configured on the page layout for related Contacts.
How should the developer implement this request?

Question43: Universal Container use a simple order Management app. On the Order Lines, the order line total is calculated by multiplying the item price with the quantity ordered. There is a Master-Detail relationship between the Order and the Order Lines object.
What is the practice to get the sum of all order line totals on the order header?

Question44: A developer must troubleshoot to pinpoint the causes of performance issues when a custom page loads in their org. Which tool should the developer use to troubleshoot?

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

Question46: What are two ways a developer can get the status of an enquered job for a class that queueable interface?
Choose 2 answers

Question47: What does the Lightning Component framework provide to developers?

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

Question49: A developer must create a ShippingCalculator class that cannot be instantiated and must include a working default implementation of a calculate method, that sub-classes can override. What is the correct implementation of the ShippingCalculator class?

Question50: Which three statements are true regarding custom exceptions in Apex? (Choose three.)

Question51: Assuming that 'name; is a String obtained by an <apex:inputText> tag on a Visualforce page.
Which two SOQL queries performed are safe from SOQL injections? Choose 2 answers

Question52: A developer has a requirement to create an Order When an Opportunity reaches a "Closed-Won" status.
Which tool should be used to implement this requirement?

Question53: When a user edits the Postal Code on an Account, a custom Account text field named "Timezone" must be update based on the values in a PostalCodeToTimezone__c custom object. How should a developer implement this feature?

Question54: Universal Containers 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?