Set 3 Flashcards
(254 cards)
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