Set 3 Flashcards
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?
A. Use try/catch within the unit test to catch the exception.
B. Use the database methods with all or none set to FALSE.
C. Use Test.isRunningTest() within the custom controller.
D. Use the finally bloc within the unit test to populate the exception.
A
Which action may cause triggers to fire?
A. Changing a user’s default division when the transfer division option is checked
B. Updates to Feed Items
C. Renaming or replacing a picklist entry
D. Cascading delete operations
B
Which three options allow a developer to use custom styling in a Visualforce page? (Choose three.)
A. tag
B. tag
C. Inline CSS
D. tag
E. A static resource
A, B, E
A developer has the controller class below:
public with sharing class myFooController { public Integer prop { get; private set; } }
Which code block will run successfully in an execute anonymous window? A. myFooController m = new myFooController();System.assert(m.prop ==null);
B. myFooController m = new myFooController();System.assert(m.prop !=null);
C. myFooController m = new myFooController();System.assert(m.prop ==0);
D. myFooController m = new myFooController();System.assert(m.prop ==1);
A
A visualforce interface is created for Case Management that includes both standard and custom functionality defined in an Apex class called myControllerExtension. The visualforce page should include which attribute(s) to correctly implement controller functionality? A. Controller=" myControllerExtension"
B. Controller = “case” and extensions =” myControllerExtension”
C. Extensions=” myControllerExtension”
D. StandardController = “case” and extensions =” myControllerExtension”
D
Which approach should be used to provide test data for a test class? A. Use a test data factory class to create test data.
B. Query for existing records in the database.
C. Execute anonymous code blocks that create data.
D. Access data in @TestVisible class variables.
A
How can a developer implement this feature?
A. Build a workflow rule.
B. Build a flow with Flow Builder.
C. Build an account approval process.
D. Build an account assignment rule.
B
A developer creates a Lightning web component that imports a method within an Apex class. When a Validate button is pressed, the method runs to execute complex validations.
In this implementation scenario, which artifact is part of the Controller according to the MVC architecture?
A. XML file
B. HTML file
C. JavaScript file
D. Apex class
D
Which salesforce org has a complete duplicate copy of the production org including data and configuration?
A. Full Sandbox
B. Production
C. Developer Pro Sandbox
D. Partial Copy Sandbox
A
Which three resources in a Lightning Component Bundle can contain JavaScript functions? Choose 3
A. Style
B. Design
C. Helper
D. Controller
E. Renderer
C, D, E
What are three ways for a developer to execute tests in an org? Choose 3.
A. Bulk API
B. Tooling API
C. Setup Menu
D. Salesforce DX
E. Metadata API.
B, C, D
What will be the output in the debug log in the event of a QueryExeption during a call to the @query 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; } }
A. Querying Accounts. Query Exception. Done
B. Querying Accounts. Query Exception.
C. Querying Accounts. Custom Exception Done.
D. Querying Accounts. Custom Exception.
A
A developer created a weather app that contains multiple Lightning web components.
One of the components, called Toggle, has a toggle for Fahrenheit or Celsius units. Another component, called Temperature, displays the current temperature in the unit selected in the Toggle component When a user toggles from Fahrenheit to Celsius or vice versa in the Toggle component, the information must be sent to the Temperature component so the temperature can be converted and displayed.
What is the recommend way to accomplish this?
A. Create a custom event to handle the communicate between the components.
B. The Toggle component should call a method in the Temperature component.
C. Use Lightning Message Service to communicate between the component.
D. Use Lightning Message Service to communicate between the components.
A
A developer creates a Workflow Rule declaratively that updates a field on an object. An Apex update trigger exists for that object. What happens when a user updates a record?
A. The Apex Trigger is fired more than once.
B. No changes are made to the data.
C. The Workflow Rule is fired more than once.
D. Both the Apex Trigger and Workflow Rule are fired only once.
A
A developer identifies the following triggers on the Expense_c object:
DeleteExpense,
applyDefaultstoexpense
validateexpenseupdate;
The triggers process before delete, before insert, and before update events respectively.
Which two techniques should the developer implement to ensure trigger best practice are followed?
A. Unify all three triggers in a single trigger on the Expense__c object that includes all events.
B. Maintain all three triggers on the Expense__c object, but move the Apex logic out for the trigger definition.
C. Create helper classes to execute the appropriate logic when a record is saved.
D. Unify the before insert and before update triggers and use Process Builder for the delete action.
B, C
A developer considers the following snippet of code:
Boolean isOK;
Integer x;
String theString = ‘Hello’;
if (isOK == false && theString == ‘Hello’) {
x = 1;
} else if (isOK == true && theString == ‘Hello’ ) {
x = 2;
} else if (isOK != null && theString == ‘Hello’) {
x = 3;
} else {
x = 4;
}
Based on this code, what is the value of x?
A. 2
B. 4
C. 1
D. 3
B
What is a capability of the Developer Console?
A. Execute Anonymous Apex code, Create/Edit code, Deploy code changes.
B. Execute Anonymous Apex code, Create/Edit code, view Debug Logs.
C. Execute Anonymous Apex code, Run REST API, create/Edit code.
D. Execute Anonymous Apex code, Run REST API, deploy code changes.
B
Which query should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contacts that have the company name “Universal Containers”?
A. FIND ‘Universal Containers’ IN CompanyName Fields RETURNING lead(id,name), account (id,name), contact(id,name)
B. IND ‘Universal Containers’ IN Name Fields RETURNING lead(id, name), account(id,name), contact(id,name)
C. SELECT Lead.id, Lead. Name, Account.id, Account.Name, Contact.Id, Contact. Name FROM Lead, Account, Contact WHERE CompanyName = ‘Universal Containers’
D. SELECT lead(id, name), account(id, name), contact(id,name) FROM Lead, Account, Contact WHERE Name = ‘Universal Containers’
B
What should a developer use to implement an automate approval process submission for case?
A. Process builder.
B. A workflow rules.
C. An assignment rules.
D. Scheduled apex.
A
From which 2 locations can a developer determine the overall code coverage for a sandbox?
A. The apex classes setup page
B. The test suite run panel of the developer console
C. The tests tab of the developer console
D. The apex test execution page
A, C
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?
A. 10
B. 4
C. 8
D. 2
C
When can a developer use a custom Visualforce page in a Force.com application? (Choose 2)
A. To generate a PDF document with application data
B. To modify the page layout settings for a custom object
C. To create components for dashboards and layouts
D. To deploy components between two organizations
A, C
Which two are best practices when it comes to component and application event handling? (Choose two.)
A. Use component events to communicate actions that should be handled at the application level.
B. Try to use application events as opposed to component events.
C. Handle low-level events in the event handler and re-fire them as higher-level events.
D. Reuse the event logic in a component bundle, by putting the logic in the helper.
C, D
Which statement about change set deployments is accurate? (Choose 3)
A. They require a deployment connection.
B. They ca be used to transfer Contact records.
C. They use an all or none deployment model.
D. They can be used only between related organizations.
E. They can be used to deploy custom settings data.
A, C, D
A candidate may apply to multiple jobs at the company Universal Containers by submtting a single application per job posting. Once an application is submitted for a job posting, that application cannot be modified to be resubmitted to a different job posting.What can the administrator do to associate an application with each job posting in the schema for the organization?
A. Create a lookup relationship on both objects to a junction object called Job Posting Applications.
B. Create a master-detail relationship in the Application custom object to the Job Postings custom object.
C. Create a master-detail relationship in the Job Postings custom object to the Applications custom object.
D. Create a lookup relationship in the Applications custom object to the Job Postings custom object
B
What is a benefit of using an after insert trigger over using a before insert trigger?
A. An after insert trigger allows a developer to bypass validation rules when updating fields on the new record.
B. An after insert trigger allows a developer to make a callout to an external service.
C. An after insert trigger allows a developer to insert other objects that reference the new record.
D. An after insert trigger allows a developer to modify fields in the new record without a query.
C
A developer has a VF 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?
A. Include on the Visualforce page.
B. Add custom controller attributes to display the message.
C. Use a try/catch with a custom exception class.
D. Perform the DML using the Database.upsert() method
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_message.htm
A
Which statement generates a list of Leads and Contacts that have a field with the phrase ‘ACME’?
A. Map searchList = (FIND “ACME” IN ALL FIELDS RETURNING Contact, Lead);
B. List> searchList = (FIND “ACME” IN ALL FIELDS RETURNING Contact, Lead);
C. List> searchList = (SELECT Name, ID FROM Contact, Lead WHERE Name like ‘%ACME%’);
D. List searchList = (FIND “ACME” IN ALL FIELDS RETURNING Contact, Lead);
B
Universal Containers (UC) decided it will not to send emails to support personnel directly from Salesforce in the event that an unhandled exception occurs. Instead, UC wants an external system be notified of the error. What is the appropriate publish/subscribe logic to meet these requirements? A. Publish the error event using the addError() method and write a trigger to subscribe to the event and notify the external system.
B. Have the external system subscribe to the BatchApexError event, no publishing is necessary.
C. Publish the error event using the addError() method and have the external system subscribe to the event using CometD.
D. Publish the error event using the Eventbus.publish() method and have the external system subscribe to the event using CometD.
D
Which two statement can a developer use to throw a custom exception of type MissingFieldValueException?Choose 2 answers A. Throw Exception(new MissingFieldValueException());
B. Throw new MissingFieldValueException(‘Problem occurred’);
C. Throw (MissingFieldValueException,’Problem occurred’);
D. Throw new MissingFieldValueException();
B, D
Which three statements are true regarding cross-object formulas? Choose 3 answers
A. Cross-object formulas can reference fields from master-detail or lookup relantionships
B. Cross-object formulas can be referenced in roll-up summary field
C. Cross-object formulas can reference child fields to perform an average
D. Cross-object formulas can expose data the user does not have access to in a record
E. Cross-object formulas can reference fields from objects that are up to 10 relantionship away
A, D, E
Which two number expressions evaluate correctly? (Choose two.)
A. Double d = 3.14159;
B. Decimal d = 3.14159;
C. Long l = 3.14159;
D. Integer I = 3.14159;
A, B
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?
A. By changing Application_c.Status_c into a formula field.
B. By changing Application_c.Status_c into a roll -up summary field.
C. By using an Apex trigger with a DML operation.
D. By configuring a cross-object field update with a workflow.
C
What are two considerations for custom Apex Exception classes? Choose 2 answers.
A. Constructor for custom Exceptions can only accept string values as arguments.
B. Custom Exception class names must end with the word ‘Exception’.
C. Custom Exceptions cannot be extended by other Exception classes.
D. Custom Exception classes must extend the base Exception class.
B, D
A developer of Universal Containers is tasked with implementing a new Salesforce application that must be able to by their company’s Salesforce administrator.
Which three should be considered for building out the business logic layer of the application? Choose 3 answers
A. Workflows
B. Invocable Actions
C. validation Rules
D. Process Builder
E. Scheduled Jobs
A, C, D
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? A. Publicstatic void setBusinessUnitToEMEA(List contacts){ for(Contact thisContact : contacts){ thisContact.Business_Unit\_\_c = 'EMEA' ; update contacts[0]; } }
B. Public static void setBusinessUnitToEMEA(List contacts){ for(ContactthisContact : contacts) { thisContact.Business_Unit\_\_c = 'EMEA' ; } update contacts; }
C. Public static void setBusinessUnitToEMEA(Contact thisContact){ List contacts = new List(); contacts.add(thisContact.Business_Unit\_\_c ='EMEA'); update contacts; }
D. Public void setBusinessUnitToEMEA(List contatcs){
contacts[0].Business_Unit__c = ‘EMEA’ ;
update contacts[0];
}
B
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?
A. Line Items has a Master-Detail field to Order and the Master can be re-parented.
B. Order has a Lookup field to Line Item and there can be many Line Items per Order.
C. Order has a Master-Detail field to Line Item and there can be many Line Items per Order.
D. Line Item has a Lookup field to Order and there can be many Line Items per Order
A
Which tag should a developer include when styling from external CSS is required in a Visualforce page?
A. Apex : includeStyle
B. Apex : includeScript
C. Apex : require
D. Apex : stylesheet
D
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?
A. The Invoice should have a Master-Detail relationship to the Account
B. The Account should have a Lookup relationship to the Invoice
C. The Invoice should have a Lookup relationship to the Account Previous
D. The Account should have a Master-Detail relationship to the Invoice.
A
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?
A. Add a getter method for the actType attribute.
B. Change theAccount attribute to public.
C. Convert theAccount.Type to a String.
D. Add with sharing to the custom controller.
A
On which object can an administrator create a roll-up summary field?
A. Any object that is on the master side of a master-detail relationship.
B. Any object that is on the parent side of a lookup relationship.
C. Any object that is on the child side of a lookup relationship.
D. Any object that is on the detail side of a master-detail relationship.
A
How can a developer check the test coverage of active Process Builder and Flows deploying them in a Changing Set?
A. Use the Apex testresult class
B. Use the Flow properties page.
C. Use SOQL and the Tooling API
D. Use the code Coverage Setup page
C
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?
A. Process builder
B. Validation rule
C. Workflow rule
D. Formula field
B
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?
A. Roll-up Summary Field
B. Formula Field
C. Quick Action
D. Workflow Rule
B
Universal Containers recently transitioned from Classic to Lighting Experience. One of its business processes requires certain value from the opportunity object to be sent via HTTP REST callout to its external order management system based on a user-initiated action on the opportunity page. Example values are as follow Name Amount Account Which two methods should the developer implement to fulfill the business requirement? (Choose 2 answers)
A. Create a Lightning component that performs the HTTP REST callout, and use a Lightning Action to expose the component on the Opportunity detail page.
B. Create a Process Builder on the Opportunity object that executes an Apex immediate action to perform the HTTP REST callout whenever the Opportunity is updated.
C. Create an after update trigger on the Opportunity object that calls a helper method using @Future(Callout=true) to perform the HTTP REST callout.
D. Create a Visualforce page that performs the HTTP REST callout, and use a Visualforce quick action to expose the component on the Opportunity detail page.
A, C
Which two events need to happen when deploying to a production org? Choose 2 answers
A. All test and triggers must have at least 75% test coverage combined
B. All Apex code must have at least 75% test coverage.
C. All triggers must have at least 1% test coverage.
D. All triggers must have at least 75% test coverage.
B, C
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?
A. Developer Console
B. AppExchange
C. Visual Studio Core IDE
D. Salesforce CLI
A
How should a custom user interface be provided when a user edits an Account in Lightning Experience?
A. Override the Account’s Edit button with Lightning page.
B. Override the Account’s Edit button with Lightning Flow
C. Overridethe Account’s Edit button with Lightning Action
D. Override the Account’s Edit button with Lightning component.
D
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. i, J Calculator How can the developer find the current user’s default record type? ns
A. Query the Profile where the ID equals userInfo.getProfileID() and then use the profile.Opportunity.getDefaultRecordType() | | method. ] |
B. o Use Opportunity. SObjectType.getDescribe().getRecordTypelnfos() to get a list of record types, and iterate through them until [ J isDefaultRecordTypeMapping() is true. Pencil & Paper |
C. Use the Schema.userlnfo.Opportunity.getDefaultRecordType() method. < Create the opportunity and check the opportunity.recordType before inserting, which will have the record ID of the current Dal
B
What is the result of the debug statements in testMethod3 when you create test data using testSetup in below code?
@isTest private class CreateAndExecuteTest { @TestSetup static void setup(){ //Create 2 test accounts List testAccts = new List(); for(Integer i=0; i<2; i++) { testAcccts.add(newAccount(Name= 'MyTestAccount'+i, Phone='333-878')); } insert testAccts; }
@isTest static void testMethod1() { Account acc = [SELECT Id, Phone FROM Account WHERE Name='MyTestAccount0' LIMIT 1]; acc.Phone = '888-1515'; update acc; Account acc2 = [SELECT Id, Phone FROM Account WHERE Name='MyTestAccount1' LIMIT 1]; acc2.Phone = '999-1515'; update acc2; }
@isTest static void testMethod2() { Account acc = [SELECT Id, Phone FROM Account WHERE Name='MyTestAccount1' LIMIT 1]; acc.Phone = '888-2525'; update acc; }
@isTest static void testMethod3() { Account acc0 = [SELECT Id, Phone FROM Account WHERE Name='MyTestAccount0' LIMIT 1]; Account acc1 = [SELECT Id, Phone FROM Account WHERE Name='MyTestAccount1' LIMIT 1]; System.debug('Account0.Phone=' + acc0.Phone + ', Account1.Phone=' + acc1.Phone); }
}
A. Account0.Phone=888-1515, Account1.Phone=999-2525
B. Account0.Phone=333-8781, Account1.Phone=333-8780
C. Account0.Phone=888-1515, Account1.Phone=999-1515
D. Account0.Phone=333-8780, Account1.Phone=333-8781
D
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?
// Option A public abstract class ShippingCalculator { public abstract calculate() { /*implementation*/ } }
// Option B public abstract class ShippingCalculator { public virtual void calculate() { /*implementation*/ } }
// Option C public abstract class ShippingCalculator { public void calculate() { /*implementation*/ } }
// Option D public abstract class ShippingCalculator { public override calculate() { /*implementation*/ } }
A. Option D
B. Option A
C. Option C
D. Option B
D
Given the code below, what can be done so that recordcount can be accessed by a test class, but not by a non-test class? Public class mycontroller{ private integer recordcount; } A. Change recordcount from private to public
B. Add a seealldata annotation to the test class
C. Add the testvisible annotation to recordcount
D. Add the testvisible annotation to the mycontroller class
C
A developer created a helper class with a method that can be called from Visualforce pages, web services, triggers, and of even anonymous code. When the method is called from a trigger, the developer needs to execute logic that should not be executed If the method Is called from anywhere else. How can the developer determine if the code Is executed in a trigger context? A. Use the executeOnTrigger annotation on the method definition.
B. Check if Trigger.newMap !=null.
C. Check if System.executionContext ==’Trigger’.
D. Check if Trigger.isExecuting ==true
D
A developer needs to know if all tests currently pass in a Salesforce environment. Which feature can the developer use? (Choose 2)
A. Developer Console
B. ANT Migration Tool
C. Salesforce UI Apex Test Execution
D. Workbench Metadata Retrieval
A, C
Which code displays the contents of a Visualforce page as a PDF?
A.
B.
C.
D.
D
Which two automation tools include a graphical designer? Choose 2 answers
A. Flow builder
B. Approvals
C. Process builder
D. Workflows
B, C
What are two correct examples of the model in the salesforce MVC architecture? Choose 2 answers.
A. Workflow rule on the contact object
B. Standard account lookup on the contract object
C. Standard lightning component
D. Custom field on the custom wizard_c object
A, C
How many levels of child records can be returned in a single SOQL query from one parent object?
A. 5
B. 1
C. 7
D. 3
B
A developer created a visualforce page using a custom controller that calls an apex helper class. A method in the helper class hits a governor limit. what is the result of the transaction? A. All changes in the transaction are rolled back
B. The custom controller calls the helper class method ag
C. The helper class creates a savepoint and continues
D. All changes made by the custom controller are saved
D
How can a developer get all of the available record types for the current user on the case object?
A. Use SOQL to get all cases
B. Use describesobjectresult of the case object
C. Use describefieldresult of the case.recordtype field
D. Use case.getrecordtypes()
C
A developer wants to retrieve the Contacts and Users with the email address ‘dev@uc.com’.
Which SOSL statement should the developer use?
A. FIND Email IN Contact, User FOR {dev2uc.com}
B. FIND {Email = ‘dev@uc.com’} IN Contact, User
C. FIND {Email = ‘dev@uc.com’} RETURNING Contact (Email), User (Email)
D. FIND {dev@uc.com} IN Email Fields RETURNING Contact (Email), User (Email)
D
A developer wants to get access to the standard price book in the org while writing a test class that covers an OpportunityLineItem trigger. Which method allows access to the price book? A. Use Test.loadData ( )and a static resource to load a standard price book
B. Use Test,getStandardPricebookid ( ) to get the standard price book ID.
C. Use @TestVisible to allow the test method to see the standard price book.
D. Use @IsTest (SeeAllData=True) and delete the existing standard price book
B
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?
// Option A @wire(getAccounts, { searchTerm: '$searchTerm' }) accountList;
// Option B
@AuraEnabled(getAccounts, ‘$searchTerm’ )
accountList;
// Option C @AuraEnabled(getAccounts, { searchTerm: '$searchTerm' }) accountList;
// Option D
@wire(getAccounts, ‘$searchTerm’ )
accountList;
A. Option A
B. Option C
C. Option D
D. Option B
A
What declarative method helps ensure quality data? Choose 3 answers
A. Workflow alerts
B. Validation rules
C. Lookup filters
D. Page layouts
E. Exception handling
B, C, D
How can a developer check the test coverage of active Process Builder and Flows deploying them in a Changing Set?
A. Use the Flow properties page.
B. Use SOQL and the Tooling API
C. Use the Apex testresult class
D. Use the code Coverage Setup page
B
Assuming that ‘name; is a String obtained by an tag on a Visualforce page. Which two SOQL queries performed are safe from SOQL injections? Choose 2 answers
A. String query = ‘SELECT Id FROM Account WHERE Name LIKE '’%’ + name.noQuotes() + ‘%'’; List results = Database.query(query);
B. String query = ‘SELECT Id FROM Account WHERE Name LIKE '’%’ + String.escapeSingleQuotes(name) + ‘%'’; List results = Database.query(query);
C. String query = ‘SELECT Id FROM Account WHERE Name LIKE '’%’ + name + ‘%'’; List results = Database.query(query);
D. String query = ‘%’ + name + ‘%’; List results = [SELECT Id FROM Account WHERE Name LIKE :query];
B, D
For which three items can a trace flag be configured?
Choose 3 answers
A. Apex Trigger
B. Process Builder
C. User
D. Apex Class
E. Visualforce
A, C, D
Where can debug log filter settings be set?Choose 2 answers
A. The Show More link on the debug log’s record.
B. The Filters link by the monitored user’s name within the web UI.
C. The Log Filters tab on a class or trigger detail page.
D. On the monitored user’s name.
B, C
Which three resources in an Azure Component can contain JavaScript functions? (Choose 3 answers)
A. Style
B. Design
C. Controllers
D. helper
E. Renderer
C, D, E
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?
A. Use a DAYS formula on each of the availability date fields and a COUNT Roll-Up Summary field on the Order.
B. Use a CEILING formula on each of the Latest availability date fields.
C. Use a Max Roll-Up Summary field on the Latest availability date fields.
D. Use a LATEST formula on each of the latest availability date fields.
C
What does the Lightning Component framework provide to developers?
A. Support for Classic and Lightning UIS.
B. Extended governor limits for applications
C. Prebuilt component that can be reused.
D. Templates to create custom components.
C
A developer wants multiple test classes to use the same set of test data. How should the developer create the test data? A. Reference a test utility class in each test class
B. Use the seealldata=true annotation in each test class
C. Create a test setup method for each test class
D. Define a variable for test records in each test classes
B
In which order does SalesForce execute events upon saving a record?
A. Before Triggers; Validation Rules; After Triggers; Assignment Rules; Workflow Rules; Commit
B. Validation Rules; Before Triggers; After Triggers; Workflow Rules; Assignment Rules; Commit
C. Before Triggers; Validation Rules; After Triggers; Workflow Rules; Assignment Rules; Commit
D. Validation Rules; Before Triggers; After Triggers; Assignment Rules; Workflow Rules; Commit
A
Given the following code snippet, that is part of a custom controller for a Visualforce page:
public void updateContact(Contact thisContact) {
thisContact.Is_Active__c = false;
try {
update thisContact;
} catch (Exception e) {
String errorMessage = ‘An error occurred while updating the Contact. ‘ + e.getMessage();
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.FATAL, errorMessage));
}
}
In which two ways can the try/catch be enclosed to enforce object and field-level permissions and prevent the DML statement from being executed if the current logged-in user does not have the appropriate level of access? Choose 2 answers
A. Use if (Schema.sObjectType.Contact.isAccessible ( ) )
B. Use if (thisContact.Owner = = UserInfo.getuserId ( ) )
C. Use if (Schema, sobjectType, Contact, isUpdatable ( ) )
D. Use if (Schema , sobjectType. Contact. Field, Is_Active_c. is Updateable ( ) )
C, D
hat are the supported content sources for custom buttons and links? (Choose 2 Answers)
A. Static Resource.
B. Lightning Page.
C. Chatter File.
D. VisualForce Page.
E. URL.
D, E
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
A. Hardcore the ID as a constant in an apex class
B. Make an outbound web services call to the SOAP API
C. Use the getrecordtypeinfosbydevelopername() method in the describesobjectresult class
D. Execute a SOQL query on the recordtype object
C, D
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?
A. Indirect lookup
B. Master Detail
C. Lookup
D. Direct Lookup
B
Which two practices should be used for processing records in a trigger? Choose 2 answers
A. Use @future methods to handle DML operations.
B. Use a Map to reduce the number of SOQL calls
C. Use (callout=true) to update an external system
D. Use a Set to ensure unique values in a query filter
B, D
The Review__c object has a lookup relationship up to the Job_Application__c object. The Job_Application__c object has a master-detail relationship up the Position__c object. The relationship field names are based on the auto-populated defaults. What is the recommended way to display field data from the related Review__c records on a Visualforce page for a single Position__c record?
A. Utilize the Standard Controller for position__c and expression syntax in the page to display related Review__c data through the job_Application__c object
B. Utilize the Standard Controller for Position__c and cross-object Formula fields on the job_Application__c object to display Review__c data.
C. Utilize the Standard Controller for position__c and a Controller Extension to query for Review__c data.
D. Utilize the Standard Controller for Position__c and cross-object Formula fields on the Review__c object to display Review__c data.
C
What is the data type returned by the following SOSL search? {FIND ‘Acme*’ in name fields returning account,opportunity};
A. List>
B. Map
C. Map
D. List,List
A
Universal Container(UC) wants to lower its shipping cost while making the shipping process more efficient. The Distribution Officer advises UC to implement global addresses to allow multiple Accounts to share a default pickup address. The Developer is tasked to create the supporting object and relationship for this business requirement and uses the Setup Menu to create a custom object called "Global Address". Which field should the developer ad to create the most efficient model that supports the business need? A. Add a Lookup field on the Account object to the Global Address object.
B. Add a Lookup field on the Global Address object to the Account object
C. Add a Master-Detail field on the Global Address object to the Account object.
D. Add a Master-Detail field on the Account object to the Global Address object
A
What is the easiest way to verify a user before showing them sensitive content?
A. Sending the user an Email message with a passcode.
B. Sending the user a SMS message with a passcode.
C. Calling the generateVerificationUrl method in apex.
D. Calling the Session.forcedLoginUrl method in apex.
C
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? A. Set the second insert method parameter to TRUE
B. Add a try/catch around the insert method
C. Collect the insert method return value a Saveresult record
D. Add a System.debug() statement before the insert method
C
A developer wants to retrieve the Contacts and Users with the email address ‘dev@uc.com’. Which SOSL statement should the developer use?
A. FIND {dev@uc.com} IN Email Fields RETURNING Contact (Email), User (Email)
B. FIND {Email = ‘dev@uc.com’} RETURNING Contact (Email), User (Email)
C. FIND {Email = ‘dev@uc.com’} IN Contact, User
D. FIND Email IN Contact, User FOR {dev2uc.com}
A
Refer to the following code that runs in an Execute Anonymous block:
for (List theseLeads : [SELECT LastName, Company, Email FROM Lead LIMIT 20000]) { for (Lead thisLead : theseLeads) { if (thisLead.Email == null) { thisLead.Email = assignGenericEmail(thisLead.LastName, thisLead.Company); } } Database.update(theseLeads, false); }
A. The total numberof DML statements will be exceeded.
B. In an environment where the full result set is returned, what is a possible outcome of this code?
C. The total number of records processed as a result of DML statements will be exceeded
D. The total number of records processed as a result of DML statements will be exceeded.
E. The transaction will succeed and the first ten thousand records will be committed to the database.
C
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?
A. Lightning
B. Lightning Component
C. Apex trigger
D. Process Builder
D
Which data structure is returned to a developer when performing a SOSL search?
A. A list of lists of sObjects.
B. A list of sObjects.
C. A map of sObject types to a list oflists of sobjects
D. A map of sObject types to a list of sObjects
A
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?
A. An unhandled exception is thrown and the code terminates.
B. The first Account returned is assigned to myAccount.
C. The query fails and an error is written to the debug log.
D. The variable, myAccount, is automatically cast to the List data type.
A
Which scenario is valid for execution by unit tests?
A. Generate a Visualforce PDF with geccontentAsPDF ().
B. Load data from a remote site with a callout.
5. Set the created date of a record using a system method.
Cc: Execute anonymous Apex as a different user.
A
An Account trigger updates all related Contacts and Cases each time an Account is saved using the following two DML statements:
update allContacts; update allCases;
What is the result if the Case update exceeds the governor limit for maximum number of DML records?
A. The Account save fails and no Contacts or Cases are updated
B. The Account save is retried using a smaller trigger batch size.
C. The Account save succeeds, Contacts are updated, but Cases are not.
D. The Account save succeeds and no Contacts or Cases are updated
A
A developer identifies the following triggers on the Expense_c object:
* DeleteExpense,
* applyDefaultstoexpense
* validateexpenseupdate;
The triggers process before delete, before insert, and before update events respectively.
Which two techniques should the developer implement to ensure trigger best practice are followed?
A. Unify all three triggers in a single trigger on the Expense__c object that includes all events.
B. Maintain all three triggers on the Expense__c object, but move the Apex logic out for the trigger definition.
C. Create helper classes to execute the appropriate logic when a record is saved. (Missed)
D. Unify the before insert and before update triggers and use Process Builder for the delete action.
B, C
Universal Containers implemented a private sharing model for the Account object. A custom Account search tool was developed with Apex to help sales representatives find accounts that match multiple criteria they specify. Since its release, users of the tool report they can see Accounts they do not own. What should the developer use to enforce sharing permission for the currently logged-in user while using the custom search tool? A. Use the UserInfo Apex class to filter all SOQL queries to returned records owned by the logged-in user.
B. Use the schema describe calls to determine if the logged-in users has access to the Account object.
C. Use the with sharing keyword on the class declaration.
D. Use the without sharing keyword on the class declaration.
B
When the value of a field of an account record is updated, which method will update the value of a custom field opportunity? Choose 2 answers.
A. A process builder on the Account object
B. A workflow rule on the Account object
C. A cross-object formula field on the Account object
D. An Apex trigger on the Account object.
A, D
What are two benefits of using declarative customizations over code? Choose 2 answers What are two benefits of using declarative customizations over code?
A. Declarative customizations automatically update with each Salesforce release.
B. Declarative customizations automatically generate test classes.
C. Declarative customizations automatically generate test classes.
D. Declarative customizations generally require less maintenance.
A, C
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?
A. SELECT Id, (SELECT Id FROM Trainer_c) FROM Gym_c WHERE Name - Viridian City Gym’
B. SELECT Id, (SELECT Id FROM Trainers__r) FROM Gym_C WHERE Name . Viridian City Gym’
C. SELECT Id, (SELECT Id FROM Trainers) FROM Gym_C WHERE Name - Viridian City Gym’
D. SELECT ID FROM Trainer_c WHERE Gym__r.Name - Viridian City Gym’
B
A developer is asked to write negative tests as part of the unit testing for a method that calculates a person’s age based on birth date. What should the negative tests include?
A. Assert that past dates are accepted by the method.
B. Throwing a custom exception in the unit test.
C. Assert that future dates are rejected by the method.
D. Assert that a null value is accepted by the method.
C
A developer has the following code:try {List nameList;Account a;String s = a.Name;nameList.add(s);} catch (ListException le ) {System.debug(‘ List Exception ‘);} catch (NullPointerException npe) {System.debug(‘ NullPointer Exception ‘);} catch (Exception e) {System.debug(‘ Generic Exception ‘);} What message will be logged?
A. List Exception
B. NullPointer Exception
C. No message is logged
D. Generic Exception
B
A developer has the controller class below.
public with sharing class myFooController { public Integer prop { get; private set; } }
Which code block will run successfully in an execute anonymous window? A. myFooController m = new myFooController();System.assert(m.prop ==1);
B. myFooController m = new myFooController();System.assert(m.prop !=null);
C. myFooController m = new myFooController();System.assert(m.prop ==0);
D. myFooController m = new myFooController();System.assert(m.prop ==null);
D
How are debug levels adjusted In the Developer Console?
A. Under the Edit menu, dick Change DebugLevels
B. Under the Logs tab, click Change in the DebugLevels panel
C. Under the Settings menu > Trace Settings…, click Change DebugLevel
D. Under the Debug menu > Change Log Levels…, click Add/Change in the DebugLevel Action column
D
What are two considerations for deciding to use a roll-up summary field? Choose 2 answer’s partner.
A. Roll-up cannot be performed on formula fields that use cross-object references or on-the-fly calculations such as NOW().
B. Roll-up cannot be performed on formula fields.
C. Roll-up summary can be performed on formula fields, but if their formula contains an #Error result, it may affect the summary value.
D. Roll-up summary fields do not cause validation rules on the parent object unless that object is edited separately.
A, C
Refer to the following Apex code:
Integer x = 0;
do { x = 1; x++; } while (x < 1) { System.debug(x); }
What is the value of x when it is written to the debug log?
A. 0
B. 2
C. 1
D. 3
B