Правильные ответы к тесту «PD1» (Образовательный тест)

Пройти тест онлайн
Кликните по вопросу, чтобы узнать ответ

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

View the Apex Jobs page

Query the AsуnсAрexJob object

A custom picklist field, Food_Preference_c, exists on a custom object. The picklist contains the following options: 'Vegan', 'Kosher', 'Non... Preference'. The developer must ensure a value is populated every time a record is created or updated.

What is the optimal way to ensure a value is selected every time a record is saved?

Mark the field as Required on the field definition.

Refer to the following code snippet for an environment that has more than 200 Accounts belonging to the ‘Technology’ industry:

for(Account thisAccount : [SELECT Id, Industry FROM Account LIMIT 250]){
if(thisAccount.Industry == 'Technology'){
thisAccount.Is_Tech__c = true;
}
update thisAccount;
}

When the code executes, what happens as a result of the Apex transaction?

The Apex transaction fails with the following message: SObject now was retrieved via SOQL without querying the requested field: Account.Is_Tech__c.

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?

Use Test.loadData()and reference a CSV file in a static resource.

An org has an existing flow that creates an Opportunity with an Update Records element. A developer must update the flow to also create a Contact and store the created Contact's ID on the Opportunity.

Which update must the developer make in the flow?

C. Add a new Create Records element.

What is the result of the following code?

Account a = new Account();
Database.insert(a, false);

The record will not be created and no error will be reported.

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?

2

What should a developer do to check the code coverage of a class after running all tests?

View the code coverage percentage for the class using the Overall Code Coverage panel in the Developer Console Tests tab.

Universal Containers recently transitioned from Classic to Lightning Experience.

One of its business processes requires certain values from the Opportunity object to be sent via an HTTP REST callout to its external order management system based on an ad-hoc basis when the user presses a custom button on the Opportunity detail page. Example values are as follows:
- Name
- Amount
- Account

Which two methods should the developer implement to fulfill the business requirement?

Choose 2 answers

Create a Lightning component that performs the HTTP REST calliout, and use a Lightning Action to expose the component on the Opportunity detail page.

Create a Visualforce page that performs the HTTP REST caliout, and use a Visua force quick action to expose the component on the Opportunity deta page.

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?

Use Opportunity.SObjectType.getDescribe().getRecordTypeInfos() to get a list of record types, and iterate through them until isDefaultRecordTypeMapping() is true.

A developer has a requirement to write Apex code to update a large number of account records on a nightly basis. The system administrator needs to be able to schedule the class to run after business hours on an as-needed basis.

Which class definition should be used to successfully implement this requirement?

A. global inherited sharing class ProcessAccountProcessor implements Database.Batchable<sObject>, Schedulable

Which three statements are true regarding custom exceptions in Apex?

Choose 3 answers

A custom exception class name must end with ""Exception"".

A custom exception class can implement one or many interfaces.

A custom exception class must extend the system Exception class.

Which three Salesforce resources can be accessed from a Lightning web component?

Choose 3 answers

Content asset files

SVG resources

Static resources

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?

Developer Console

Cloud Kicks has a multi-screen flow that its call center agents use when handling inbound service desk calls.

At one of the steps in the flow, the agents should be presented with a list of order numbers and dates that are retrieved from an external order management system in real time and displayed on the screen.

What should a developer use to satisfy this requirement?

An invocable method

Which three resources in an Aura component can contain JavaScript functions?

Choose 3 answers

Renderer

Controller

Helper

A developer Is asked to prevent anyone other than a user with Sales Manager profile from changing the Opportunity Status to Closed Lost If the lost reason Is blank.

Which automation allows the developer to satisfy this requirement In the most efficient manner?

An error condition formula on a validation rule on Opportunity

The Account object in an organization has a master-detail relationship to a child object called Branch. The following automations exist:
- Rollup summary fields
- Custom validation rules
- Duplicate rules
A developer created a trigger on the Account object.

Which two things should the developer consider while testing the trigger code?

Choose 2 answers

A. The trigger may fire multiple times during a transaction.

B. Rollup summary fields can cause the parent record to go through Save.

What can be used to override the Account's standard Edit button for Lightning Experience?

Lightning component

A business has a proprietary Order Management System (OMS) that creates orders from their website and fulfills the orders.
When the order is created In the OMS, an Integration also creates an order record in Salesforce and relates It to the contact as identified by the email on the order. As the order goes through different stages In the OMS, the integration also updates it in Salesforce.
It Is noticed that each update from the OMS creates a new order record in Salesforce.

Which two actions will prevent the duplicate order records from being created In Salesforce?

Choose 2 answers

Use the order number from the OMS as an external ID.

Ensure that the order number In the OMS Is unique.

The sales management team at Universal Containers requires that the Lead Source field of the Lead record be populated when a Lead Is converted.

What should be done to ensure that a user populates the Lead Source field prior to converting a Lead?

Use a validation rule.

Consider the following code snippet:

public static List<Lead> obtainAllFields(Set.<Id> leadIds){
List<Lead> result = new List<Lead>();
for(Id leadId : leadIds){
result.add([SELECT FIELDS(ALL)FROM Lead WHERE Id = leadId);
}
return result;
}

Given the multi-tenant architecture of the Salesforce platform, what Is a best practice a developer should implement and ensure successful execution of the method?

Avoid performing queries Inside for loops

A developer created these three Rollup Summary fields In the custom object, Project__c:
● Total_Timesheets__c
● Total_Approved_Timesheets__c
● Total_Rejected_Timesheets__c
The developer Is asked to create a new field that shows the ratio between rejected and approved timesheets for a given project.

Which should the developer use to Implement the business requirement In order to minimize maintenance overhead?

Formula field

"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.

Which two automation tools can be used to Implement this feature?

Choose 2 answers

Account trigger

Fast Field Updates record-triggered flow

"A developer wants to send an outbound message when a record meets a specific criteria.

Which two features satisfy this use case?

Choose 2 answers

Approval Process can be used to check the record criteria and send an outbound message without Apex code.

Flow Builder can be used to check the record criteria and send an outbound message.

"Which two statements are true about using the @testSetup annotation In an Apex test class?

Choose 2 answers

The @testSetup annotation Is not supported when the @lsTest{SeeAIIData=True) annotation is used.

In a test setup method, test data Is Inserted once and made available for all test methods In the test class.

"A developer needs to create a baseline set of data (Accounts, Contacts, Products, Assets) for an entire suite of tests allowing them to test independent requirements for various types of Salesforce Cases.

Which approach can efficiently generate the required data for each unit test?

Use @Testsetup with a void method.

"Which three statements are accurate about debug logs?

Choose 3 answers

Debug logs can be set for specific users, classes, and triggers.

Debug log levels are cumulative, where FINE log level Includes all events logged at the DEBUG, INFO, WARN, and ERROR levels.

a System debug logs are retained for 24 hours.

"Universal Containers has implemented an order management application. Each Order can have one or more Order Line items.
The Order Line object is related to the Order via a master-detail relationship. For each Order Line item, the total price is calculated by multiplying the Order Line item price with the quantity ordered.

What is the best practice to get the sum of all Order Line item totals on the Order record?

Roll-up summary field

"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 the validation rule violations are displayed?

Include <apex:messages> on the Visualforce page

"A developer is debugging the following code to determine why Accounts are not being created,

List<Account> accts = getAccounts(); // getAccounts implemented elsewhere
Database.insert(accts, false);

How should the code be altered to help debug the issue?

Collect the insert method return value in a SaveResult variable.

"A developer migrated functionality from JavaScript Remoting to a Lightning web component and wants to use the existing getOpportuninites() method to provide data.

Which modification is necessary?

The method must be decorated with @AuraEnabled.

"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 e field is set to ""Waiting on Customer"". The Salesforce Administrator wants to ensure the solution used is bulk safe.

Which automation tool should a developer recommend to meet these business requirements?

Choose 2 answers

Scheduled Flow

Record-Triggered Flow

"A developer has the following requirements:
● Calculate the total amount on an Order.
● Calculate the line amount for each Line Item based on quantity selected and price.
● Move Line Items to a different Order if a Line Item is not in stock.

Which relationship implementation supports these requirements on its own?

Order has a re-parentable master-detail field to Line Item.

"What are two best practices when it comes to Lightning Web Component events?

Choose 2 answers

Use events configured with bubbles: false and composed: false.

Use CustomEvent to pass data from a child to a parent component.

"When a user edits the Postal Code on an Account, a custom Account text field named ""Timezone"" must be updated based on another custom object called PostalCodeToTimezone__c.

What is the optimal way to implement this feature?

Build a flow with Flow Builder.

"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’, CloseDate = 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

Move the DML that saves opportunities outside of the for loop.

Query for existing opportunities outside of the for loop.

"What are two use cases for executing Anonymous Apex code?

Choose 2 answers

To run a batch Apex class to update all Contacts

To schedule an Apex class to run periodically

"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 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?

Share the parent Case and Defect__c records.

"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

Create a static resource containing test data.

Use Test.loadData to populate data in your test methods.

"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 List<List<sObject>> searchTerms(List<String> termList) {
List<List<sObject>> result = new List<List<sObject>> ();
for (String term : termList){
result.addAll( [FIND :term IN ALL FIELDS RETURNING Account(Name), 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?

20

"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?

Use security. stripInaccessible to remove fields inaccessible to the current user.

"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 qty){
Integer newInventoryAmt = getNewInventoryAmt (prodId, qty);
Product__c = new Product__c(Id = prodId, Inventory__c = newInventoryAmt);
Update 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?

InventoryReductionEvent__e ev = new InventoryReductionEvent__e(ProductId__c = prodId, Reduction__c = qty); EventBus.publish(ev);

"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?

static final decimal DELIVERY MULTIPLIER = 4.15;

"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?

Standard list controller

"Which two sfdx commands can be used to add testing data to a Developer sandbox?

Choose 2 answers

force:data:tree:import

force:data:bulk:upsert

"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?

Collect the insert method return value in a SaveResult record

"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 standard controller with a controller extension

"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

Ensure isExposed is set to true on the XML file.

Specify lightning__RecordPage as a target in the XML file.

"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?

Order_Shipment_Group__c object and master-detail fields to Order__c and Order_Line__c

"Which annotation exposes an Apex class as a RESTful web service?

@RestResource

"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?

Master-detail field from Engineering_ Support__c to Opportunity

"A developer wrote Apex code that calls out to an external system. How should a developer write the test to provide test coverage?

Write a class that implements the HTTPCalloutMock interface.

"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?

The deployment fails because the Apex trigger has no code coverage.

"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

Add <target>lightning__RecordPage</target> to the statusComponent.js-meta.xml file.

Add <isExposed>true</isExposed> to the statusComponent.js-meta.xml file.

"Which two settings must be defined in order to update a record of a junction object?

Choose 2 answers

Read/Write access on the primary relationship

Read/Write access on the secondary relationship

"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?

Choose 2 answers

Scheduled Flow

Record-Triggered Flow

"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?

Implement pagination with a StandardSetController.

"A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple Objects. The wizard accepts data from user inputs across multiple Visualforce 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

Test.setCurrentPage(pageRef);

ApexPages.currentPage().getParameters().put('input', 'TestValue');

String nextPage = controller.save().getUrl();

"In terms of the MVC paradigm, what are two advantages of implementing the view layer of a Salesforce application using Lightning Web Component-based development over Visualforce?

Choose 2 answers

Self-contained and reusable units of an application

Rich component ecosystem

"A developer is migrating a Visualforce page into a Lightning web component.
The Visualforce page shows information about a single record. The developer decides to use Lightning Data Service to access record data.

Which security consideration should the developer be aware of?

Lightning Data Service handles sharing rules and field-level security.

"In the following example, which sharing context will myMethod execute when it is invoked?

public Class myClass {
public void myMethod() { /* implementation */ }
}

Sharing rules will be inherited from the calling context.

"What are two ways for a developer to execute tests in an org?

Choose 2 answers

Developer Console

Tooling API

Пройти тест «PD1»