Salesforce Platform Developer II Exam Practice Test

Page: 1 / 14
Total 202 questions
Question 1

What is a benefit of JavaScript remoting over Visualforce Remote Objects?



Answer : B

JavaScript remoting in Visualforce allows for the execution of complex server-side application logic without the need to refresh the entire page, providing a more dynamic user experience. It supports more complex operations than Visualforce Remote Objects, which are intended for basic CRUD operations. Reference: Visualforce Developer Guide - JavaScript Remoting


Question 2

A developer wrote a class named asccuntRisteryManager that relies on field history tracking. The class has a static method called getaccountHistory that Lakes in an Account as a parameter and returns a list of associated accountHistory object records.

The following test fails:

What should be done to make this test pass?



Answer : B

To make the test pass, @isTest(SeeAllData=true) should be used to allow the test to access historical data from the org. This is required because field history tracking data is not copied to a test context, so you need to allow the test to access live data to assert against it. Reference: Apex Developer Guide - IsTest Annotation


Question 3

Universal Containers needs to integrate with their own, existing, internal custom web application. The web application accepts JSON payloads, resizes product images, and sends the resized images back to Salesforce.

What should the developer use to implement this integration?



Answer : A

In a scenario where an integration requires making a callout to an external web application, Apex is often used to perform callouts. The callout must be asynchronous when being made from a trigger because a callout cannot be made from a synchronous operation like a trigger due to the possibility of long-running transactions.

Option A (An Apex trigger that calls an @future method that allows callouts) is correct because it enables the trigger to perform an asynchronous callout to the external web application, which is necessary for sending JSON payloads and receiving the resized images.

Options B, C, and D do not fit the requirement as well as option A because platform events and flows are typically not used for making direct callouts to external systems in the context described.


Apex Developer Guide: Apex Web Services and Callouts

Question 4

A company has a native iOS order placement app that needs to connect to Salesforce to retrieve consolidated information from many different objects in a

JSON format.

Which is the optimal method to implement this in Salesforce?



Answer : A

Apex REST web services are the best method for creating custom endpoints that return data in a specific format, such as JSON, which is perfect for a native iOS application that needs to integrate with Salesforce for retrieving data. Reference: Apex Developer Guide - Exposing Apex Methods as REST Web Services


Question 5

Universal Containers (UC) has enabled the translation workbench and has translated picklist values. UC has a custom multi-select picklist field, Product__c, on the Account object that allows sales reps to specify which of UC's products an Account already has. A developer is tasked with writing an Apex method that retrieves Account records, including the Product_c field.

What should the developer do to ensure the value of Products__c is in the current user's language?



Answer : A

Using toLabel() in the SOQL query ensures that picklist values are returned in the user's language, which is necessary for organizations that have the translation workbench enabled.


Multi-language Solutions: [Salesforce Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_s

Question 6

A developer created a Lightning web component mat allows users to Input a text value that is used to search for Accounts by calling an Apex method. The Apex method returns a list of account to apply and is called imperatively from a JavaScript event handler.

Which two changes should the developer make so the Apex method functions correctly.

Choose 2 answers



Answer : B, C


Question 7

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that user encounter view state errors when using it in production.

What should the developer ensure to correct these errors?



Answer : C

The view state in Visualforce represents the state of the page - including the components, field values, and controller state. This error usually occurs when the page's view state becomes too large. To resolve this issue:

C . Ensure variables are marked as transient: The transient keyword in Apex can be used to declare instance variables that should not be part of the view state and therefore not be saved. This is especially useful for large data that does not need to be maintained across postbacks.

Marking properties as private (Option B) or ensuring queries do not exceed governor limits (Option A) might be best practices, but they do not directly impact the view state size. Ensuring profiles have access to the Visualforce page (Option D) is a matter of visibility and access, not related to view state errors.


Salesforce Developer Documentation on View State: Visualforce View State

Page:    1 / 14   
Total 202 questions