PD1: Logic and Process Automation Part 1 (46%)

Given the following value from a Lead record, lastModifiedDate:2016-05-06 03:25:41, what data type should the developer use to retrieve this type of information?
Choose 1 answer.

A. Time
B. DateTime
C. Date
D. DateValue

Answer: B

How can a developer access a static variable named TaxRate declared in a different Apex class named TaxCalculation?
Choose 1 answer.

A. TaxCalculation.TaxRate
B. TaxCalculation.TaxRate()
C. (new TaxCalculation()).TaxRate
D. (new TaxCalculation()).TaxRate()

Answer: A

There are several escape sequences that can be used in queries so that a user query can contain special characters. Which of the following are valid escape sequences?
Choose 3 answers.

A. \a
B. \’
C. \c
D. \”
E. \n

Answers: A, D and E

What is the output of the code below?

Integer z = 5;
do {
z = z + 1;
} while(z <= 15); System.debug(z); Choose 1 answer.

A. 16
B. 13
C. 15
D. 14

Answer: A

Which of the following access modifiers are supported in Apex?
Choose 3 answers.

A. private
B. default
C. public
D. restricted
E. global

Answers: A, C and E

A developer needs to get the Contact records with a last name that starts with ‘Ab’. What code in the options below will satisfy his requirements?
Choose 1 answer.

A. SELECT Id, LastName FROM Contact WHERE LastName := ‘Ab%’
B. SELECT Id, LastName FROM Contact WHERE LastName LIKE ‘Ab_’
C. SELECT Id, LastName FROM Contact WHERE LastName IN (‘Ab’)
D. SELECT Id, LastName FROM Contact WHERE LastName LIKE ‘Ab%’

Answer: D

Universal Containers would like to see a Red / Yellow / Green Traffic Light representation on the Opportunity detail page, based on the value in the Opportunity Probability field. What would you use to achieve this?
Choose 1 answer.

A. Master Detail Relationship
B. Image Field
C. Rich Text Field
D. Formula Field

Answer: D

A PageReference is a reference to an instantiation of a page. Which of the following are valid means of instantiating a PageReference?
Choose 2 answers.

A. PageReference.page(‘URL’)
B. PageReference pageRef = new PageReference(‘URL’);
C. Page.existingPageName
D. ApexPages.Page().existingPageName

Answers: B and C

What is the correct syntax for a Do While procedural loop?
Choose 1 answer.

A. do {statement; while (Boolean_condition);}
B. do {while (Boolean_condition); statement;}
C. while (Boolean_condition){ do {statement}}
D. do {statement} while (Boolean_condition);

Answer: D

How can a developer check if a user has read access to a field and the field can be displayed on a Visualforce page?
Choose 1 answer.

A. Call the isViewable() method of Schema.DescribeFieldResult to verify field level read permission
B. Call the isReadable() method of Schema.SObjectResult to verify field level read permission
C. Call the IsAccessible() method of Schema.DescribeSObjectResult to verify field level read permission
D. Call the isAccessible() method of Schema.DescribeFieldResult to verify field level read permission

Answer: D

Apex is typically executed in system mode, but which of the following executes code as the current user?
Choose 1 answer.

A. Apex Triggers
B. Apex Web Service
C. Anonymous Code Blocks
D. Apex Classes

Answer: C

Before deleting a record, a complex validation needs to be performed to confirm that the record can be deleted by querying a number of objects. What solution would be most appropriate in this situation?
Choose 1 answer.

A. Apex Trigger
B. Validation Rule
C. Flow
D. Process Builder

Answer: A

Stock Symbol is a custom field on the Account object. What is the best way to make this field appear on Contact detail page layout?
Choose 1 answer.

A. Requires Apex Code
B. Roll-Up Summary field
C. Parent Field
D. Lookup field
E. Formula Field

Answer: E

Which of the following is required when defining an Apex Class Method?
Choose 1 answer.

A. Access Modifiers
B. Return Data type
C. Definition Modifiers
D. Input parameters

Answer: B

What method can be used to obtain metadata information about all the sObjects in an organization and their fields?
Choose 1 answer.

A. getGlobalDescribe()
B. getGlobalSObjects()
C. describeObjects()
D. describeSObjects()

Answer: A

Which standard objects in the following list are not supported by DML Operations?
Choose 2 answers.

A. Record Type
B. Opportunity Line Item
C. Profile
D. User

Answers: A and C

Universal Insurance uses Salesforce for managing claims. Claims is a custom object. If an email is sent from a claimant regarding an existing claim, it should be checked for a unique reference number and if found, attached to the related claim record, and the status of the claim record updated. What feature would be most appropriate for this requirement?
Choose 1 answer.

A. Email to Case
B. Email to Custom Object
C. Process Builder
D. Custom Email Handler

Answer: D

A company would like to send record information to a legacy system when a criteria is met. A developer can accomplish this requirement by using:
Choose 1 answer.

A. Visual Workflow
B. Workflow Rule with Outbound Message
C. Outbound Notification Rule
D. Assignment Rule

Answer: B

You have a requirement to display the total cost of products at the time they were added to an opportunity. The product cost is a custom field on the product object and is added as a formula field to the opportunity product object. How would you meet this requirement?
Choose 1 answer.

A. A trigger is required to query the product cost values and update the opportunity
B. Create a workflow rule that copies the product cost to a currency field and create a roll-up summary field based on the currency field
C. A trigger is required to sum the values of the product cost formula field
D. Create a roll-up summary field on the opportunity based on the product cost formula field

Answer: B

Given the following options, what are the valid ways to declare a collection variable?
Choose 3 answers.

A. new List<Account>()
B. new Account(<Name = ‘Business Account’>)
C. new Map<Id, Account>()
D. new Contact[]{<elements>}
E. new Integer()

Answers: A, C and D

A developer could use a formula field for which of the following requirements?
Choose 2 answers.

A. Calculate a value based on other values and merge fields in Web-to-Lead forms.
B. Create a link to an application outside of Salesforce, passing parameters including the session Id.
C. Display a traffic light image of red, yellow or green based on case priority.
D. The formula field needs to have a default value, such as the week from the current date.

Answers: B and C

An organization has enabled Multiple Currencies. A developer needs to calculate the total of the Estimated_value__c on CampaignMember object using a roll-up summary field on Campaign object named Total_estimated_value__c. What will be the currency of the Total_estimated_value__c field?
Choose 1 answer.

A. The field values in Estimated_value__c from CampaignMember object are converted into the currency of the current user, and the Total_estimated_value__c is shown using the currency of the current user on the Campaign.
B. The field values in Estimated_value__c from CampaignMember object are summed up, and the Total_estimated_value__c field is shown as a Number field on the Campaign.
C. The field values in Estimated_value__c are converted into the currency of the majority of the CampaignMember records, and the Total_estimated_value__c is shown using that currency.
D. The field values in Estimated_value__c from CampaignMember object are converted into the currency of the Campaign, and the Total_estimated_value__c is shown using the currency of the Campaign.

Answer: D

Developers have proposed a recruiting application that covers job vacancies and respective applications. The business wants to display the number of applications of every job vacancy without inheriting the security of the parent record (job vacancy.) The developer should:
Choose 2 answers.

A. Create a master-detail relationship between Job Vacancy and Job Application.
B. Create a roll up summary on the Job Vacancy object,
C. Create an Apex Trigger that will count all job application on each job and update a field on the parent object.
D. Create a lookup relationship between the 2 objects.

Answers: C and D

Which of the following statements about the IF-ELSE statement are true?
Choose 2 answers.

A. An IF-ELSE statement can have a number of possible execution paths.
B. The IF-ELSE statement provides a secondary path of execution when an IF clause evaluates to true.
C. An IF statement can be followed by a discretionary ELSE statement, which executes when the Boolean expression is false.
D. The IF-ELSE statement permits a choice to be made between two possible execution paths.

Answers: C and D

How can a developer check if the current user is able to delete the current object?
Choose 1 answer.

A. Use the canDelete() method of the SObjectResult Class
B. Use the isDeletable() method of the DescribeSObjectResult Class
C. Use the canDelete() method of the DescribeSObjectResult Class
D. Use the Deletable() method of the SObjectResult Class

Answer: B

What will be the result if the code below is executed when the variable testRawScore is 75?

if (testRawScore >= 90) {
gradeEqual = ‘A’;
} else if (testRawScore >= 80) {
gradeEqual = ‘B’;
} else if (testRawScore >= 70) {
gradeEqual = ‘C’;
} else if (testRawScore >= 60) {
gradeEqual = ‘D’;
}

System.debug(gradeEqual);

Choose 1 answer.

A. A
B. D
C. B
D. C

Answer: D

Which of the following statements about defining an Apex Class are true?
Choose 3 answers.

A. An access modifier is required in the declaration of a top-level class
B. A definition modifier is required in the top-level class.
C. The keyword [class] followed by the name of the class is necessary
D. A developer may add optional extensions and/or implementations.
E. The keyword [class] is required if no access modifier is present.

Answers: A, C and D

A developer executes the code below:

If (isCorrect) {
System.debug(‘The value of x is True’);
} else if (!isCorrect) {
System.debug(‘The value of x is False’);
} else {
System.debug(‘The value of x is Null’);
}

How should the developer declare the variable ‘isCorrect’?
Choose 1 answer.

A. Blob isCorrect;
B. String isCorrect;
C. Boolean isCorrect;
D. Enum isCorrect;

Answer: C

The developer executes the code below and an error is returned indicating that a variable is not properly declared.

String str = new String();
public void stringDisplay() {
str = ‘Hello’;
system.debug(str);
}

What is the proper way of declaring a String data type variable?
Choose 1 answer.

A. Text str;
B. String new = str String();
C. String str;
D. String = str();

Answer: C

Which of the following statements are true when defining Apex classes?
Choose 2 answers.

A. It is optional to specify an access modifier in declaring inner class.
B. It is optional to specify an access modifier in declaring a top-level class.
C. A top-level class can have multiple levels of inner classes.
D. It is required to specify an access modifier in declaring top-level class.

Answers: A and D

Which of the following tasks are best achieved using Process Builder instead of Workflow Rules?
Choose 2 answers.

A. Copying the Account postal code to all child contacts
B. Field update on parent object.
C. Submitting an Order for approval
D. Creating tasks at multiple intervals

Answers: A and C

Which of the following field types can a Roll-Up Summary field calculate?
Choose 1 answer.

A. Number
B. Picklist
C. Text
D. Checkbox

Answer: A

Steadfast Insurance Inc. has a custom object [Claim] to track insurance claims for its team members. When a team member creates a claim record, an approval process is started which is used by the insurance manager to approve or reject the claim. In order to assist the manager, a team member’s claim limit, which is a custom field on the User object, should be displayed on the claim record. How can this be developed?
Choose 1 answer.

A. Use a field update in a workflow rule to copy the team member’s claim limit onto the claim record
B. Use a cross-object formula to display the user’s limit on the claim record
C. Use Process Builder to populate the user limit field when the claim is created
D. Use a trigger to populate the user limit field when the claim is created

Answer: B

A developer notices that the code below returns only 20 Account records though she expected 60. Which of the following is true regarding SOSL query limits?

FIND {test} RETURNING Account(id), Contact, Opportunity LIMIT 60
Choose 1 answer.

A. The SOSL Syntax is incorrect.
B. Limits have to be individually assigned per object.
C. Results were evenly distributed among the objects returned.
D. Limits cannot be set in SOSL queries

Answer: C

Which of the following DML operations will allow other records in a list to be inserted even if there are records that failed?
Choose 1 answer.

A. insert sObjectsToCreate;
B. upsert sObjectsToCreate;
C. Database.insert(sObjectsToCreate,false);
D. Database.insert(sObjectsToCreate,true);

Answer: C

Which data type is appropriate for a numerical value of 726.234 stored in the variable totalCost?
Choose 1 answer.

A. Numeric totalCost;
B. Decimal totalCost;
C. Integer totalCost;
D. Long totalCost;

Answer: B

What is the discretionary clause that can be added to a SOSL query to specify the information to be returned in the text search result?
Choose 1 answer.

A. ORDER by
B. RETURNING
C. LIMIT n
D. OFFSET n

Answer: B

How can a developer ensure that a variable ‘Day’ will only contain specific set of constants such as SUNDAY, MONDAY, TUESDAY…..SATURDAY? What should variable ‘Day’ be declared as?
Choose 1 answer.

A. list<String>Day{ SUNDAY, MONDAY, …..SATURDAY}
B. map<Id, String>Day{ SUNDAY, MONDAY, …..SATURDAY}
C. set<String>Day{ SUNDAY, MONDAY, …..SATURDAY}
D. enum Day{ SUNDAY, MONDAY, …SATURDAY}

Answer: D

What should a developer consider when using the upsert operation to insert and update records?
Choose 3 answers.

A. Using the upsert operation, the administrator can either insert or update an existing record in one call.
B. To determine whether a record already exists, the upsert statement or Database method uses the ID of the record as the key to match records, a custom external ID field, or a standard field with the idLookup attribute set to true.
C. If the key is not matched, a new object record is created. If the key is matched once, the existing object record is updated.
D. If the key is matched multiple times, the existing object record is updated based on the latest match.
E. Using the upsert operation, the administrator can either insert, update or delete a record in one call.

Answers: A, B and C

Which correctly describes the code snippet below?

public with sharing class containerClass {
//Insert code here
public class innerClass {
//Insert code here
}
}

Choose 2 answers.

A. [without sharing] will be the default for the inner class
B. The [with/without sharing] keyword should only be defined in outer classes.
C. The innerClass does not inherit the sharing setting of the containerClass.
D. The innerClass inherits the sharing setting of the containerClass.

Answers: A and C

Which of the following are true about cross-object formula fields?
Choose 3 answers.

A. For every object, cross-object formula fields can be used in 3 roll-up summaries.
B. Cross-object formula fields can pull field values from master-detail or lookup parent records.
C. Cross-object formula fields can pull data from a record even if the user does not have access to it.
D. Cross-object formula fields can pull field values from its child records.
E. Cross-object formula fields can pull field values from objects that are up to 10 relationships away.

Answers: B, C and E

How can a developer get all picklist values of a specific field via Apex?
Choose 1 answer.

A. Use the describePicklist method
B. Use the fieldPicklist method
C. Use the globalPicklist method
D. Use the getPicklistValues method

Answer: D

Which of the following can be used to update existing standard and custom fields on child records automatically when a parent record is modified?
Choose 2 answers.

A. Formula field
B. Apex Trigger
C. Workflow Rule
D. Process Builder

Answers: B and D

In Apex, an expression is a construct made up of variables, operators, and method invocations that evaluates to a single value. Which of the following are valid Apex expressions?
Choose 3 answers.

A. @future
B. myClass.myMethod()
C. new List<Opportunity>()
D. 3 + 4

Answers: B, C and D

A developer needs to create a new Contact record in his Apex Trigger. What DML statement should be used in the code?
Choose 1 answer.

A. Merge
B. Insert
C. Upsert
D. Create

Answer: B

Which of the following are valid Apex variables?
Choose 3 answers.

A. Map<ID, String> sampleMap;
B. Currency abc;
C. String a,b,c;
D. Number x;
E. Boolean y;

Answers: A, C and E

An administrator needs to get records with locations saved in geolocation or address fields as individual latitude and longitude values.
Which SOQL statement accomplishes this goal?
Choose 1 answer.

A. SELECT Id, Name, Location__r.latitude, Location__r.longitude FROM CustomObject__c
B. SELECT Id, Name, Location__r.latitude__c, Location__r.longitude__c FROM CustomObject__c
C. SELECT Id, Name, Location__latitude__c, Location__longitude__c FROM CustomObject__c
D. SELECT Id, Name, Location__latitude__s, Location__longitude__s FROM CustomObject__c

Answer: D

What is the method in the second line of the code snippet below called?

public class sampleClass() {
public sampleClass() {
//logic here
}

public void sampleMethod() {
//logic here
}
}

Choose 1 answer.

A. Constructor
B. Modifier
C. Initiator
D. Extension

Answer: A

A developer is considering writing a trigger to perform data validation before saving a record. What other options can be used for data quality checks?
Choose 3 answers.

A. Validation rules
B. Required fields
C. Picklists
D. Escalation rules

Answers: A, B and C

The Stage field of all related Opportunity records should be updated to [Closed Lost], when the associated Account record becomes Inactive. What could be used for this?
Choose 1 answer.

A. Workflow rule
B. Process Builder
C. Approval Process
D. Flow

Answer: B

Which of the following statements about delete and undelete DML operations are true?
Choose 3 answers.

A. Restoring all custom lookup relationships is supported by the undelete operation.
B. Parent accounts (as specified in the Parent Account field on an account) are supported by the undelete operation.
C. The undelete operation does not restore the record associations for parent cases.
D. Salesforce can restore lookup relationships that have been replaced.
E. When there is a master-detail relationship, if a parent record is deleted, its children are automatically deleted.

Answers: A, B and E

A developer requires a variable numberOfStudents with a constant value of 25 that is accessible only within the Apex class in which it is defined. Which of the following is the best variable declaration?
Choose 1 answer.

A. private static final Integer numberOfStudents = 25;
B. protected final Integer numberOfStudents = 25;
C. global static Integer numberOfStudents = 25;
D. public Integer numberOfStudents = 25;

Answer: A

What will be the output if the code below is executed when the value of testRawScore variable is 75?
if (testRawScore >= 90) {
gradeEqual = ‘A’;
}
if (testRawScore >= 80) {
gradeEqual = ‘B’;
}
if (testRawScore >= 70) {
gradeEqual = ‘C’;
}
if (testRawScore >= 60) {
gradeEqual = ‘D’;
}
System.debug(‘Value of gradeEqual = ‘ + gradeEqual);
Choose 1 answer.

A. Value of gradeEqual = A
B. Value of gradeEqual = B
C. Value of gradeEqual = C
D. Value of gradeEqual = D

Answer: D

Which of the following are valid use cases of Apex code?
Choose 3 answers.

A. Triggers
B. Web Service
C. Server-side calls from custom Lightning components
D. Custom button with Javascript
E. Visualforce pages with standard controllers

Answers: A, B and C

To fulfill a business requirement, a formula field of a child object has been used in a roll-up summary field of a Master object. Will the roll-up summary field function correctly?
Choose 1 answer.

A. No, using formula fields in a roll-up summary is not supported.
B. Yes, only if the formula field has a numeric value
C. Yes, if the formula field is not referring to another field in a different object
D. Yes, using formula fields in a roll-up summary is fully supported

Answer: C

How would a developer write a query to return the number of leads for each lead source?
Choose 1 answer.

A. SELECT COUNT(LeadSource) FROM Lead
B. SELECT GROUP(LeadSource) FROM Lead
C. SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY LeadSource
D. SELECT COUNT(*) FROM Lead GROUP BY LeadSource

Answer: C

When should a static method or variable be used?
Choose 3 answers.

A. A developer needs to access a method without instantiating a class.
B. To store information that is shared across instances of a class
C. To use as a utility method
D. When the static variable value should persist beyond the context of a single transaction

Answers: A, B and C

In the following line of code, why can the helloWorld() method be called directly instead of instantiating the myClass?

myClass.helloWorld(‘Hello’);
Choose 1 answer.

A. helloWorld is defined as a static method
B. helloWorld is defined as a void method
C. myClass is defined as a static class
D. myClass is defined as public

Answer: A

A developer needs to initialize a numerical value of 17. What data type should the developer use?
Choose 1 answer.

A. String
B. Blob
C. Integer
D. Numeric

Answer: C

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.