Platform Dev 1 Flashcards

1
Q

What is a correct pattern to follow when programming in Apex on a multitenant platform?

A. Use the with sharing keyword when declaring an Apex class to prevent access from other server tenants.

B. Use queries to select the fewest fields and records possible to avoid exceeding governor limits.

C. Create Apex code in a separate environment from the schema to reduce deployment errors.

D. Run Data Manipulation Language (DML) on one record at a time to avoid possible data concurrency issues.

A

B. Use queries to select the fewest fields and records possible to avoid exceeding governor limits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which two types of code represent the controller in model-view-controller (MVC) architecture on the Lightning Platform?

A. StandardController system methods that are referenced by Visualforce
B. JavaScript that is used to make a menu item display itself
C. A static resource that contains Cascading Style Sheets (CSS) and images
D. Custom Apex and JavaScript code that is used to manipulate data

A

A. StandardController system methods that are referenced by Visualforce
D. Custom Apex and JavaScript code that is used to manipulate data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When an account record changes, what should a developer do to update a picklist field on a related opportunity?

A. Create a workflow rule with a field update.
B. Create a Visualforce page.
C. Create a lightning component.
D. Create a record-triggered flow.

A

D. Create a record-triggered flow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A developer is creating an application to track engines and their parts. An individual part can be used in different types of engines. Which data model should the developer use to track the data and to prevent orphan records?

A. Create a master-detail relationship to represent the one-to-many model of engines to parts.
B. Create a lookup relationship to represent how each part relates to the parent engine object.
C. Create a junction object using two lookup relationships to relate many engines to many parts.
D. Create a junction object using two master-detail relationships to relate many engines to many parts

A

D. Create a junction object using two master-detail relationships to relate many engines to many parts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A company wants a recruiting app and data model for job candidates and interviews, with the following requirements.
* Display the total number of interviews on each candidate record.
* Define security on interview records that’s independent from the security on candidate records.

Which two actions should a developer take to achieve this?

A. Create a lookup relationship between the Candidate and Interview objects.
B. Create a master-detail relationship between the Candidate and Interview objects.
C. Create a roll-up summary field on the Candidate object that counts interview records.
D. Create a trigger on the Interview object that updates a field on the Candidate object.

A

A. Create a lookup relationship between the Candidate and Interview objects.
D. Create a trigger on the Interview object that updates a field on the Candidate object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The sales management team requires that users populate the Lead Source field of the lead record when they convert a lead. What should a developer create to ensure that users do this?

A. Flow Trigger
B. Validation Rule
C. Formula Field
D. Apex Trigger

A

B. Validation Rule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The sales management team hires a new intern. The intern is not allowed to view opportunities, but needs to see the most recent closed date of all child opportunities when viewing an account record. What should a developer do to meet this requirement?

A. Write a Flow on the Opportunity object that updates a field on the parent account.
B. Create a roll-up summary field on the Account object that performs a MAX on the Opportunity Close Date field.
C. Create a formula field on the Account object that performs a MAX on the Opportunity Close Date field.
D. Create a trigger on the Account object that queries the close date of the most recent opportunities.

A

B. Create a roll-up summary field on the Account object that performs a MAX on the Opportunity Close Date field.

It is NOT the answer C because:
Using formula fields can result in a value returning, #Error!, which can affect the summarized total. If #Error! is included in the results, the calculations for MAX will exclude those formula values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A developer has this trigger that fires after insert and creates a child case whenever a new case is created. Which unexpected behavior happens after the code block executes?

List<Case> childCases = new List<Case>(); 
for (Case parent : Trigger.new ){    
 Case child = new Case(ParentId = parent.Id,
                 Subject = parent.Subject);     
 childCases.add( child ); 
}
insert childCases;  

A. A child case is created for each parent case in Trigger.new.
B. The trigger enters an infinite loop and eventually fails
C. Multiple child cases are crated for each parent case in Trigger.New
D. The trigger failes if the Subject field on the parent is blank

A

B. The trigger enters an infinite loop and eventually fails

The code sample shows a recursive trigger, caused by the trigger being fired each time a new case is created inside the for loop. This creates an infinite loop and eventually causes the code to fail.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A developer wants to create a custom object to track customer invoices. How should you relate invoices and accounts to ensure that all invoices are visible to everyone with access to an account?

A. The Account should have a lookup to the relation to the Invoice
B. The Invoice should have a lookup relation to the Account
C. The Account should have a master-detail relationship to the Invoice
D. The Invoice should have a master-detail relationship to the Account

A

D. The Invoice should have a master-detail relationship to the Account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A custom field on the Account object was required for prototyping but is no longer needed. What is the correct process for a developer to delete the custom field?

A. Delete the field and then all references in the code will be removed
B. Remove all references in the code and then the field will be automatically removed
C. Mark the field for deletion in the Schema Builder and then delete it from the user interface
D. Remove all references to the custom field and then delete the custom field.

A

D. Remove all references to the custom field and then delete the custom field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When loading data into an organization, which two actions should a developer take to match the updates to existing records?

A. Match an auto-generated Number field to a column in the imported file.
B. Match the ID field to a column in the imported file.
C. Match an External ID field to a column in the imported file.
D. Match the Name field to a column in the imported file.

A

B. Match the ID field to a column in the imported file.
C. Match an External ID field to a column in the imported file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

An important consideration when developing in a multi-tenant environment

A

Governor Limits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which three declarative methods help ensure quality data?

Validation Rules, Lookup filters, Workflow Alerts, Page Layouts, or Exception Handling

A

Validation Rules
Lookup filters
Page Layouts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

To which primitive data type in Apex is a currency field automatically assigned?

A

Decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which data structure is returned to a developer when performing a SOSL search?

A

A List of Lists of SObjects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A developer runs this anonymous code block:
~~~

List<Account> acc = [SELECT Id FROM Account LIMIT 10];
Delete acc;
Database.emptyRecycleBin(acc);
System.debug(Limits.getDMLStatements());
System.debug(Limits.getLimitDMLStatements());
~~~</Account>

What is displayed after this code executes?

A

2
150

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

A developer has the following query:
~~~

Contact c = [SELECT id, firstname, lastname, email
FROM Contact WHERE lastname = ‘Smith’];
~~~

What does the query return if there is no contact with the last name Smith?

A

A System.QueryException that no rows are found

18
Q

A developer writes a SOQL query to find child records for a specific parent. How many levels can be returned in a single query?

A

1

19
Q

What are three data types or collection of data types that SOQL statements populate or evaluate?

A

An integer
a single sObject
a list of sObjects

20
Q

According to the order of execution, in which sequence does Salesforce execute these high-level events upon saving a record?

Before Triggers;
Before Save Flows;
Validation Rules;
Workflow Rules;
After Save Flows;
Flow Automations;
After Triggers;
Commit

A

Validation Rules;
Before Save Flows;
Before Triggers;
Validation Rules;
After Triggers;
Workflow Rules;
Flow Automations;
After Save Flows;
Commit

21
Q

A developer writes a before insert trigger. Which context variable can the developer use to access the incoming records in the trigger body?

A

The Trigger.new Context variable

22
Q

In the execution order of triggers, what three steps happen after the before triggers execute, and before the after triggers execute?

A
  1. The Before triggers are executed
  2. System validation steps are run again and user-defined custom validation rules are checked.
  3. Executes duplicate rules.
  4. The record is saved to the database but doesn’t commit yet.
  5. Executes all after triggers.
23
Q

What are two capabilities of a StandardSetController?

A. It allows pages to perform mass updates of records.
B. It allows pages to perform pagination with large record sets.
C. It extends the functionality of a standard or custom controller.
D. It enforces field-level security when reading large record sets.

A

A. It allows pages to perform mass updates of records.
B. It allows pages to perform pagination with large record sets.

24
Q

A Visualforce page has a standard controller for an object that has a lookup relationship to a parent object. How can a developer display data from the parent record on the page?

A. Use SOQL on the Visualforce page to query for data from the parent record.
B. Add a second standard controller to the page for the parent record.
C. Use a roll-up formula field on the child record to include data from the parent record.
D. Use merge field syntax to retrieve data from the parent record.

A

D. Use merge field syntax to retrieve data from the parent record.

24
Q

What are two reasons that a developer should use a custom Visualforce page in a Lightning Platform application?

A. To generate a PDF document with application data
B. To create components for Dashboard and Layouts
C. To deploy components between two Organizations
D. To modify the page layout settings for a custom object

A

A. To generate a PDF document with application data
B. To create components for Dashboard and Layouts

25
Q

A hierarchy custom setting stores a specific URL for each profile in Salesforce. Which statement can a developer use to retrieve the correct URL for the current user’s profile and display this on a Visualforce Page?

A. {!$Setup.Url_Settings__c.URL__c}
B. {!$Setup.Url_Settings__c.Instance[Profile.Id].URL__c}
C. {!$Setup.Url_Settings__c[Profile.Id].URL__c}
D. {!$Setup.Url_Settings__c[$Profile.Id].URL__c}

A

A. {!$Setup.Url_Settings__c.URL__c}

26
Q

A developer wants to display all of the available record types for a Case object. The developer also wants to display the picklist values for the Case.Status field. The Case object and the Case.Status field are on a custom Visualforce page. Which two actions should the developer perform to get the record types and picklist values in the controller?

A. Use Schema.RecordTypeInfo returned by Case.SObjectType.getDescribe().getRecordTypeInfos().
B. Use SOQL to query case records in the org to get all the RecordType values available for Case.
C. Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues().
D. Use SOQL to query case records in the org to get all values for the Status picklist field.

A

A. Use Schema.RecordTypeInfo returned by Case.SObjectType.getDescribe().getRecordTypeInfos().
C. Use Schema.PicklistEntry returned by Case.Status.getDescribe().getPicklistValues().

27
Q

A developer needs to create a Visualforce page that will override the standard Account edit button. The page will be used to validate the account’s address using a SOQL query. The page will also allow the user to make edits to the address. Where should the developer write the account address verification logic?

A. In a standard extension
B. In a custom controller
C. In a standard controller
D. In a controller extension

A

D. In a controller extension

28
Q

What is the preferred way to reference web content such as images, stylesheets, JavaScript, and other libraries that are used in Visualforce pages?

A

static resource

29
Q

What is the name of the controller for a Visualforce page that is used to override the standard Opportunity view button?

A

The Opportunity StandardController for pre-built functionality

30
Q

Which two tags do you use to load external JavaScript files into a Visualforce page?

A

<apex:includeScript> <script>

31
Q

What is a benefit of the Lightning Component framework?

A. It automatically replicates the classic Salesforce look and feel
B. Better integration with Salesforce Sites
C. More centralized control via server-side logic
D. Better performance for custom Salesforce mobile Apps

A

D. Better performance for custom Salesforce mobile Apps

32
Q

Which tag do you use to display individual fields from a record?

A

<lightning:outputField>

33
Q

Lightning components are available in what three products?

A
  • Salesforce Mobile App
  • Communities
  • Lightning Experience
34
Q

What is the suffix for a Lightning Component resource?

A

*cmp

35
Q

True or False: Lightning Components provide an auto-subscription mechanism for platform events.

A

false

36
Q

True or False? Loading test data in place of user input for Flows is valid for execution by unit tests.

A

true

36
Q

A developer needs to ensure there is sufficient test coverage for an Apex method that interacts with Accounts. The developer needs to create test data. What can the developer use to load this test data into Salesforce?

A

static resources

36
Q

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 user inputs across multiple Visualforce pages and from a parameter on the initial URL. Which three statements are necessary inside the unit test for the custom controller? (Select three answers.)

A. Test.setCurrentPage(pageRef);
B. String nextPage = controller.save().getUrl();
C. ApexPages.currentPage().getParameters().put(‘input’, ‘TestValue’);
D. public ExtendedController(ApexPages.StandardController cntrl) { }

A

A. Test.setCurrentPage(pageRef);
B. String nextPage = controller.save().getUrl();
C. ApexPages.currentPage().getParameters().put(‘input’, ‘TestValue’);

37
Q

Which two types of information does the Checkpoints tab in the Developer Console provide? (Select two answers.)

A. Namespace
B. Exception
C. Time
D. Debug statement

A

A. Namespace
C. Time

38
Q

What is the minimum log level needed to see user-generated debug statements?

A

DEBUG