Font size
WorksheetsPDI Training
Total questions: 120
Worksheet time: 30hrs 0mins
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?
@AuraEnabled(getAccounts, (searchTerm: '$searchTerm' ))
accountList;
@wire(getAccounts, '$searchTerm')
accountList;
@AuraEnabled(getAccounts, '$searchTerm')
accountList;
@wire(getAccounts, ( searchTerm: '$searchTerm' ))
accountList;
Application Events follow the tradition publish-subscribe model which method is used to fire an event?
fire()
registerEvent()
Emit()
FireEvent()
Cloud Kick 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, body fat, 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 global access modifier.
Declare the class as public and use the global access modifier on the method.
Declare the class and method using the public access modifier.
Declare the class as global and use the public access modifier on the method.
A developer at Universal Containers is tasked with implementing a new salesforce application that will be maintained completely by their company’s salesforce administrator.
Which three options should be considered for building the business logic of the application?
Choose 3 answers.
Scheduled jobs
Process builder
Flow builder
Invocable actions
Validation Rules
A developer created a visualforce page and custom controller to display the account type field as shown below.
Custom Controller code:
public with sharing 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 properly referenced on the visual force page,
what should the developer do to correct the problem?
Add with sharing to the custom controller.
Convert theAccount.Type to a string.
Change theAccount attribute to public.
Add a getter method for the actType attribute.
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.
Declare maxAttempts as a member variable on the trigger definition.
Declare maxAttempts as a variable on a helper class.
Declare maxAttempts as a constant using the static and final keywords.
Declare maxAttempts as a private static variable on a helper class.
A developer has a single custom controller class that works with a visualforce wizard to support creating and editing multiple sObjects. The wizard accepts data from the user inputs, multiple visual force pages and from a parameter on the initial URL.
Which three statements are useful inside the unit test to effectively test the custom controller?
Choose 3 answers.
String nextpage = controller.save().geturl();
ApexPages.currentPage().getParameters().put('input', 'TestValue');
Insert pageRef
Test.setCurrentPage(pageRef)
public ExtendedController(ApexPages.StandardController central){}
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.
How can the developer find the current user's default record type?
A. Create the opportunity and check the opportunity record type before inserting, which will have the record ID of the current user's default record type.
B. Use the schema.userinfo.opportunity.getDefaultRecordType() method
C. Use Opportunity.SobjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until DefaultRecordTypeMapping() is true.
D. Query the profile where the ID equals user info.getprofileID() and then use the profile.opporutnity.getDefaultRecordTypes() method
E. Query the profile where the ID equals user info.getprofileID() and then use the profile.opportunity.getDefaultRecordType() method
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 records correctly?
Choose 2 answers.
A. public class contactController.
B. public inherited sharing class ContactController.
C. public with sharing class ContactController.
D. public without sharing class ContactController.
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. Virtual Studio Code IDE
C. Setup Menu
D. AppExchange
A developer wants to invoke an outbound message when a record meets specific criteria.
Which three features satisfy the use case?
A. Approval process has the capability to check the record criteria and send an outbound message without Apex Code.
B. Workflows can be used to check the record criteria and send an outbound message.
C. Process builder can be used to check the record criteria and send an outbound message without additional code.
D. Flow builder can be used to check the record criteria and send an outbound message without additional code.
E. Process builder can be used to check the record criteria and then call Apex code.
A developer wants to mark each Account in a list<account> as either active or inactive based on the lastModifiedDate field value being more than 90 days.
Which apex technique should the developer use?
A. A switch statement, with a for loop inside.
B. A for loop, with an if/else statement inside
C. An if/else statement, with a for loop inside
D. A for loop, with a switch statement inside
A developer wants to retrieve the contacts and users with the email address 'dev@uc.com'.
What 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'} IN contact, User
C. FIND{Email - 'Dev@uc.com'} RETURNING Contact {Email}, User {Email}
D. FIND{ Email IN Contact, User FOR {dev2uc.com}
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 count value of zero, assuming no other automation logic is implemented?
1
3
4
2
A development team wants to use a deployment script to automatically deploy to a sandbox during the development cycles.
Which two tools can they use to run a script that deploys to a sandbox?
Choose 2 answers.
A. SFDX CLI
B. VSCode
C. Change Sets
D. Developer Console
Given the following trigger Implementation:
trigger leadTrigger on Lead(before update){
final ID BUSINESS_RECORDTYPE = '012500B009Qsd';
for(lead thisLead : Trigger.new){
if(thisLead.company is 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?
A. Ensure BUSINESS_RECORDTYPEID is retrieved using schema.describe calls.
B. Ensure BUSINESS_RECORDTYPEID is pushed as part of the deployment components.
C. Ensure a record type with an id of BUSINESS_RECORDTYPEID exists on production prior to deployment.
D. Ensure the deployment is validated by a system admin user on production.
How can a developer check the test coverage of active process builders and flows before deploying them in a change set?
A. Use the code coverage setup page.
B. Use the flow properties page.
C. Use SOQL and the Tooling API
D. Use the ApexTestResult class
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 a lightning action.
B. Override the account's edit button with a lightning page.
C. Override the account's edit button with a lightning flow.
D. Override the account's edit button with a lightning component
Instead of sending emails to support personnel directly from salesforce, Universal Containers wants to notify an external system in the event that an unhandled exception occurs.
What is the appropriate publish/subscribe logic to meet this requirement?
A.Have the External system subscribe to the BatchApexError event, no publishing necessary.
B.Publish the error event using the addError() method and have the external system subscribe to the event using CometD.
C.Publish the error event using the EventBus.publish() method and have the external system subscribe to the event using CometD.
D.Publish the error event using the addError() method and write a trigger to subscribe to the event and notify the external system.
A lightning component has a wired property, searchResults, that store a list of Opportunities.
Which definition of the apex method, to which the searchResults property is wired, should be used?
A. @AuraEnabled(cacheable = true)
public static list<Opportunity> search (string term) { /implementation/ }
B. @AuraEnabled(cacheable = false)
public static List<Opportunity> search (string term) { /implementation/}
C. @AuraEnabled(cacheable = true)
public list<Opportunity> search(string term) { /implementation/}
D. @AuraEnabled(cacheable = false)
public List<Opportunity> search (string term) { /implementation/}
Universal Containers wants to back up all of the data and attachments in its salesforce org once a month.
Which approach should a developer use to meet this requirement?
A. Define a data Export Scheduled Job
B. Use the data loader command Line.
C. Schedule a report
D. Create a schedule able Apex class.
The values 'High', 'Medium' and 'Low' are identified as common values for multiple picklists across different objects.
What is an approach a developer can take to streamline maintenance of the picklists and their values, while also restricting the values to the ones mentioned above?
A. Create the picklist on each object as a required field and select 'display values alphabetically, not in the order entered'.
B. Create the picklist on each object and use a global picklist value set containing the values.
C. Create the Picklist on each object and add a validation rule to ensure data integrity.
D. Create the picklist on each object and select "Restrict Picklist to the values defined in the value set".
What are two ways that a controller and extension can be specified on a visualforce page?(Choose 2 answers).
A. apex:page controller="Account" extensions="myControllerExtension"
B. apex:page standardController = "Account" extensions="myControllerExtension"
C. apex:page controllers="Account, myControllerExtensions"
D. apex:page = Account extends="myControllerExtension"
What is a fundamental difference between a master-detail object and a lookup relationship?
A. In a lookup relationship when the parent record is deleted, the child records are always deleted.
B. In a master detail relationship, when a record of a master object is deleted, the detail records are not deleted.
C. In a lookup relationship, the field value is mandatory.
D. A master - detail relationship detail record inherits the sharing and security of the master record.
What is an example of a polymorphic lookup field in Salesforce?
A. A custom field Link__c, on the standard Contact object that looksup to an Account or a Campaign.
B. The LeadId and ContactId fields on the standard Campaign Member object
C. The WhatId field on the standard Event object
D. The ParentID field on the standard Account object
What is the maximum number of SOQL queries used by the following code:
List<Account> aList = [Select ID FROM Account LIMIT 5];
for (account a : aList ){
List<contact> cList = [Select id from contact where accountID =:a.Id];
}
6
2
5
1
What is the result of the following code?
Account a = new Account();
Database.insert(a, false);
A. The record will not be created and an exception will be thrown.
B. The record will be created and no error will be reported
C. The record will be created and a message will be in the debug log
D. The record will not be created and no error will be reported
What is the result of the following code snippet?
public void doWork(Account act ){
for (Integer i = 0; i <=200; i ++){
insert act;
}
}
A. 0 accounts are inserted
B. 1 Account is inserted
C. 200 Accounts are inserted
D. 201 Accounts are inserted
What should be used to create scratch orgs?
A. salesforce CLI
B. Sandbox refresh
C. Workbench
D. Developer console
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?
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. Custom Exception. Done.
C. Querying Accounts. Custom Exception.
D. Querying Accounts. Query Exception.
When a user edits the postal code on an account, a custom account text field named "Timezone" must be updated based on the value in a PostalCodeToTimezone__c custom object.
How can a developer implement this feature?
A. Build a Flow with Flow builder
B. Build a workflow rule.
C. Build an Account Approval Process
D. Build an Account Assignment Rule
Which apex class contains methods to return the amount of resources that have been used for a particular governor, such as the number of DML statements?
A. Limits
B. Messaging
C. Exception
D. OrgLimits
Which aspect of Apex programming is limited due to multi-tenancy?
A. The number of records processed in a loop.
B. The number of records returned from database queries.
C. The number of active apex classes
D. The number of methods in an Apex class
Which code in a visualforce page and/or controller might present a security vulnerability?
A. <apex:outputField escape = 'false' value = "{!ctrl.userinput}" />
B. <apex:outputText escape = "false" value = "(!$currentPage.parameters.userinput}" />
C. <apex:outputField value ="{!ctrl.userInput}" />
D. <apex:outputText value = "{!$CurrentPage.parameters.userInput}" / >
Which exception type cannot be caught?
A. LimitException
B. CalloutException
C. NoAccessException
D. A Custom Exception
Which process automation should be used to send an outbound message without using apex code?
A. Flow Builder
B. Process Builder
C. Strategy Builder
D. Workflow Rule
Which salesforce feature allows a developer to see when a user last logged in to salesforce if real time notification is not required.
A. Asynchronous Data Capture Events
B. Event Monitoring Log
C. Calendar Events
D. Developer Log
Which scenario is valid for execution by unit tests?
A. Generate a visualforce PDF with getContentAsPDF()
B. Load data from a remote site with a callout
C. Set the created date of a record using a system method.
D. Execute Anonymous Apex as a different user.
Which statement describes the execution order when triggers are associated to the same object and event?
A. Triggers are executed in the order they are modified.
B. Triggers are executed alphabetically by trigger name.
C. Triggers execution order cannot be guaranteed.
D. Triggers are executed in the order they are created.
Which three salesforce resources can be accessed from a lightning web component?
A. Static resources
B. Content Asset Files
C. All external libraries
D. Third-party web components
E. SVG resources
Which two are best practices when it comes to Aura component and application event handling?
Choose 2 answers.
A. Try to use application events as opposed to component events.
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 high-level events.
D. Reuse the event logic in a component bundle, by putting the logic in the helper.
Which two statements are accurate regarding Apex classes and interfaces?
Choose 2 answers.
A. Interface methods are public by default.
B. Inner classes are public by default.
C. A top-level class only have one inner class level.
D. Classes are final by default.
Which two statements are true about getter and setter methods as they relate to Visualforce?
Choose two answers.
A. Setter methods are required to pass a value from a page to a controller.
B. There is no guarantee for the order in which getter or setter methods are executed.
C. Setter methods always have to be declared global.
D. Getter methods can pass a value from a controller to a page.
While writing an Apex class that creates Accounts, a developer wants to make sure that all required fields are handled properly.
Which approach should the developer use to be sure that the Apex class works correctly?
A. Perform a code review with another developer.
B. Include a try/catch block to the Apex class.
C. Run the code in an Execute Anonymous block.
D. Add the business logic to a test class.
A developer has the following requirements:
• Calculate the total amount of 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 in stock.
Which relationship implementation supports these requirements?
A. Line Item has a Lookup field to Order and there can be many Line Items per Order.
B. Oder 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 Master-Detail field to Order and Master can be re-parented.
A developer must implement a CheckPayment Processor class that provides check processing payment capabilities that adhere to what is defined for payment in the PaymentProcessor interface.
Public interface PaymentProcessor {
Void pay(Decimal amount );
}
Which is the correct implementation to use the Payment Processor interface class?
A. Public class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal amount ) {} }
B. Public class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal amount ); }
C. Public class CheckPaymentProcessor implements PaymentProcessor { public void pay(Decimal amount ) {} }
D. Public class CheckPaymentProcessor extends PaymentProcessor { public void pay(Decimal amount ); }
A developer needs to have records with specific field values in order to test a new Apex class.
What should the developer do to ensure the data is available to the test?
A. Use SOQL to query the org for the required data.
B. Use Test.loadData() and reference a static resource.
C. Use Anonymous Apex to create the required data.
D. Use Test.loadData() and reference a CSV file.
A developer observes that an Apex test method fails in the Sandbox. To identify the issue, the developer copies the code inside the test method and executes it via the Execute Anonymous tool in the Developer Console. The code then executes with no exceptions or errors.
Why did the test method fail in the sandbox and pass in the Developer Console?
A. The test method does not use System.runAs to execute as a specific user.
B. The test method has a syntax error in the code.
C. The test method is calling a @future method.
D. The test method relies on existing data in the sandbox.
Given the following Anonymous Block:
List<Case> CaseToUpdate = new List<Case>();
for(Case thisCase : [Select Id, Status FROM Case LIMIT 50000]){
thisCase.Status = 'Working';
casesToUpdate.add(thisCase);
}
try{
Database.update(casesToUpdate, false);
}catch(Exception e){
System.debug(e.getMessage());
}
What should a developer consider for an environment that has over 10,000 case records?
A. The transaction will succeed, and changes will be committed.
B. The transaction will fail due to exceeding the governor limit.
C. The try/catch block will handle any DML exception thrown.
D. The try/catch block will handle exceptions thrown by the governor limits.
Universal Containers decides to use exclusively declarative development to build out a new Salesforce application. Which three options should be used to build out the database layer for the application? Choose 3 answers.
A. Apex classes
B. Process Builder
C. Roll-Up Summaries
D. Custom Objects and Fields
E. Relationships
Universal Containers has an order system that uses an Order Number to identify an order for customers and service agents. Order received will be Imported into Salesforce.
How should the order Number field be defined in Salesforce?
A. Direct Lookup
B. Lookup
C. Number with External ID
D. Indirect lookup
What are three considerations when using the @InvocableMethod annotation in Apex? (Choose 3 answers)
A. A method using the @InvocableMethod annotation can have multiple input parameters.
B. Only one method using the @InvocableMethod annotation can be defined per Apex class.
C. A method using the @InvocableMethod annotation must be declared as static.
D. A method using the @InvocableMethod annotation must define a return value.
E. A method using the @InvocableMethod annotation can be declared as Public or Global.
What are three ways for a developer to execute tests in an org? (Choose 3 answers)
A. Metadata API
B. Bulk API
C. Salesforce DX
D. Setup Menu
E. Tooling API
What are two ways a developer can get the status of an enqueued job for a class that implements the queueable interface? (Choose 2 answers)
A. Query the AsyncApexJob object
B. View the Apex Flex Queue
C. View the Apex Status Page
D. View the Apex Jobs Page
When using SalesforceDX, what does a developer need to enable to create and manage scratch orgs?
A. Environment Hub
B. Dev Hub
C. Sandbox
D. Production
Which aspect of Apex programming is limited due to multitenancy?
A. The number of active apex classes
B. The number of methods in an apex class
C. The number of records processed in a loop.
D. The number or records returned from a database query.
Which three operations affect the number of times a trigger can fire? (Choose 3 answers)
A. Criteria-based Sharing calculations
B. Roll-Up Summary fields
C. Process Flows
D. Email messages
E. Workflow rules
Which three steps allow a custom SVG to be included in a Lightning web component? Choose 3 answers.
A. Import the SVG as a content asset file.
B. Reference the getter in the HTML template.
C. Import the static resource and provide a getter for it in JavaScript.
D. Upload the SVG as a static resource.
E. Reference the import in the HTML template.
Which two events need to happen when deploying to a production org? Choose 2 answers.
A. All triggers must have at least 1% test coverage.
B. All tests and triggers must have at least 75% test coverage combined.
C. All triggers must have at least 75% test coverage.
D. All Apex code must have at least 75% test coverage.
A developer is asked to create a Visualforce page for opportunities that allows a user to save or merge the current record. What approach should the developer need to meet this requirement?
A. Custom controller
B. Custom controller extension
C. Visual force page JavaScript
D. Standard controller extension
A developer is tasked to perform a security review of the ContactSearch Apex class that exists in the system. Within the class, the developer identifies the following method as a security threat.
List<Contact> performSearch(String lastname){
return Database.query(SELECT Id, FirstName, LastName FROM Contact
WHERE LastName like % ' + LastName + ' % ' ) ;
}
What are two ways the developer can update the method to prevent a SOQL injection attack? Choose 2 answers.
A. Use a regular expression on the parameter to remove special characters.
B. Use variable binding and replace the dynamic query with a static SOQL.
C. Use the escapeSingleQuotes method to sanitize the parameter before its use.
D. Use the @ReadOnly annotation and the with sharing keyword on the class
An org tracks customer orders on an Order object and the line items of an Order on the Line Item
object. The Line Item object has a Master/Detail relationship to the Order object. A developer has
a requirement to calculate the order amount on an Order and the line amount on each Line Item based on quantity and price. What is the correct implementation?
A. Implements the line amount as a numeric formula field and the order amount as a roll-up summary field.
B. Write a single before trigger on the line Item that calculates the item amount and updates the
order amount on the order.
C. Implements the line amount as a currency field and the order amount as a SUM formula field.
D. Write a process on the line Item that calculates the item amount and order amount and updates the fields on the Line Item and the order.
What should a developer do to check the code coverage of a class after running all test?
A. View the Code Coverage column in the list view on the Apex Classes Page.
B. View the Class Test Coverage tab on the Apex Class record.
C. View the overall Code Coverage panel of the Test tab in the Developer Console.
D. Select and run the class on the Apex Test Execution page.
A developer considers the above snippet of code.
Based on this code, what is the value of x?
1
2
3
4
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?
A. 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.
A developer must create a CreditCardPayment class that provides an implementation of an existing Payment class.
Which is the correct implementation?
Universal Containers wants a list button to display a Visualforce page that allows users to edit multiple records.
Which Visualforce feature supports this requirement?
A. <apex:listButton> tag
B. recordSetVar page attribute
C. custom controller
D. controller extension
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?
A. 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.
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?
A. 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.
Which three statements are true regarding custom exceptions in Apex? (Choose three.)
A. 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.
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?
A. [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’];
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?
A. Add custom controller attributes to display the message.
B. Use a try/catch with a custom exception class.
C. Include <apex:messages> on the Visualforce page.
D. Perform the DML using the Database.upsert() method.
A developer must write an Apex method that will be called from a Lightning component. The method may delete an Account stored in the accountRec variable.
Which method should a developer use to ensure only users that should be able to delete Accounts can successfully perform deletions?
A. Schema.sObjectType.Account.isDeletable()
B. Account.isDeletable()
C. accountRec.isDeletable()
D. accountRec.sObjectType.isDeletable()
Which two conditions cause workflow rules to fire? (Choose two.)
A. 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.
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?
A developer creates an Apex helper class to handle complex trigger logic. How can the helper class warn users when the trigger exceeds DML governor limits?
A. By using ApexMessage.Message() to display an error message after the number of DML statements is exceeded.
B. By using Messaging.SendEmail() to continue the transaction and send an alert to the user after the number DML statements is exceeded.
C. By using PageReference.setRedirect() to redirect the user to a custom Visualforce page before the number DML statements is exceeded.
D. By using Limits.getDMLRows() and then displaying an error message before the number of DML statements exceeded.
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?
4
2
10
8
Which three methods help ensure quality data? 3 Answers
A. Create a lookup filter.
B. Adding an error to a field in before trigger.
C. Sending an email alert using a workflow rule.
D. Handling an exception in Apex
E. Adding a validation rule.
From which 2 locations can a developer determine the overall code coverage for a sandbox?
A. The test suite run panel of the developer console.
B. The apex classes setup page
C. The apex test execution page
D. The tests tab of the developer console
How can a developer set up a debug log on a specific user?
A. Set up a trace flag for the user and define a logging level and time period for the trace.
B. Ask the user for access to their account credentials, log in as the user and debug the issue.
C. Create apex code that logs code actions into a custom object.
D. It is not possible to setup debug logs for users other than yourself.
What can be used to delete components from production?
A. A change set deployment with the delete option checked.
B. An ant migration tool deployment with destructiveChanges.xml file and the components to delete in the package.xml file.
C. A change set deployment with a destructive changes XML file.
D. An ant migration tool deployment with a destructiveChanges.xml file and an empty package.xml file
Which three statements are true regarding the @istest annotation? Choose 3 answers.
A. Products and pricebooks are visible in a test even if a class is annotated @istest (seealldata=false)
B. A method annotated @istest (seealldata=false) in a class annotated @istest (seealladata=true)
has access to all org data.
C. A method annotated @istest (seealldata=true) in a class annotated @istest (seealladata=false)
has access to all org data.
D. Profiles are visible in a test even if a class is annotated @istest (seealldata=false)
E. A class containing test methods counts toward the apex code limit regardless of any @istest annotation.
Candidates are reviewed by four separate reviewers and their comments and scores which range from 1 (lowest)
to 5 (highest) are stored on a review record that is a detail record for a candidate. What is the best way to indicate that a combined review score of 15 and better is required to recommend that the candidate come in for an interview?
A. Use a validation rule on a total score field on the candidate record that prevents a recommended field form being true if the total score is less than 15.
B. Use a workflow rule to calculate the sum of the review scores and send an email to the hiring manager when the total is 15 or better.
C. Use visual workflow to set a recommended field on the candidate whenever the cumulative review score is 15 or better.
D. Use a rollup summary field to calculates the sum of the review scores, and store this in a total score field on the candidate.
A developer needs to include a visualforce page in the detail section of a page layout for the account object,
but does not see the page as an available option in the page layout editor.
Which attribute must the developer include in the tag to ensure the visualforce page can be embedded in a page layout?
A. Controller=”account”
B. Extensions=”accountcontroller”
C. Standardcontroller=”account”
D. Action=”accountid”
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. Use the getrecordtypeinfosbydevelopername() method in the describesobjectresult class.
B Make an outbound web services call to the SOAP API
C. Execute a SOQL query on the recordtype object.
D. Hardcode the ID as a constant in an apex class
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. The helper class creates a savepoint and continues.
B. All changes in the transaction are rolled back.
C. All changes made by the custom controller are saved.
D. The custom controller calls the helper class method again.
Which statement is true about a hierarchical relationship as it pertains to user records?
A. It uses a junction object and lookup relationships to allow many user records to be related to many other user records.
B. It uses a junction object and master-detail relationship to allow many user records to be related to many other user records.
C. It uses a master-detail relationship to allow one user record to be related to another user record.
D. It uses a special lookup relationship to allow one user record to be related to another user record.
A developer created a Visualforce page and a custom controller with methods to handle different buttons and events that can occur on the page. What should the developer do to deploy to production?
A. Create a test page that provides coverage of the custom controller.
B. Create a test page that provides coverage of the visualforce page.
C. Create a test class that provides coverage of the visualforce page.
D. Create a test class that provides coverage of the custom controller.
Which three data types can be returned from an SOQL statement? 3 Answers.
A. Boolean
B. List of objects
C. String
D. Integer
E. Single object
In order to override a standard action with a visualforce page, which attribute must be defined in the tag?
A. Pagereference
B. Override
C. Standardcontroller
D. Controller
What is a benefit of using a trigger framework?
A. Simplifies addition of context-specific logic.
B. Allows functional code to be tested by a test class.
C. Increases trigger governor limits.
D. Reduces trigger execution time.
In which of the following environments can Developers write code? Choose 2 Answers.
A. Developer edition production org
B. Enterprise edition production org
C. Enterprise edition Sandbox org
D. Professional edition Sandbox org
What are three techniques that a developer can use to invoke an anonymous block of code? (Choose three.)
A. 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.
A recursive transaction is initiated by a DML statement creating records for these two objects:
1. Accounts
2. Contacts
The Account trigger hits a stack depth of 16.
Which statement is true regarding the outcome of the transaction?
A. The transaction succeeds as long as the Contact trigger stack depth is less than 16.
B. The transaction succeeds and all the changes are committed to the database.
C. The transaction fails only if the Contact trigger stack depth is greater or equal to 16.
D. The transaction fails and all the changes are rolled back.
1. What is the correct way to implement dependency between aura component and visualforce page?
A. <aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="spanish:contacts" />
</aura:application>
A. <aura:application access="GLOBAL" >
<aura:dependency resource="spanish:contacts" />
</aura:application>
A. <aura:component access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="spanish:contacts" />
</aura: component >
A. <aura:component access="GLOBAL" ">
<aura:dependency resource="spanish:contacts" />
</aura: component >
1. Universal Containers hires a developer to build a custom search page to help user- find the Accounts they want. Users will be able to search on Name, Description, and a custom comments field.
Which consideration should the developer be aware of when deciding between SOQL or SOSL ?
Choose 2 answers.
A. SOQL is able to return more records.
B. SOQL is faster for text searches.
C. SOSL is able to return more records.
D. SOSL is faster for text searches.
1. Which two are phases in the Salesforce Application Event propagation framework? (Choose two.)
A. Bubble
B. Default
C. Control
D. Emit
1. A developer is implementing an Apex class for a financial system. Within the class, the variables 'creditAmount' and 'debtAmount' should not be able to change once a value is assigned. In which two ways can the developer declare the variables to ensure their value can only be assigned one time? Choose 2 answers.
A. Use the final keyword and assign its value in the class constructor.
B. Use the static keyword and assign its value in the class constructor.
C. Use the final keyword and assign its value when declaring the variable.
D. Use the static keyword and assign its value in a static initializer.
1. A Next Best Action strategy uses an Enhance 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?
A. @InvocableMethod
global static List<List<Recommendation>> getLevel(List<ContactWrapper> input)
{ /*implementation*/ }
B. @InvocableMethod
global List<List<Recommendation>> getLevel(List<ContactWrapper> input)
{ /*implementation*/ }
C. @InvocableMethod
global static ListRecommendation getLevel(List<ContactWrapper> input)
{ /*implementation*/ }
D. @InvocableMethod
global Recommendation getLevel (ContactWrapper input)
{ /*implementation*/ }
1. In which order does Salesforce execute events upon saving a record?
Before Triggers; Validation Rules; After Triggers;
Assignment Rules; Workflow Rules; Commit
Validation Rules; Before
Triggers; After Triggers; Workflow Rules; Assignment Rules; Commit
Before Triggers;
Validation Rules; After Triggers; Workflow Rules; Assignment Rules; Commit
Validation Rules; Before
Triggers; After Triggers; Assignment Rules; Workflow Rules; Commit
1. Where are two locations a developer can look to find information about the status of asynchronous or future calls? Choose 2 answers.
A. Apex Flex Queue
B. Apex Jobs
C. Time-Based Workflow Monitor
D. Paused Flow Interviews component
A Salesforce Administrator has built a flow that automatically creates individual commission records for the opportunity team once an opportunity is set to Closed Won. Users have reported that the flow throws an error related to governor limits when run. Which option is suitable for determining a flow's usage towards the governor limits in a transaction?
A. Create a Screen Flows report to view the usage of shared resources
B. Add the Resources element in Flow Builder to monitor resources
C. View resources consumed in the Debug Details in Flow Builder
D. Check the flow's resource consumption in the debug logs
The Salesforce Administrator of Cosmic Financial Services is required to create a new formula field on the 'Contract' object which calculates the expiration date by adding the 'Contract Term (months)' to the 'Customer Signed Date' field. Both are standard fields on the object. Which of the following represents the correct formula for the new field?
A. DATEVALUE (CustomerSignedDate + ContractTerm)
B. ADD (CustomerSignedDate, ContractTerm)
C. ADDMONTHS (CustomerSignedDate, ContractTerm)
D. ADDDATE (CustomerSignedDate, ContractTerm)
A developer of Cosmic Solutions has updated an important process using Process Builder in a sandbox environment. The updated process needs to be deployed to the company's production org as an active process using a change set. Which of the following should be considered when deploying an active process via a change set? (Choose 2 answers)
A. The process must meet the flow test coverage percentage defined in the production org
B. A process can be deployed as active as long as it does not invoke any Apex method
C. The setting 'Deploy processes and flows as active' must be enabled in the production org
D. A process will always be deployed as inactive in the production org when using change sets
Which of the following statements are true in regard to a Partial Copy and Full Copy Sandbox? (Choose 2 answers)
A. A Full copy sandbox has a shorter refresh interval than a Partial copy
B. A Partial copy is best to use for performance and load testing
C. A Full copy sandbox supports templates
D. A Partial copy sandbox can store less data than a full copy sandbox
A developer of Cosmic Solutions has defined a 'before update' Apex trigger on the Account object which should automatically change the value of the 'Industry' field to 'Energy' if the value of the 'Type' field on an account record has been set to 'Technology Partner'. However, while testing the trigger, she has found that, although the value of the 'Industry' field changes to 'Energy', the value of the 'Type' field also changes automatically from 'Technology Partner' to 'Customer - Direct'. Which of the following features can be utilized to identify the issue that is causing this unexpected behavior? (Choose 3 answers)
A. Checkpoint Inspector
B. User Trace Flag
C. Custom Exception
D. Log Inspector
E. Debug Log
The Events Manager of a marketing company has asked the Salesforce Administrator to build an event registration form to capture user details and indicate if the registrant was invited by one of their colleagues. If so, a lookup field should appear on the form so that the registration can be associated with the colleague. How can this requirement be best achieved?
A. Build the form on a Lightning app and use standard components such as the lookup field component
B. Develop a Lightning component and toggle the visibility state of the lookup field with JavaScript
C. Construct the form on a Visualforce page and use JavaScript to hide or show the lookup field
D. Create a screen flow with a Lookup screen component and configure its component visibility settings
Which of the following use cases are valid for using declarative customization? (Choose 3 answers)
A. Displaying the number of employees of the account related to an opportunity on the Opportunity page layout
B. Calculating the number of days until an opportunity closes and displaying the value on a report
C. Determining a lead rating that is based on the value of three fields on the lead record
D. Displaying the total discount amount on an opportunity using a roll-up summary field based on line item formula fields which reference another object
E. Calculating the sales tax applicable to a quote that is a complex calculation based on factors such as product, state, and quantity
What are considerations for deciding between using Data Loader and the Data Import Wizard for loading data into a development environment? (Choose 3 answers)
A. If the object is supported by the data import tool
B. If triggers should be run during the data import
C. If the data needs to be loaded multiple times
D. The data storage capacity of the org
E. The number of records to be loaded
A real estate company uses a custom checkbox field called 'Is Primary Contact' on the Contact object to allow users to easily mark a contact record as the primary contact of an account. When the primary contact is deleted, the value of a custom checkbox field called 'Has Primary Contact' on the related account should be set to false automatically. While creating an Apex trigger on the Contact object, which trigger event should be used to meet this requirement?
A. Before Update
B. Before Delete
C. After Delete
D. After Update
Which type of sandbox is the most appropriate for light development and testing work that does not require more than 100 MB of data storage?
A. Developer Sandbox
B. Partial Copy Sandbox
C. Developer Pro Sandbox
D. Standard Sandbox
How can the relationship between different accounts be recorded and viewed? (Choose 2 answers)
A. Using the Parent Account field
B. Using the View Hierarchy link
C. Using the Generate Relationship function
D. Using the Related Account field
A Salesforce developer at Cosmic Properties created a Developer sandbox from a Production org to build a new feature. However, after he creates a change set, he does not see the Production org as an option for the destination org when he attempts to upload it. What might he need to do to resolve this?
A. Ensure he has the "Deploy Change Sets" permission in the Production org
B. Allow inbound changes from the sandbox in the Production org's Deployment Connection page
C. Allow outbound changes to Production in the sandbox org's Deployment Connection page
D. Ensure he has the "Create and Upload Change Sets" permission in the sandbox
There is a requirement to validate that the country code of an account field is a valid ISO code. There are over 200 codes. What could be used for this validation?
A. Workflow Rule
B. Before Update trigger
C. After Update trigger
D. Validation Rule
Which statement is true about overriding standard action buttons?
A. When the New button for the Account object is overridden, the override only takes effect on the New button in the Account detail page
B. If the Delete button on an object is overridden with a Visualforce page, and the object has a delete trigger, clicking Delete will always fire the trigger
C. The New, View, and Edit buttons can all be overridden for Salesforce Classic, Lightning Experience, and Mobile in one consolidated action override screen
D. Buttons that appear on the edit page of a record can be overridden
Suzan is a Salesforce Developer at Cosmic Beauty. Suzan is creating a custom Lightning Component in which products will be loaded and would include information about the maximum allowed discounts that can be provided for each of the products. The field 'Maximum Allowed Discount' is only visible to the Sales Managers and not to the Sales Representatives. When the Sales Representatives want to provide a discount, they have to consult their manager to establish a discount percentage. What method can Suzan use to strip fields the running user cannot access and only use one SOQL query?
A. Use the With Sharing method in Apex
B. Use the StripInaccessible method in Apex
C. Make the SOQL query variable based on the profile of the running user
D. Use two different page layouts, remove the 'Maximum Allowed Discount' field from the Sales Representatives page layout
A custom object has a workflow rule that updates a field when a certain set of criteria is met. A 'before update' Apex trigger has also been defined on the object. What will happen when a user updates a record so that it meets the criteria of the workflow rule?
A. The Apex trigger will be fired first, voiding the Workflow Rule due to the order of execution
B. The Apex trigger will be fired twice
C. Both will be fired only once
D. An exception will be thrown due to a conflict between the two
What will happen when the following code is executed?
trigger CaseTrigger on Case (after insert) {
List<Case> casesToInsert = new List<Case>();
for (Case parent: Trigger.new) {
Case child = new Case();
child.ParentId = parent.Id;
child.Subject = parent.Subject + ' Child';
casesToInsert.add(child);
}
insert casesToInsert;
}
A. No child cases will be created
B. Child cases will be inserted for each Parent case
C. The trigger will throw an exception because it is not bulkified
D. The trigger will be recursively called which will result in an infinite loop and will eventually throw an exception
In the following line of code, why can the helloWorld() method be called directly instead of instantiating the myClass?
myClass.helloWorld('Hello');
A. myClass is defined as public
B. helloWorld is defined as a static method
C. helloWorld is defined as a void method
D. myClass is defined as a static class
What will be the result of running the following code?
for (Integer x = 0; x < 200; x++) {
Account newAccount = new Account ( Name= 'MyAccount-' + x);
try {
insert newAccount;
System.debug(Limits.getDMLStatements());
} catch(exception ex) {
System.Debug('Caught Exception');
System.Debug(ex);
}
}
insert new Account(Name='MyAccount-last');
A. 150 accounts will be inserted
B. 201 accounts will be inserted
C. A limit exception will be caught and one account will be inserted
D. No accounts will be inserted
