Dev Cert Flashcards
1 - 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. 1
C. 2
D. 3
C
2 - Management asked for opportunities to be automatically created for accounts with annual revenue greater than $1,000,000. A developer created the following trigger on the Account object to satisfy this requirement.
for (Account a: Trigger.new) {
if (a.AnnualRevenue > 1000000) {
List<Opportunity> opplist = (SELECT Id FROM Opportunity WHERE accountId = :a. Id];
if (opplist.size() == 0) {
Opportunity oppty = new Opportunity (Name = a.name, StageName = ‘Prospecting’,</Opportunity>
ClogeDate = system. today ().addDays (30) ) ;
insert oppty;
}
}
}
Users are able to update the account records via the UI and can see an opportunity created for high annual revenue accounts. However, when the administrator tries to upload a list of 179 accounts using Data Loader, it fails with System Exception errors.
Which two actions should the developer take to fix the code segment shown above?
Choose 2 answers
A. Move the DML that saves opportunities outside of the for loop.
B. Query for existing opportunities outside of the for loop.
C. Use Database. query to query the opportunities.
D. Check if all the required fields for Opportunity are being added on creation.
A and B
3 - What are two use cases for executing Anonymous Apex code?
Choose 2 answers
A. To run a batch Apex class to update all Contacts
B. To schedule an Apex class to run periodically
C. To add unit test code coverage to an org
D. To delete 15,000 inactive Accounts in a single transaction after a deployment
B and D
4 - A software company uses the following objects and relationships:
● Case: to handle customer support issues
● Defect c: a custom object to represent known issues with the company’s software
● Case Defect c: a junction object between Case and Defect o to represent that a defect is a cause of a customer issue
Case and Defect__c have Private organization-wide defaults.
What should be done to share a specific Case_Defect__c record with a user?
A. Share the parent Defect_c record.
B. Share the parent Case and Defect__c records.
C. Share the Case_Defect__ c record.
D. Share the parent Case record.
B
5 - A developer created a trigger on the Account object and wants to test if the trigger is properly bulkified. The developer team decided that the trigger should be tested with 200 account records with unique names.
What two things should be done to create the test data within the unit test with the least amount of code?
Choose 2 answers
A. Create a static resource containing test data.
B. Use the @isTest (seeAllData=true) annotation in the test class
C. Use the @isTest (iParallel=true) annotation in the test class
D. Use Test.loadData to populate data in your test methods.
A and D
6 - A developer is building custom search functionality that uses SOSL to search account and contact records that match search terms provided by the end user. The feature is exposed through a Lightning web component, and the end user is able to provide a list of terms to search.
Consider the following code snippet:
@AuraEnabled
public static Ligt<List<sObject>> searchTerms(List<String> termList) {
List‹List<sObject>> result = new List <List<sObject>> ();
for (String term : termList){
regult.addAll([FIND :term IN ALL FIELDS RETURNING Account (Name),</sObject></sObject></String></sObject>
Contact (FirstName, LastName) ]) ;
}
return result;
}
What is the maximum number of search terms the end user can provide to successfully execute the search without exceeding a governor limit?
A. 20
B. 150
C. 200
D. 2,000
D
7 - 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. HTML file
B. XML file
C. JavaScript file
D. Apex class
D
8 - A developer is creating a Lightning web component to show a list of sales records. The Sales Representative user should be able to see the commission field on each record. The Sales Assistant user should be able to see all fields on the record except the commission field.
How should this be enforced so that the component works for both users without showing any errors?
A. Use Security. stripInaccessible to remove fields inaccessible to the current user.
B. Use Lightning Data Service to get the collection of sales records.
C. Use WITH SECURITY_ENFORCED in the SQL that fetches the data for the component.
D. Use Lightning Locker Service to enforce sharing rules and field-level security.
A
9 - AW Computing (AWC) handles orders in Salesforce and stores its product inventory in a field, Inventory__c, on a custom object, Product__c. When an order for a Product__c is placed, the Inventory__c field is reduced by the quantity of the order using an Apex trigger.
public void reduceInventory (Id prodid, Integer gty){
Integer newInventoryAmt = getNewInventoryAmt (prodId, qty) ;
Product__c = new Product__c(Id = prodId, Inventory__c = newInventoryAmt;
Uptade p;
// code goes here
}
AWC wants the real-time inventory reduction for a product to be sent to many of its external systems, including some future systems the company is currently planning.
What should a developer add to the code at the placeholder to meet these requirements?
A. InventoryReductionEvent__c ev = new InventoryReductionEvent__c (ProductId__c = prodId, Reduction__c = qty);
EventBus.publish (ev);
B. InventoryReductionEvent__e ev = new InventoryReductionEvent__e (ProductId__c = prodId, Reduction__c = qty);
insert ev;
C. InventoryReductionEvent__c ev = new InventoryReductionEvent__c (ProductId__c = prodId, Reduction__c = qty);
insert ev;
D. InventoryReductionEvent__e ev = new InventoryReductionEvent__e (ProductId__c = prodId, Reduction__c = qty);
EventBus.publish (ev);
D
10 -The OrderHelper class is a utility class that contains business logic for processing orders. Consider the following code
snippet:
public class without sharing OrderHelper{
//code implementation
}
A developer needs to create a constant named DELIVERY_MULTIPLIER with a value of 4.15. The value of the
constant should not change at any time in the code.
How should the developer declare the DELIVERY MULTIPLIER constant to meet the business objectives?
A. decimal DELIVERY MULTIPLIER=4.15;
B. static decimal DELIVERY MULTIPLIER=4.15;
C. constant decimal DELIVERY MULTIPLIER = 4.15:
D. static final decimal DELIVERY MULTIPLIER =4.15;
D
11 - A developer is asked to create a Visualforce page that lists the contacts owned by the current user. This component will be embedded in a Lightning page. Without writing unnecessary code, which controller should be used for this purpose?
A. Standard list controller
B. Custom controller
C. Lightning controller
D. Standard controller
A
12 - Which two sfdx commands can be used to add testing data to a Developer sandbox?
Choose 2 answers
A. force:data:tree:import
B. force:data:object:create
C. force:data:bulk:upsert
D. force:data:async:upsert
A and C
13 -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?
A. Add a try/catch around the insert method.
B. Add a System.debug() statement before the insert method.
C. Set the second insert method parameter to TRUE.
D. Collect the insert method return value in a SaveResult record.
D
14 - An org has two custom objects:
● Plan__c, that has a master-detail relationship to the Account object
● Plan_Item__c, that has a master-detail relationship to the Plan__c object
What should a developer use to create a Visualforce section on the Account page layout that displays all of the Plan__c records related to the Account and all of the Plan_Item__c records related to those Plan__c records.
A. A custom controller by itself
B. A standard controller with a controller extension
C. A standard controller with a custom controller
D. A controller extension with a custom controller
B
15 - A third-party vendor created an unmanaged Lightning web component. The Salesforce Administrator wishes to expose the component only on Record Page Layouts.
Which two actions should the developer take to accomplish this business objective?
Choose 2 answers
A. Ensure isExposed is set to true on the XML file.
B. Specify lightning__RecordPage as a target in the XML file.
C. Specify lightningCommunicy__Page_Layout as a target in the XML file.
D. Specify lightningCommunity__Page as a target in the XML file.
A and B
16 - AW Computing tracks order information in custom objects called Order__c and Order_Line__c. Currently, all shipping information is stored in the Order__c object. The company wants to expand its order application to support split shipments so that any number of Order_Line__c records on a single Order__c can be shipped to different locations.
What should a developer add to fulfill this requirement?
A. Order_Shipment_Group__c object and master-detail field on Order_Line__c
B. Order_ Shipment_Group__c object and master-detail fields to Order__c and Order_Line__c
C. Order Shipment_ Group_ c object and master-detail field on Order__c
D. Order Shipment Group__c object and master-detail field on Order_Shipment_Group__c
B
17 - Which annotation exposes an Apex class as a RESTful web service?
A. @RestResource
B. @AuraEnabled
C. @HttpInvocable
D. @RemoteAction
A
18 - Universal Containers has a support process that allows users to request support from its engineering team using a custom object, Engineering_ Support__c Users should be able to associate multiple Engineering_support__c records to a single Opportunity record.
Additionally, aggregate information about the Engineering_ Support__c records should be shown on the Opportunity record.
What should a developer implement to support these requirements?
A. Lookup field from Opportunity to Engineering_ support__c
B. Master-detail field from Opportunity to Engineering_ support__c
C. Lookup field from Engineering_Support__c to Opportunity
D. Master-detail field from Engineering_ support__c to Opportunity
B
19 - A developer wrote Apex code that calls out to an external system.
How should a developer write the test to provide test coverage?
A. Write a class that implements the HTTPCalloutMock.
B. Write a class that implements WebserviceMock.
C. Write a class that extends WebserviceMock.
D. Write a class that extends HTTPCalloutMock.
A
20 - A developer created this Apex trigger that calls MyClass.myStaticMethod:
trigger myTrigger on Contact (before insert)
{ MyClass.myStaticMethod(trigger.new); }
The developer creates a test class with a test method that calls MyClass.myStaticMethod directly, 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 passes because both classes and the trigger were included in the deployment.
B. The deployment fails because the Apex trigger has no code coverage.
C. The deployment passes because the Apex code has the required >75% code coverage.
D. The deployment fails because no assertions were made in the test method.
B
21 - A developer created a Lightning web component called statusComponent to be inserted into the Account record page.
Which two things should the developer do to make this component available?
Choose 2 answers
A. Add <target>lighening\_\_ RecordPage</target> to the statusComponent.js-meta.xml file.
B. Add <isExposed>true</isExposed> to the statusComponent.js-meta.xml file.
A. C.Add <masterLabel>Account</masterLabel> to the statusCompoment.js-meta.xml file.
C. Add <target>lightning RecordPage</target> to the statusComponent.js file.
A and B
22 - Which two settings must be defined in order to update a record of a junction object?
Choose 2 answers
A. Read/Write access on the primary relationship
B. Read/Write access on the secondary relationship
C. Read access on the primary relationship
D. Read/Write access on the junction object
A and B
23 - Universal Containers uses Service Cloud with a custom field, Stage__c, on the Case object.
Management wants to send a follow-up email reminder 6 hours after the Stage__c field is set to “Waiting on Customer”. The Salesforce Administrator wants to ensure the solution used is bulk safe.
Which two automation tools should a developer recommend to meet these business requirements?
A. Scheduled Flow
B. Record-Triggered Flow
C. Einstein Next Best Action
D. Entitlement Process
A
24 - Universal Containers has a Visualforce page that displays a table of every Container__c being rented by a given Account. Recently this page is failing with a view state limit because some of the customers rent over 10,000 containers.
What should a developer change about the Visualforce page to help with the page load errors?
A. Implement pagination with a StandardSetController.
B. Use JavaScript remoting with SOQL Offset.
C. Implement pagination with an OffsetController.
D. Use lazy loading and a transient List variable.
D
- > searchList = [SELECT Name, ID FROM Contact, Lead WHERE Name like '%ACME%'];
B. List
- > searchList = [FIND "*ACME*" IN ALL FIELDS RETURNING Contact, Lead];
C. List
- > getLevel(List
- > getLevel(List