Big Black Friday Sale 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sale65best

Free Salesforce PDII Practice Exam with Questions & Answers | Set: 4

Questions 31

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?

Options:
A.

import jsUtilities from '@salesforce/resourceUrl/jsUtils';

B.

import {jsUtilities} from '@salesforce/resourceUrl/jsUtils';

C.

const jsUtility = $A.get('$Resource.jsUtils');

D.

Salesforce PDII Premium Access
Questions 32

A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property:

JavaScript

import { LightningElement, api, wire } from 'lwc';

import { getRecord } from 'lightning/uiRecordApi';

export default class Record extends LightningElement {

@api fields;

@api recordId;

record;

}

What must be done in the component to get the data from Salesforce?

Options:
A.

Add @api(getRecord, { recordId: '$recordId' }) above record.

B.

Add @wire(getRecord, { recordId: '$recordId' }) above record.

C.

Add @api(getRecord, { recordId: '$recordId', fields: '$fields' }) above record.

D.

Add @wire(getRecord, { recordId: '$recordId', fields: '$fields' }) above record.

Questions 33

A developer is developing a reusable Aura component that will reside on an sObject Lightning page with the following HTML snippet:

HTML

<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">

Hello!

</aura:component>

How can the component's controller get the context of the Lightning page that the sObject is on without requiring additional test coverage?

Options:
A.

Create a design attribute and configure via App Builder.

B.

Set the sObject type as a component attribute.

C.

Use the getSObjectType() method in an Apex class.

D.

Add force:hasSObjectName to the implements attribute.

Questions 34

Given the following code:

Java

for ( Contact c : [SELECT Id, LastName FROM Contact WHERE CreatedDate = TODAY] )

{

Account a = [SELECT Id, Name FROM Account WHERE CreatedDate = TODAY LIMIT 5];

c.AccountId = a.Id;

update c;

}

Assuming there were 10 Contacts and five Accounts created today, what is the expected result?

Options:
A.

System.QueryException: List has more than one row for Assignment on Account

B.

System.LimitException: Too many SOQL Queries on Contact

C.

System.LimitException: Too many SOQL Queries on Account

D.

System.QueryException: Too many DML Statement errors on Contact

Questions 35

A developer creates a lightning web component to allow a Contact to be quickly entered. However, error messages are not displayed.

HTML

Which component should the developer add to the form to display error messages?12

Options:
A.

lightning-messages

B.

lightning-error

C.

apex:messages

D.

aura:messages

Questions 36

Universal Containers uses a custom Lightning page to provide a mechanism to perform a step-by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERP_Number__c, that is then used in a query to find matching Accounts.

Java

erpNumber = erpNumber + '%';

List accounts = [SELECT Id, Name FROM Account WHERE ERP_Number__c LIKE :erpNumber];

A developer receives the exception 'SOQL query not selective enough'. Which step should be taken to resolve the issue?

Options:
A.

Move the SOQL query to within an asynchronous process.

B.

Mark the ERP_Number__c field as required.

C.

Mark the ERP_Number__c field as an external ID.

D.

Change the query to use a SOSL statement instead of SOQL.

Questions 37

A developer is creating a Lightning web component to display a calendar. The component will be used in multiple countries. In some locales, the first day of the week is a Monday, or a Saturday, or a Sunday. What should the developer do to ensure the calendar displays accurately for users in every locale?

Options:
A.

Query the FirstDayOfWeek field from the Locale for the current user.

B.

Use a custom metadata type to store key/value pairs.

C.

Use UserInfo.getLocale() in the component.

D.

Import the @salesforce/i18n module and use the firstDayOfWeek internationalization property.

Questions 38

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users encounter "View State" errors when using it in production. What should the developer ensure to correct these errors?

Options:
A.

Ensure profiles have access to the Visualforce page.

B.

Ensure properties are marked as private.

C.

Ensure variables are marked as transient.12

D.

Ensure queries do not exceed governor limits.34

Questions 39

Universal Containers (UC) has enabled the translation workbench and has translated picklist values. UC has a custom multi-select picklist field, Products__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 Products__c field. What should the developer do to ensure the value of Products__c is in the current user's language?40

Options:
A.

Use toLabel(Products__c) in the fields list of the SOQL que41ry.

B.

Call the translate() method on each record in the SOQL result list.

C.

Set the locale on each record in the SOQL result list.

D.

Use the locale clause in the SOQL query.

Questions 40

A developer is asked to look into an issue where a scheduled Apex is running into DML limits. Upon investigation, the developer finds that the number of records processed by the scheduled Apex has recently increased to more than 10,000. What should the developer do to eliminate the limit exception error?

Options:
A.

Implement the Batchable interface.

B.

Use platform events.

C.

Use the @future annotation.

D.

Implement the Queueable interface.

Exam Code: PDII
Certification Provider: Salesforce
Exam Name: Salesforce Certified Platform Developer II ( Plat-Dev-301 )
Last Update: Jan 19, 2026
Questions: 161