Salesforce CRT-450 : Salesforce Certified Platform Developer I Part 4
Question #: 121
Topic #: 1
What are three techniques that a developer can use to invoke an anonymous block of code? (Choose three.)
- Use the SOAP API to make a call to execute anonymous code.
B. Create a Visualforce page that uses a controller class that is declared without sharing.
C. Run code using the Anonymous Apex feature of the Developer’s IDE.
D. Type code into the Developer Console and execute it directly.
E. Create and execute a test method that does not specify a runAs() call.
Selected Answer: ACD
Question #: 122
Topic #: 1
An after trigger on the Account object performs a DML update operation on all of the child Opportunities of an Account. There are no active triggers on the
Opportunity object, yet a `maximum trigger depth exceeded` error occurs in certain situations.
Which two reasons possibly explain the Account trigger firing recursively? (Choose two.)
- Changes to Opportunities are causing cross-object workflow field updates to be made on the Account.
B. Changes to Opportunities are causing roll-up summary fields to update on the Account.
C. Changes are being made to the Account during an unrelated parallel save operation.
D. Changes are being made to the Account during Criteria Based Sharing evaluation.
Selected Answer: AB
Question #: 123
Topic #: 1
Which statement is true about developing in a multi-tenant environment?
- Apex Sharing controls access to records from multiple tenants on the same instance.
B. Org-level data security controls which users can see data from multiple tenants on the same instance.
C. Governor limits prevent Apex from impacting the performance of multiple tenants on the same instance.
D. Global Apex classes can be referenced from multiple tenants on the same instance.
Selected Answer: C
Question #: 124
Topic #: 1
A developer needs an Apex method that can process Account or Contact records.
Which method signature should the developer use?
- public void doWork(Account | | Contact)
B. public void doWork(Record theRecord)
C. public void doWork(Account Contact)
D. public void doWork(sObject theRecord)
Selected Answer: A
Question #: 125
Topic #: 1
A developer needs to update an unrelated object when a record gets saved.
Which two trigger types should the developer create? (Choose two.)
- after insert
B. before update
C. before insert
D. after update
Selected Answer: BC
Question #: 126
Topic #: 1
Which three statements are true regarding trace flags? (Choose three.)
- Setting trace flags automatically cause debug logs to be generated.
B. Logging levels override trace flags.
C. Trace flags override logging levels.
D. If active trace flags are not set, Apex tests execute with default logging levels.
E. Trace flags can be set in the Developer Console, Setup, or using the Tooling API.
Selected Answer: CDE
Question #: 127
Topic #: 1
Which two conditions cause workflow rules to fire? (Choose two.)
- An Apex Batch process that changes field values.
B. Updating records using the bulk API
C. Converting leads to person accounts
D. Changing the territory assignments of accounts and opportunities
Selected Answer: AB
Question #: 128
Topic #: 1
A Licensed_Professional__c custom object exists in the system with two Master-Detail fields for the following objects: Certification__c and Contact.
Users with the `Certification Representative` role can access the Certification records they own and view the related Licensed Professionals records, however users with the `Sales Representative` role report they cannot view any Licensed Professional records even though they own the associated Contact record.
What are two likely causes of users in the `Sales Representative` role not being able to access the Licensed Professional records? (Choose two.)
- The organization has a private sharing model for Certification__c. and Certification__c is the primary relationship in the Licensed_Professional__c object.
B. The organization’s sharing rules for Licensed_Professional__c have not finished their recalculation process.
C. The organization recently modified the Sales Representative role to restrict Read/Write access to Licensed_Professional__c.
D. The organization has a private sharing model for Certification__c, and Contact is the primary relationship in the Licensed_Professional__c object.
Selected Answer: D
Question #: 129
Topic #: 1
A developer has an integer variable called maxAttempts. The developer needs to ensure that once maxAttempts is initialized, it preserves its value for the length 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?
- Declare maxAttempts as a private static variable on a helper class.
B. Declare maxAttempts as a variable on a helper class.
C. Declare maxAttempts as a member variable on the trigger definition.
D. Declare maxAttempts as a constant using the static and final keywords.
Selected Answer: D
Question #: 130
Topic #: 1
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?
- Data Loader runs from the developer’s browser.
B. Data Loader automatically relates Opportunities to Accounts.
C. Data Import Wizard does not support Opportunities.
D. Data Import Wizard can not import all 500 records.
Selected Answer: C
Question #: 131
Topic #: 1
Which Salesforce feature allows a developer to see when a user last logged in to Salesforce if real-time notification is not required?
- Event Monitoring Log
B. Calendar Events
C. Developer Log
D. Asynchronous Data Capture Events
Selected Answer: A
Question #: 132
Topic #: 1
Which three process automations can immediately send an email notification to the owner of an Opportunity when its Amount is changed to be greater than
$10,000? (Choose three.)
- Process Builder
B. Escalation Rule
C. Flow Builder
D. Approval Process
E. Workflow Rule
Selected Answer: ACE
Question #: 133
Topic #: 1
Application Events follow the traditional publish-subscribe model.
Which method is used to fire an event?
- registerEvent()
B. fireEvent()
C. emit()
D. fire()
Selected Answer: D
Question #: 134
Topic #: 1
Cloud Kicks Fitness, an ISV Salesforce partner, is developing a managed package application. One of the application modules allows the user to calculate body fat using the Apex class, BodyFat, and its method, calculateBodyFat(). The product owner wants to ensure this method is accessible by the consumer of the application when developing customizations outside the ISV’s package namespace.
Which approach should a developer take to ensure calculateBodyFat() is accessible outside the package namespace?
- Declare the class and method using the public access modifier.
B. Declare the class as global and use the public access modifier on the method.
C. Declare the class as public and use the global access modifier on the method.
D. Declare the class and method using the global access modifier.
Selected Answer: D
Question #: 135
Topic #: 1
A developer has a Visualforce page and custom controller to save Account records. The developer wants to display any validation rule violations to the user.
How can the developer make sure that validation rule violations are displayed?
- Add custom controller attributes to display the message.
B. Use a try/catch with a custom exception class.
C. Include on the Visualforce page.
D. Perform the DML using the Database.upsert() method.
Selected Answer: C
Question #: 136
Topic #: 1
What are two ways for a developer to execute tests in an org? (Choose two.)
- Tooling API
B. Developer Console
C. Metadata API
D. Bulk API
Selected Answer: AB
Question #: 137
Topic #: 1
A developer identifies the following triggers on the Expense__c object: deteleExpense, 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 practices are followed? (Choose two.)
- Unify the before insert and before update triggers and use Process Builder for the delete action.
B. Create helper classes to execute the appropriate logic when a record is saved.
C. Maintain all three triggers on the Expense__c object, but move the Apex logic out of the trigger definition.
D. Unify all three triggers in a single trigger on the Expense__c object that includes all events.
Selected Answer: BD
Question #: 138
Topic #: 1
When using SalesforceDX, what does a developer need to enable to create and manage scratch orgs?
- Production
B. Environment Hub
C. Dev Hub
D. Sandbox
Selected Answer: C
Question #: 139
Topic #: 1
Which two are best practices when it comes to component and application event handling? (Choose two.)
- Reuse the event logic in a component bundle, by putting the logic in the helper.
B. Use component events to communicate actions that should be handled at the application level.
C. Handle low-level events in the event handler and re-fire them as higher-level events.
D. Try to use application events as opposed to component events.
Selected Answer: AC
Question #: 140
Topic #: 1
What is the maximum number of SOQL queries used by the following code?
- 1
B. 5
C. 6
D. 2
Selected Answer: B
Question #: 141
Topic #: 1
Which three steps allow a custom SVG to be included in a Lightning web component? (Choose three.)
- Upload the SVG as a static resource.
B. Reference the getter in the HTML template.
C. Import the SVG as a content asset file.
D. Import the static resource and provide a getter for it in JavaScript.
E. Reference the import in the HTML template.
Selected Answer: ACE
Question #: 142
Topic #: 1
What is the order of operations when a record is saved in Salesforce?
- workflow, process flows, triggers, commit
B. process flows, triggers, workflow, commit
C. triggers, workflow, process flows, commit
D. workflow, triggers, process flows, commit
Selected Answer: C
Question #: 143
Topic #: 1
The Job_Application__c custom object has a field that is a Master-Detail relationship to the Contact object, where the Contact object is the Master. As part of a feature implementation, a developer needs to retrieve a list containing all Contact records where the related Account Industry is `˜Technology’ while also retrieving the contact’s Job_Application__c records.
Based on the object’s relationships, what is the most efficient statement to retrieve the list of contacts?
- [SELECT Id, (SELECT Id FROM Job_Applications_r) FROM Contact WHERE Account.Industry = ‘Technology’];
B. [SELECT Id, (SELECT Id FROM Job_Applications_r) FROM Contact WHERE Accounts.Industry = ‘Technology’];
C. [SELECT Id, (SELECT Id FROM Job_Applications_c) FROM Contact WHERE Accounts.Industry = ‘Technology’];
D. [SELECT Id, (SELECT Id FROM Job_Application_c) FROM Contact WHERE Account.Industry = ‘Technology’];
Selected Answer: A
Question #: 144
Topic #: 1
A custom picklist field, Food_Preference__c, exists on a custom object. The picklist contains the following options: `˜Vegan’, `˜Kosher’, `˜No Preference’. The developer must ensure a value is populated every time a record is created or updated.
What is the most efficient way to ensure a value is selected every time a record is saved?
- Mark the field as Required on the field definition.
B. Set ג€Use the first value in the list as the default valueג€ as True.
C. Mark the field as Required on the object’s page layout.
D. Set a validation rule to enforce a value is selected.
Selected Answer: A
Question #: 145
Topic #: 1
A developer must create an Apex class, ContactController, that a Lightning component can use to search for Contact records. Users of the Lightning component should only be able to search for Contact records to which they have access.
Which two will restrict the records correctly? (Choose two.)
- public class ContactController
B. public with sharing class ContactController
C. public without sharing class ContactController
D. public inherited sharing class ContactController
Selected Answer: BD
Question #: 146
Topic #: 1
Which aspect of Apex programming is limited due to multitenancy?
- The number of methods in an Apex class
B. The number of records returned from database queries
C. The number of active Apex classes
D. The number of records processed in a loop
Selected Answer: B
Question #: 147
Topic #: 1
Which three statements are true regarding custom exceptions in Apex? (Choose three.)
- A custom exception class must extend the system Exception class.
B. A custom exception class can implement one or many interfaces.
C. A custom exception class cannot contain member variables or methods.
D. A custom exception class name must end with ג€Exceptionג€.
E. A custom exception class can extend other classes besides the Exception class.
Selected Answer: ABD
Question #: 148
Topic #: 1
What will be the output in the debug log in the event of a QueryException during a call to the aQuery method in the following example?
- Querying Accounts. Query Exception.
B. Querying Accounts. Custom Exception.
C. Querying Accounts. Custom Exception. Done.
D. Querying Accounts. Query Exception. Done.
Selected Answer: D
Question #: 149
Topic #: 1
When a user edits the Postal Code on an Account, a custom Account text field named `Timezone` must be updated based on the values in a
PostalCodeToTimezone__c custom object.
How should a developer implement this feature?
- Build an Account Workflow Rule.
B. Build an Account Assignment Rule.
C. Build an Account custom Trigger.
D. Build an Account Approval Process.
Selected Answer: A
Question #: 150
Topic #: 1
A developer must provide a custom user interface when users edit a Contact. Users must be able to use the interface in Salesforce Classic and Lightning
Experience.
What should the developer do to provide the custom user interface?
- Override the Contact’s Edit button with a Visualforce page in Salesforce Classic and a Lightning component in Lightning Experience.
B. Override the Contact’s Edit button with a Visualforce page in Salesforce Classic and a Lightning page in Lightning Experience.
C. Override the Contact’s Edit button with a Lightning component in Salesforce Classic and a Lightning component in Lightning Experience.
D. Override the Contact’s Edit button with a Lightning page in Salesforce Classic and a Visualforce page in Lightning Experience.
Selected Answer: D
Question #: 151
Topic #: 1
A developer is writing tests for a class and needs to insert records to validate functionality.
Which annotation method should be used to create records for every method in the test class?
- @StartTest
B. @PreTest
C. @TestSetup
D. @isTest(SeeAllData=true)
Selected Answer: C
Question #: 152
Topic #: 1
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?
- The variable, myAccount, is automatically cast to the List data type.
B. The first Account returned is assigned to myAccount.
C. The query fails and an error is written to the debug log.
D. An unhandled exception is thrown and the code terminates.
Selected Answer: D
Question #: 153
Topic #: 1
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 discussions, the UC administrator tried to change the Master-Detail relationship to a Lookup relationship but was not able to do so.
What is a possible reason that this change was not permitted?
- The Vendor records have existing values in the Account object.
B. The Account object is included on a workflow on the Vendor object.
C. The Account records contain Vendor roll-up summary fields.
D. The Vendor object must use a Master-Detail field for reporting.
Selected Answer: C
Question #: 154
Topic #: 1
Universal Containers wants a list button to display a Visualforce page that allows users to edit multiple records.
Which Visualforce feature supports this requirement?
- tag
B. recordSetVar page attribute
C. custom controller
D. controller extension
Selected Answer: B
Question #: 155
Topic #: 1
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?
- 1
B. 3
C. 4
D. 2
Selected Answer: D
Question #: 156
Topic #: 1
A developer is debugging the following code to determine 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?
- Add a System.debug() statement before the insert method.
B. Collect the insert method return value in a SaveResult record.
C. Set the second insert method parameter to TRUE.
D. Add a try/catch around the insert method.
Selected Answer: B
Question #: 157
Topic #: 1
A 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 exists?
- The deployment fails because no assertions were made in the test method.
B. The deployment passes because both classes and the trigger were included in the deployment.
C. The deployment passes because the Apex code has required (>75%) code coverage.
D. The deployment fails because the Apex trigger has no code coverage.
Selected Answer: D
Question #: 158
Topic #: 1
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 permissions for the currently logged-in user while using the custom search tool?
- Use the schema describe calls to determine if the logged-in user has access to the Account object.
B. Use the UserInfo Apex class to filter all SOQL queries to returned records owned by the logged-in user.
C. Use the with sharing keyword on the class declaration.
D. Use the without sharing keyword on the class declaration.
Selected Answer: C
Question #: 159
Topic #: 1
How should a developer write unit tests for a private method in an Apex class?
- Add a test method in the Apex class.
B. Mark the Apex class as global.
C. Use the SeeAllData annotation.
D. Use the TestVisible annotation.
Selected Answer: C
Question #: 160
Topic #: 1
An Approval Process is defined in the Expense_Item__c object. A business rule dictates that whenever a user changes the Status to `˜Submitted’ on an
Expense_Report__c record, all the Expense_Item__c records related to the expense report must enter the approval process individually.
Which approach should be used to ensure the business requirement is met?
- Create a Process Builder on Expense_Report__c with an ‘Apex’ action type to submit all related Expense_Item__c records when the criteria is met.
B. Create a Process Builder on Expense_Report__c to mark the related Expense_Item__c as submittable and a trigger on Expense_Item__c to submit the records for approval.
C. Create two Process Builders, one on Expense_Report__c to mark the related Expense_Item__c as submittable and the second on Expense_Item__c to submit the records for approval.
D. Create a Process Builder on Expense_Report__c with a ‘Submit for Approval’ action type to submit all related Expense_Item__c records when the criteria are met.
Selected Answer: C