DON'T WANT TO MISS A THING?

Certification Exam Passing Tips

Latest exam news and discount info

Curated and up-to-date by our experts

Yes, send me the newsletter

Salesforce Platform Developer II Exam Questions and Answers, | SPOTO

SPOTO's latest exam dumps on the homepage, with a 100% pass rate! SPOTO delivers authentic Cisco CCNA, CCNP study materials, CCIE Lab solutions, PMP, CISA, CISM, AWS, and Palo Alto exam dumps. Our comprehensive study materials are meticulously aligned with the latest exam objectives. With a proven track record, we have enabled thousands of candidates worldwide to pass their IT certifications on their first attempt. Over the past 20+ years, SPOTO has successfully placed numerous IT professionals in Fortune 500 companies.
Take other online exams

Question #1
A developer is writing a Visualforce page that queries accounts in the system and presents a data table with the results. The users want to be able to filter the results based on up to five fields. However, the users want to pick the five fields to use as filter fields when they run the page. Which feature of Apex code is required to facilitate this solution?
A. SOSL queries
B. describeSObjects()correct
C. Dynamic Schema binding
D. REST API
View answer
Correct Answer: B
Question #2
Universal Containers allows customers to log into a Salesforce Community and update their orders via a custom Visualforce page. Universal Containers' sales representatives can edit the orders on the same Visualforce page. What should a developer use in an Apex test class to test that record sharing is enforced on the Visualforce page?
A. Use System
B. Use System
C. Use System
D. Use System
View answer
Correct Answer: C
Question #3
A developer created a Lightning web component that uses a lightning-record-edit-form to collect information about Leads. Users complain that they only see one error message at a time about their input when trying to save a Lead record. What is the recommended approach to perform validations on more than one field, and display multiple error messages simultaneously with minimal JavaScript intervention?
A. Try/catch/finally block
B. External JavaScript library
C. Validation rules
D. Apex trigger
View answer
Correct Answer: B
Question #4
The test method above tests an Apex trigger that the developer knows will make a lot of queries when a lot of Account are simultaneously updated to be customer. The test method fails at the Line 20 because of too many SOQL queries What is the correct way to fix this?
A. Add TesLstartTest() before and Test
B. Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced
C. Add TeststartTest() before Line 18 of the code and add Test
D. Replace most of the Apex Trigger with Process Builder processes to reduce the number of queries in the trigger
View answer
Correct Answer: C
Question #5
What should a developer use to query all Account fields for the Acme account in their sandbox?
A. SELECT FROM ACCOUNT WHERE Name = ‘Acme’ LIMIT 1
B. SELECT ALL FROM Account WHERE Name = ‘Acme’ LIMIT 1
C. SELECT FIELDS FROM Account WHERE Name = ‘Acme’ LIMIT 1
D. SELECT FIELDS (ALL) FROM Account WHERE Name = ‘Acme’ LIMIT 1correct
View answer
Correct Answer: D
Question #6
The test method above calls an @future method that increments the Number_of_Times_Viewed__c value. The assertion is failing because the Number_of_Times_Viewed__c equals 0. @isTest static void testIncrement() { Account acct = new Account(Name = 'Test'); acct.Number_Of_Times_Viewed__c = 0; insert acct; AuditUtil.incrementViewed(acct.Id); Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id = :acct.Id][0] System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c); } What is the optimal
A. Change the initialization to acct
B. Add Test
C. Add Test
D. Change the assertion to System
View answer
Correct Answer: B
Question #7
Business rules require a Contact to always be created when a new Account is created. What can be used when developing a custom screen to ensure an Account is not created if the creation of the Contact fails?
A. Use the Database
B. Use the Database
C. Disable Validation rules on Contacts and set default values with a Trigger
D. Use setSavePoint() and rollback() with a try/catch block
View answer
Correct Answer: D
Question #8
Which two relationship queries use the proper syntax? (Choose two.)
A. SELECT Id, Name, Account__r
B. SELECT Name, (SELECT LastName FROM Contacts__r) FROM Account
C. SELECT Name, (SELECT LastName FROM Contacts) FROM Accountcorrect
D. SELECT Id, Name, Account
View answer
Correct Answer: ACD
Question #9
A developer wants to write a generic Apex method that will compare the Salesforce Name filed between any two object records, for example to compare the Name field of an Account and an Opportunity; or the name of an Account and a Contact. How should the developer do this?
A. Use a String
B. Invoke a Schema,describe() function to compare the values of each Name field
C. Cast each object into an sObject and use sObject
D. Use the salesforce metadata API to extract the value of each object and compare the name fields
View answer
Correct Answer: C
Question #10
A company has a web page that needs to get Account record information, given its Salesforce record ID, from JavaScript on the page and then display it. Which method of integration is optimal?
A. REST APIcorrect
B. Apex SOAP Web Service
C. Soap API
D. Apex REST Web Service
View answer
Correct Answer: A
Question #11
A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?
A. Use Javascript to move data processing to the browser instead of the controller
B. Use the transient keywords for the List variables used in the custom controller
C. Use lazy loading to load the data on demand, instead of the controller's constructor
D. Use an in the page to load all of the data asynchronously
View answer
Correct Answer: C
Question #12
Instead of waiting to send emails to support personnel directly from the finish method of a batch Apex process, Universal Containers wants to notify an external system in the event that an unhandled exception occurs. What is the appropriate publish/subscribe logic to meet this requirement?
A. Publish the error event using the Eventbus
B. No publishing is necessary
C. Publish the error event using the addError method
D. Publish the error event with a Flow
View answer
Correct Answer: B
Question #13
Consider the above trigger intended to assign the Account to the manager of the Account’s region. trigger AssignOwnerByRegion on Account ( before insert, before update ) { List accountList = new List(); for( Account anAccount : trigger.new ) { Region__c theRegion = [ SELECT Id, Name, Region_Manager__c FROM Region__c WHERE Name = :anAccount.Region_Name__c ]; anAccount.OwnerId = theRegion.Region_Manager__c; accountList.add( anAccount ); } update accountList; } Which two changes should a deve
A. Use a Map to cache the results of the Region__c query by Id
B. Move the Region__c query to outside the loop
C. Remove the last line updating accountList as it is not needed
D. Use a Map accountMap instead of List accountList
View answer
Correct Answer: ABC
Question #14
A developer has a Batch Apex process, Batch_Account_Sales, that updates the sales amount for 10,000 Accounts on a nightly basis. The Batch Apex works as designed In the sandbox. However, the developer cannot get code coverage on the Batch Apex class. The test class is below: What is causing the code coverage problem?
A. The batch process will not recognize new accounts created in the same session
B. The account creation already sets the sates amount to 0
C. The execute Batch must fail within test
D. The batch needs more than one account record created
View answer
Correct Answer: C
Question #15
A company has a Lightning Page with many Lightning Components, some that cache reference data. It is reported that the page does not always show the most current reference data. What can a developer use to analyze and diagnose the problem in the Lightning Page?
A. Salesforce Lightning Inspector Actions Tab
B. Salesforce Lightning Inspector Event Log Tab
C. Salesforce Lightning Inspector Transactions Tab
D. Salesforce Lightning Inspector Storage Tabcorrect
View answer
Correct Answer: D
Question #16
A developer is creating a Lightning web component that contains a child component. The property stage is being passed from the parent to the child. The public property is changing, but the setOppList function is not being invoked. What should the developer change to allow this?
A. Move the logic from connectedCalIback() to constructor()
B. Create a custom event from the parent component to set the property
C. Move the logic from connectedCallback() nto renderedCallback()
D. Move the logic to a getter/setter pair
View answer
Correct Answer: D
Question #17
Which two scenarios require an Apex method to be called imperatively from a Lightning web component? Choose 2 answers
A. Calling a method that makes a web service calloutcorrect
B. Calling a method that is not annotated with cacheable=truecorrect
C. Calling a method with the click of a buttoncorrect
D. Calling a method that is external to the main controller for the Lightning web component
View answer
Correct Answer: ABC
Question #18
A developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this?
A. Decorate the server-side method with @AuraEnabled(cacheable=true)
B. Set a cookie in the browser for use upon return to the page
C. Call the setStorable() method on the action in the JavaScript client-side code
D. Decorate the server-side method with @AuraEnabled(storable=true)
View answer
Correct Answer: A
Question #19
How should a developer reference a third-party JavaScript library from a Lightning component?
A. From an asset file
B. From a document
C. From a static resourcecorrect
D. From a third-party URL
View answer
Correct Answer: C
Question #20
A developer is writing code that requires making callouts to an external web service. Which scenario necessitates that the callout be made in an @future method?
A. The callouts will be made in an Apex Trigger
B. The callouts will be made in an Apex Test class
C. The callout could take longer than 60 seconds to complete
D. Over 10 callouts will be made in a single transaction
View answer
Correct Answer: A
Question #21
Universal Containers wants to use an external Web Service provided by a third-party vendor to validate that shipping and billing addresses are correct. The current vendor uses basic password authentication, but Universal Containers might switch to a different vendor who uses OAuth. What would allow Universal Containers to switch vendors without updating the code to handle authentication?
A. Custom Metadata
B. Custom Setting (List)
C. Dynamic Endpoint
D. Named Credentialcorrect
View answer
Correct Answer: D
Question #22
A company represents their customers as Accounts in Salesforce. All customers have a unique Customer_Number__c that is unique across all of the company’s systems. They also have a custom Invoice__c object, with a Lookup to Account, to represent invoices that are sent out from their external system. This company wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer is paying their bills on time. What is the optimal way to implement this?
A. Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an External ID and Upsert invoice data nightly
B. Query the Account Object upon each call to insert invoice data to fetch the Salesforce ID corresponding to the Customer Number on the invoice
C. Create a cross-reference table in the custom invoicing system with the Salesforce Account ID of each Customer and insert invoice data nightly
D. Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce without custom code
View answer
Correct Answer: A
Question #23
What are the two benefits of using External Ids?
A. An external Id is indexed and can improve performance in SOQL queries
B. An External Id can be used with Salesforce mobile to make external data visible
C. An external Id can be used to reference a unique ID from another, external system
D. An external Id can be a formula field to help create a unique field from two fields in Salesforce
View answer
Correct Answer: AC
Question #24
A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users are encountering ViewState errors when using it in Production. What should the developer ensure to correct these errors?
A. Ensure queries do not exceed governor limits
B. Ensure properties are marked as Transient
C. Ensure properties are marked as private
D. Ensure profiles have access to the Visualforce page
View answer
Correct Answer: B
Question #25
Refer to the test method below: An external system with Account information and sets the Account's Integration-Updated___ c checkbox to True when it completes. The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web service callouts." What is the optimal way to fix this?
A. Add if ('Test
B. Add Test
C. Add Test
D. Add Test
View answer
Correct Answer: D
Question #26
A developer wrote a test class that successfully asserts a trigger on Account. It fires and updates data correctly in a sandbox environment. A salesforce admin with a custom profile attempts to deploy this trigger via a change set into the production environment, but the test class fails with an insufficient privileges error. What should a developer do to fix the problem?
A. Add system
B. Configure the production environment to enable ‘’Run All tests as Admin User
C. Verify that Test, statement ( ) is not inside a For loop in the test class
D. Add seeAllData=true to the test class to work within the sharing model for the production environment
View answer
Correct Answer: A
Question #27
A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow. What can a developer to do address the issue?
A. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method
B. Move the prerequisite reference data setup to a @testSetup method in the test class
C. Move the prerequisite reference data setup to a static method in the test class and call that from each test method
D. Move the prerequisite reference data setup to the constructor for the test class
View answer
Correct Answer: B
Question #28
Universal Containers wants to use a Customer Community with Customer Community Plus licenses so their customers can track how many containers they are renting and when they are due back. Many of their customers are global companies with complex Account hierarchies, representing various departments within the same organization. One of the requirements is that certain community users within the same Account hierarchy be able to see several departments’ containers, based on a junction object that relates the C
A. A Visualforce page that uses a Custom Controller that specifies without sharing to expose the records
B. A Custom List View on the junction object with filters that will show the proper records based on owner
C. A Custom Report Type and a report Lightning Component on the Community Home Pagecorrect
D. An Apex Trigger that creates Apex Managed Sharing records based on the junction object’s relationships
View answer
Correct Answer: C
Question #29
A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?
A. RecordType
B. Profile
C. User
D. Reportcorrect
View answer
Correct Answer: D
Question #30
A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called jsutils in Salesforce. Another developer is coding a new Lightning web component (LWC) and wants to leverage the library. Which statement properly loads the static resource within the LWC?
A. import {jsUtilities} from '@salesforce/reaourceUrljsUtila’;
B. import jUtilities from ‘@salesforce/reaourceUrljsUtila’;correct
C.
D. const jsUtility = S
E. get ('SReaource
View answer
Correct Answer: B

View The Updated Salesforce Exam Questions

SPOTO Provides 100% Real Salesforce Exam Questions for You to Pass Your Salesforce Exam!

View Answers after Submission

Please submit your email and WhatsApp to get the answers of questions.

Note: Please make sure your email ID and Whatsapp are valid so that you can get the correct exam results.

Email:
Whatsapp/phone number: