Salesforce PDII Online Practice
Questions and Exam Preparation
PDII Exam Details
Exam Code
:PDII
Exam Name
:Salesforce Certified Platform Developer II (Plat-Dev-301)
Certification
:Salesforce Certifications
Vendor
:Salesforce
Total Questions
:445 Q&As
Last Updated
:Jun 19, 2026
Salesforce PDII Online Questions &
Answers
Question 291:
Consider the controller code above that is called from a Lightning component and returns data wrapped in a class.
Consider the controller code above that is called from a Lightning component and returns data wrapped in a class.
The developer verified that the Queries return a single record each and there is error handing in the Lightning component, but the component is not getting anything back when calling the controller getSomeData(). What is wrong?
A. The member's Name and Option of the class MyDataWrapper should be annotated with @AuraEnabled too. B. The member's Name and Option should not be declared public. C. The member's Name and Option should not have getter and setter. D. Instances of Apex classes such as MyDataWrapper cannot be returned to a Lightning component.
A. The member's Name and Option of the class MyDataWrapper should be annotated with @AuraEnabled too.
Question 292:
What should be added to the setup, in the location indicated, for the unit test above to create the controller extension for the test?
A. AccountControllerExt extension = new AccountControllerExt(acct); B. ApexPages.StandardController sc = new ApexPages.StandardController(acct.Id);AccountControllerExt extension = new AccountControllerExt(sc); C. ApexPages.StandardController sc = new ApexPages.StandardController(acct);AccountControllerExt extension = new AccountControllerExt(sc); D. AccountControllerExt extension = new AccountControllerExt(acct.Id);
C. ApexPages.StandardController sc = new ApexPages.StandardController(acct);AccountControllerExt extension = new AccountControllerExt(sc);
Question 293:
A developer has written an After Update trigger on Account. A workflow rule and field update cause the trigger to repeatedly update the Account records.
How should the developer handle the recursive trigger?
A. Deactivate the trigger and move the logic into a Process or Flow B. Deactivate the workflow rule to prevent the field update from executing C. Use a static variable to prevent the trigger from executing more than once D. Use a global variable to prevent the trigger from executing more than once
C. Use a static variable to prevent the trigger from executing more than once
Question 294:
Invokable methods accept sObjects as parameters.
A. True B. False
B. False
Question 295:
How would you test a web service?
A. Use the @future annotation on the method B. Call the WebService interface C. Web Services do not need to be tested D. Create a class that implements the WebServiceMock interface
D. Create a class that implements the WebServiceMock interface
Question 296:
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.Delete method if the Contact insertion fails. B. Disable validation rules on Contacts and set default values with a Trigger. C. use the Database.Insert method with allOrNone set to False. D. use setSavePoint() and rollback() with a try/catch block.
D. use setSavePoint() and rollback() with a try/catch block.
Explanation
This requirement calls for "Transactional Atomicity," meaning either both database operations (Account creation and Contact creation) succeed, or neither is committed to the database. In Apex, each DML statement normally acts as its own individual transaction unless managed by Savepoints .
The correct approach is to use Database.setSavepoint() and Database.rollback() within a try-catch block (Option D) . The developer sets a savepoint immediately before the Account is inserted. If the Account is created successfully but the subsequent Contact insertion fails (due to a validation rule, trigger error, or system exception), the code enters the catch block. Within the catch block, the developer executes Database. rollback(sp), which reverts the database to the state it was in before the Account was ever inserted.
Question 297:
Which of the following annotations is the right way jto invoke a single apex method?
A. @lnvokableMethod() B. @lnvokableAction() C. @lnvokableApex()
A. @lnvokableMethod()
Question 298:
Consider the Apex controller above that is called from a Lightning Aura Component. What is wrong with it?
A. Line 1: class must be global B. Lines 1 and 6: class and method must be global C. Line 6: method must be static D. Line 8: method must first serialize the list to JSON before returning
C. Line 6: method must be static
Explanation
When building Apex controllers for Aura Components (or Lightning Web Components), any method annotated with @AuraEnabled must be defined as static. The snippet provided defines the method getStringArray() as an instance method (public List<String>...) rather than a static method (public static List<String>...).
The Lightning Component framework does not instantiate an object of the Apex class; instead, it calls the method statically. If the method is not static, the framework cannot locate or execute it, resulting in an error. While global was required in older versions or for managed packages, public is sufficient for code within the same namespace. Apex handles the serialization of standard types like Lists automatically, so manual JSON serialization is not required.
Question 299:
A company needs to automatically delete sensitive information after seven years. This could delete almost a million records every day. How can this be achieved?
A. Use aggregate functions to query for records older than seven years, and then delete the AggregateResult objects B. Perform a SOSL statement to find records older than 7 years, and then delete the entire result set C. Schedule a batch Apex process to run every day that queries and deletes records older than seven years D. Schedule an @future process to query records older than seven years, and then recursively invoke itself in 1,000 record batches to delete them
A. Use aggregate functions to query for records older than seven years, and then delete the AggregateResult objects
Question 300:
Refer to the component code and requirements below:
To achieve a responsive layout in Salesforce Aura components, the lightning:layout and lightning:layoutItem components utilize a 12-column grid system . The size attribute defines the default behavior, which targets the smallest devices (mobile). In the original code, size="12" is applied to all three items. Since each item occupies the full 12 columns, they stack vertically in three rows. To meet Requirement 2 (displaying in a single row for tablets and desktops), the three items must share the 12-column horizontal space. Mathematically, $12 \div 3 = 4$. Therefore, each item must be assigned a size of 4 for larger screen breakpoints.
Option D is the correct implementation. It maintains size="12" for mobile (Requirement 1) and sets mediumDeviceSize (tablets) and largeDeviceSize (desktops) to . This ensures that on any screen larger than 4 a phone, the three items will sit side-by-side in a single row.
Option A is incorrect because mediumDeviceSize="6" would only allow two items per row ($6 + 6 = 12$), forcing the third item to a second row. Option C is incomplete as it only specifies the largeDeviceSize, potentially leaving tablets in a stacked configuration. Option D follows the best practice of explicitly defining the span for all relevant device categories to ensure a consistent user experience.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Salesforce exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your PDII exam preparations
and Salesforce certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.