Salesforce CRT-450 : Salesforce Certified Platform Developer I Part 1
Question #: 1
Topic #: 1
Which statement results in an Apex compiler error?
- Map lmap = new Map([Select ID from Lead Limit 8]);
B. Date d1 = Date.Today(), d2 = Date.ValueOf(‘2018-01-01’);
C. Integer a=5, b=6, c, d = 7;
D. List s = List{‘a’,’b’,’c’);
Selected Answer: D
Question #: 2
Topic #: 1
What are two benefits of the Lightning Component framework? (Choose two.)
- It simplifies complexity when building pages, but not applications.
B. It provides an event-driven architecture for better decoupling between components.
C. It promotes faster development using out-of-box components that are suitable for desktop and mobile devices.
D. It allows faster PDF generation with Lightning components.
Selected Answer: BC
Question #: 3
Topic #: 1
A method is passed a list of generic sObjects as a parameter.
What should the developer do to determine which object type (Account, Lead, or Contact, for example) to cast each sObject?
- Use the first three characters of the sObject ID to determine the sObject type.
B. Use the getSObjectType method on each generic sObject to retrieve the sObject token.
C. Use the getSObjectName method on the sObject class to get the sObject name.
D. Use a try-catch construct to cast the sObject into one of the three sObject types.
Selected Answer: B
Question #: 4
Topic #: 1
What should a developer use to implement an automatic Approval Process submission for Cases?
- An Assignment Rule
B. Scheduled Apex
C. Process Builder
D. A Workflow Rule
Selected Answer: C
Question #: 5
Topic #: 1
When viewing a Quote, the sales representative wants to easily see how many discounted items are included in the Quote Line Items.
What should a developer do to meet this requirement?
- Create a trigger on the Quote object that queries the Quantity field on discounted Quote Line Items.
B. Create a Workflow Rule on the Quote Line Item object that updates a field on the parent Quote when the item is discounted.
C. Create a roll-up summary field on the Quote object that performs a SUM on the quote Line Item Quantity field, filtered for only discounted Quote Line Items.
D. Create a formula field on the Quote object that performs a SUM on the Quote Line Item Quantity field, filtered for only discounted Quote Line Items.
Selected Answer: C
Question #: 6
Topic #: 1
A Developer wants to get access to the standard price book in the org while writing a test class that covers an OpportunityLineItem trigger.
Which method allows access to the price book?
- Use Test.getStandardPricebookId() to get the standard price book ID.
B. Use @IsTest(SeeAllData=true) and delete the existing standard price book.
C. Use Test.loadData() and a Static Resource to load a standard price book.
D. Use @TestVisible to allow the test method to see the standard price book.
Selected Answer: A
Question #: 7
Topic #: 1
Which two Apex data types can be used to reference a Salesforce record ID dynamically? (Choose two.)
- ENUM
B. sObject
C. External ID
D. String
Selected Answer: BD
Question #: 8
Topic #: 1
Where can a developer identify the time taken by each process in a transaction using Developer Console log inspector?
- Performance Tree tab under Stack Tree panel
B. Execution Tree tab under Stack Tree panel
C. Timeline tab under Execution Overview panel
D. Save Order tab under Execution Overview panel
Selected Answer: C
Question #: 9
Topic #: 1
Which two platform features align to the Controller portion of MVC architecture? (Choose two.)
- Process Builder actions
B. Workflow rules
C. Standard objects
D. Date fields
Selected Answer: AB
Question #: 10
Topic #: 1
A developer needs to test an Invoicing system integration. After reviewing the number of transactions required for the test, the developer estimates that the test data will total about 2 GB of data storage. Production data is not required for the integration testing.
Which two environments meet the requirements for testing? (Choose two.)
- Developer Sandbox
B. Full Sandbox
C. Developer Edition
D. Partial Sandbox
E. Developer Pro Sandbox
Selected Answer: BD
Question #: 11
Topic #: 1
A developer working on a time management application wants to make total hours for each timecard available to application users. A timecard entry has a Master-
Detail relationship to a timecard.
Which approach should the developer use to accomplish this declaratively?
- A Visualforce page that calculates the total number of hours for a timecard and displays it on the page
B. A Roll-Up Summary field on the Timecard Object that calculates the total hours from timecard entries for that timecard
C. A Process Builder process that updates a field on the timecard when a timecard entry is created
D. An Apex trigger that uses an Aggregate Query to calculate the hours for a given timecard and stores it in a custom field
Selected Answer: B
Question #: 12
Topic #: 1
A developer encounters APEX heap limit errors in a trigger.
Which two methods should the developer use to avoid this error? (Choose two.)
- Use the transient keyword when declaring variables.
B. Query and store fields from the related object in a collection when updating related objects.
C. Remove or set collections to null after use.
D. Use SOQL for loops instead of assigning large queries results to a single collection and looping through the collection.
Selected Answer: AD
Question #: 13
Topic #: 1
Which approach should be used to provide test data for a test class?
- Query for existing records in the database.
B. Execute anonymous code blocks that create data.
C. Use a test data factory class to create test data.
D. Access data in @TestVisible class variables.
Selected Answer: C
Question #: 14
Topic #: 1
Which approach should a developer take to automatically add a `Maintenance Plan` to each Opportunity that includes an `Annual Subscription` when an opportunity is closed?
- Build a OpportunityLineItem trigger that adds a PriceBookEntry record.
B. Build an OpportunityLineItem trigger to add an OpportunityLineItem record.
C. Build an Opportunity trigger that adds a PriceBookEntry record.
D. Build an Opportunity trigger that adds an OpportunityLineItem record.
Selected Answer: D
Question #: 15
Topic #: 1
Which two statements are true about using the @testSetup annotation in an Apex test class? (Choose two.)
- The @testSetup annotation cannot be used when the @isTest(SeeAllData=True) annotation is used.
B. Test data is inserted once for all test methods in a class.
C. Records created in the @testSetup method cannot be updates in individual test methods.
D. The @testSetup method is automatically executed before each test method in the test class is executed.
Selected Answer: AB
Question #: 16
Topic #: 1
What is the requirement for a class to be used as a custom Visualforce controller?
- Any top-level Apex class that has a constructor that returns a PageReference
B. Any top-level Apex class that extends a PageReference
C. Any top-level Apex class that has a default, no-argument constructor
D. Any top-level Apex class that implements the controller interface
Selected Answer: C
Question #: 17
Topic #: 1
A Visualforce page is required for displaying and editing Case records that includes both standard and custom functionality defined in an Apex class called myControllerExtension.
The Visualforce page should include which attribute(s) to correctly implement controller functionality?
- controller=ג€Caseג€ and extensions=ג€myControllerExtensionג€
B. extensions=ג€myControllerExtensionג€
C. controller=ג€myControllerExtensionג€
D. standardController=ג€Caseג€ and extensions=ג€myControllerExtensionג€
Selected Answer: D
Question #: 18
Topic #: 1
A newly hired developer discovers that there are multiple triggers on the case object.
What should the developer consider when working with triggers?
- Developers must dictate the order of trigger execution.
B. Trigger execution order is based on creation date and time.
C. Unit tests must specify the trigger being tested.
D. Trigger execution order is not guaranteed for the same sObject.
Selected Answer: D
Question #: 19
Topic #: 1
How should a developer prevent a recursive trigger?
- Use a ג€one trigger per objectג€ pattern.
B. Use a static Boolean variable.
C. Use a trigger handler.
D. Use a private Boolean variable.
Selected Answer: C
Question #: 20
Topic #: 1
Which three options can be accomplished with formula fields? (Choose three.)
- Generate a link using the HYPERLINK function to a specific record.
B. Display the previous value for a field using the PRIORVALUE function.
C. Determine if a datetime field value has passed using the NOW function.
D. Return and display a field value from another object using the VLOOKUP function.
E. Determine which of three different images to display using the IF function.
Selected Answer: ACE
Question #: 21
Topic #: 1
What is a capability of the tag that is used for loading external Javascript libraries in Lightning Component? (Choose three.)
- Loading files from Documents.
B. One-time loading for duplicate scripts.
C. Specifying loading order.
D. Loading scripts in parallel.
E. Loading externally hosted scripts.
Selected Answer: BCD
Question #: 22
Topic #: 1
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 two.)
- Make an outbound web services call to the SOAP API.
B. Hardcode the ID as a constant in an Apex class.
C. Use the getRecordTypeInfosByName() method in the DescribeSObjectResult class.
D. Execute a SOQL query on the RecordType object.
Selected Answer: CD
Question #: 23
Topic #: 1
A developer has the controller class below.
Which code block will run successfully in an execute anonymous window?
- myFooController m = new myFooController(); System.assert(m.prop !=null);
B. myFooController m = new myFooController(); System.assert(m.prop ==0);
C. myFooController m = new myFooController(); System.assert(m.prop ==null);
D. myFooController m = new myFooController(); System.assert(m.prop ==1);
Selected Answer: C
Question #: 24
Topic #: 1
In a single record, a user selects multiple values from a multi-select picklist.
How are the selected values represented in Apex?
- As a List with each value as an element in the list
B. As a String with each value separated by a comma
C. As a String with each value separated by a semicolon
D. As a Set with each value as an element in the set
Selected Answer: C
Question #: 25
Topic #: 1
A developer writes the following code:
What is the result of the debug statement?
- 1, 100
B. 1, 150
C. 2, 150
D. 2, 200
Selected Answer: C
Question #: 26
Topic #: 1
What are two valid options for iterating through each Account in the collection List named AccountList? (Choose two.)
- for (Account theAccount : AccountList) {ג€¦}
B. for(AccountList) {ג€¦}
C. for (List L : AccountList) {ג€¦}
D. for (Integer i=0; i < AccountList.Size(); i++) {ג€¦}
Selected Answer: AD
Question #: 27
Topic #: 1
Given:
Map accountMap = new Map>ID, Account> ([SELECT Id, Name FROM Account]);
What are three valid Apex loop structures for iterating through items in the collection? (Choose three.)
- for (ID accountID : accountMap.keySet()) {ג€¦}
B. for (Account accountRecord : accountMap.values()) {ג€¦}
C. for (Integer i=0; I < accountMap.size(); i++) {ג€¦}
D. for (ID accountID : accountMap) {ג€¦}
E. for (Account accountRecord : accountMap.keySet()) {ג€¦}
Selected Answer: ABC
Question #: 28
Topic #: 1
Universal Containers wants Opportunities to be locked from editing when reaching the Closed/Won stage.
Which two strategies should a developer use to accomplish this? (Choose two.)
- Use a Visual Workflow.
B. Use a validation rule.
C. Use the Process Automation Settings.
D. Use a Trigger.
Selected Answer: BD
Question #: 29
Topic #: 1
How should a developer make sure that a child record on a custom object, with a lookup to the Account object, has the same sharing access as its associated account?
- Create a Sharing Rule comparing the custom object owner to the account owner.
B. Create a validation rule on the custom object comparing the record owners on both records.
C. Include the sharing related list on the custom object page layout.
D. Ensure that the relationship between the objects is Master-Detail.
Selected Answer: D
Question #: 30
Topic #: 1
An org has a single account named `˜NoContacts’ that has no related contacts. Given the query:
List accounts = [Select ID, (Select ID, Name from Contacts) from Account where Name=`˜NoContacts’];
What is the result of running this Apex?
- accounts[0].contacts is invalid Apex.
B. accounts[0].contacts is an empty Apex.
C. accounts[0].contacts is Null.
D. A QueryException is thrown.
Selected Answer: D
Question #: 31
Topic #: 1
A platform developer at Universal Containers needs to create a custom button for the Account object that, when clicked, will perform a series of calculations and redirect the user to a custom Visualforce page.
Which three attributes need to be defined with values in the tag to accomplish this? (Choose three.)
- action
B. renderAs
C. standardController
D. readOnly
E. extensions
Selected Answer: ACE
Question #: 32
Topic #: 1
Using the Schema Builder, a developer tries to change the API name of a field that is referenced in an Apex test class.
What is the end result?
- The API name is not changed and there are no other impacts.
B. The API name of the field and the reference in the test class is changed.
C. The API name of the field is changed, and a warning is issued to update the class.
D. The API name of the field and the reference in the test class is updated.
Selected Answer: A
Question #: 33
Topic #: 1
When is an Apex Trigger required instead of a Process Builder Process?
- When a record needs to be created
B. When multiple records related to the triggering record need to be updated
C. When a post to Chatter needs to be created
D. When an action needs to be taken on a delete or undelete, or before a DML operation is executed.
Selected Answer: D
Question #: 34
Topic #: 1
A developer needs to join data received from an integration with an external system with parent records in Salesforce. The data set does not contain the
Salesforce IDs of the parent records, but it does have a foreign key attribute that can be used to identify the parent.
Which action will allow the developer to relate records in the data model without knowing the Salesforce ID?
- Create and populate a custom field on the parent object marked as Unique.
B. Create a custom field on the child object of type External Relationship.
C. Create and populate a custom field on the parent object marked as an External ID.
D. Create a custom field on the child object of type Foreign Key.
Selected Answer: C
Question #: 35
Topic #: 1
A developer created a Lightning component to display a short text summary for an object and wants to use it with multiple Apex classes.
How should the developer design the Apex classes?
- Have each class define method getObject() that returns the sObject that is controlled by the Apex class.
B. Extend each class from the same base class that has a method getTextSummary() that returns the summary.
C. Have each class implement an interface that defines method getTextSummary() that returns the summary.
D. Have each class define method getTextSummary() that returns the summary.
Selected Answer: B
Question #: 36
Topic #: 1
Which approach should a developer use to add pagination to a Visualforce page?
- A StandardController
B. The Action attribute for a page
C. The extensions attribute for a page
D. A StandardSetController
Selected Answer: D
Question #: 37
Topic #: 1
A developer is asked to create a PDF quote document formatted using the company’s branding guidelines, and automatically save it to the Opportunity record.
Which two ways should a developer create this functionality? (Choose two.)
- Install an application from the AppExchange to generate documents.
B. Create a Visualforce page with custom styling.
C. Create an email template and use it in Process Builder.
D. Create a visual flow that implements the company’s formatting.
Selected Answer: AB
Question #: 38
Topic #: 1
Which tool allows a developer to send requests to the Salesforce REST APIs and view the responses?
- REST resource path URL
B. Workbench REST Explorer
C. Developer Console REST tab
D. Force.com IDE REST Explorer tab
Selected Answer: B
Question #: 39
Topic #: 1
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?
- Create a test class that provides coverage of the Visualforce page.
B. Create a test page that provides coverage of the Visualforce page.
C. Create a test page that provides coverage of the custom controller.
D. Create a test class that provides coverage of the custom controller.
Selected Answer: C
Question #: 40
Topic #: 1
What is a benefit of using an after insert trigger over using a before insert trigger?
- An after insert trigger allows a developer to bypass validation rules when updating fields on the new record.
B. An after insert trigger allows a developer to insert other objects that reference the new record.
C. An after insert trigger allows a developer to make a callout to an external service.
D. An after insert trigger allows a developer to modify fields in the new record without a query.
Selected Answer: B