Practice Free Plat-Dev-201 Exam Online Questions
A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the initial URL.
Which three statements are useful inside the unit test to effectively test the custom controller? Choose 3 answers
- A . String nextPage = controller.save ().getUrl () ;
- B . ApexPages.currentPage ().getParametera (}.put{‘input’, "TeatValue’) ;
- C . insert pageret;
- D . public Extendedcontroller (ApexPages.Standardcontraller entrl) { }
- E . Test. setCurrentPage (pageRef) ;
A,B,D
Explanation:
A: Thesave () method in the custom controller must be tested to ensure it works as intended and redirects to the correct page.
B: Setting parameters viaApexPages.currentPage ().getParameters () is crucial to test scenarios where user input or URL parameters drive logic.
D: UsingTest.setCurrentPage (pageRef) is essential for simulating page context in unit tests.
Why not other options?
C: This statement does not belong to testing a custom controller.
B (second occurrence): It appears to be incorrectly formatted in the question.
Testing Apex Controllers
What is a benefit of developing applications
- A . Enforced unit testing and code coverage best practices
- B . Access to predefined computing resources
- C . Preconfigured storage for big data
- D . Unlimited processing power and memory
B
Explanation:
Salesforce’s multi-tenant architecture provides shared computing resources that are predefined and managed by Salesforce. This ensures scalability, security, and reliability while eliminating the need for customers to manage infrastructure.
Reference: Salesforce Multi-Tenant Architecture
What are three considerations when using the @lnvocableMethod annotation in Apex? Choose 3 answers
- A . Only one method using the @invecableMethod annotation can be defined per Apex class_
- B . A method using the @invecableMethod annotation can have multiple input parameters.
- C . A method using the @invocablemethod annotation must be declaredas static,
- D . GO A method using the @invocablemethod annotation must define a return value.
- E . A method using the @invocableMethod annotation can be declared as Public or Global.
A,C,E
Explanation:
Option A: Only one method annotated with@InvocableMethodcan exist per class.
Option C: The method must bestatic.
Option E: The method can be declared asPublicorGlobalfor broader accessibility.
: Invocable Methods Documentation
Which three statements are accurate about debug logs? Choose 3 answers
- A . Debug logs can be set for specific users, classes, and triggers.
- B . System debug logs are retained for 24 hours.
- C . Only the 20 most recent debug logs for a user are kept.
- D . Debug log levels are cumulative, where FINE log level includes all events logged at the DEBUG, INFO, WARN, and ERROR levels.
- E . The maximum size of a debug log is 5 MB.
A,C,E
Explanation:
What are two benefits of using declarative customizations over code? Choose 2 answer
- A . Declarative customizations automatically update with each Salesforce release.
- B . Declarative customizations automatically generate test classes.
- C . Declarative customizations cannot generate run time errors
- D . Declarative customizations generally require less maintenance
A,D
Explanation:
Declarative customizations, such as workflows, process builder, validation rules, and flows, offer a no-code approach to customizing Salesforce. Below are the key benefits:
Declarative customizations automatically update with each Salesforce release (A): Salesforce ensures that declarative tools are automatically updated during new releases, eliminating the need for manual intervention or code refactoring.
Reference: Salesforce Release Updates
Declarative customizations generally require less maintenance (D): Because declarative tools use configurations rather than custom code, they are simpler tomanage, troubleshoot, and update. This significantly reduces the maintenance overhead compared to custom code.
Reference: Trailhead: Build Declarative Applications
Incorrect Options:
B: Declarative tools do not automatically generate test classes. This is specific to Apex code.
C: Declarative customizations can still result in runtime errors, such as invalid field updates or logic conflicts.
A software company uses the following objects and relationships:
* Case: to handle customer support issues
* Defect__c: a custom object to represent known issues with the company’s software
* Case Defect__c a junction object between Case and Defect __c to represent that a defect is a cause of a customer issue
Case and Defect__c have Private organization-wide defaults.
What should be done to share a specific Case_Defect__c record with a user?
- A . Share the parent Cast record Defect_c records.
- B . Share the parent Case and record_c record.
- C . Share the parent Defect__c record.
- D . Share the case_Defect_c record.
B
Explanation:
Since theCaseandDefect__cobjects have aPrivateorganization-wide default (OWD), their records must be explicitly shared for a user to gain access to the relatedCase_Defect__crecord. Sharing both parent records ensures that the user can access the junction object and the associated parent objects.
Reference: Salesforce Sharing and Visibility
A developer considers the following snippet of code:
Boolean isOK;
Integer x;
String theString = ‘Hello’;
if (isOK == false && theString == ‘Hello’) {
x = 1;
} else if (isOK == true && theString == ‘Hello’) {
x = 2;
} else if (isOK == null && theString == ‘Hello’) {
x = 3; } else {
x = 4;
}
Based an this code, what is the value of x?
- A . 1
- B . 2
- C . 3
- D . 4
C
Explanation:
isOK is declared but not initialized, so its default value is null.
In the condition checks:
The first if evaluates as false because isOK == false is false.
The second else if evaluates as false because isOK == true is false.
The third else if evaluates as true because isOK == null is true and theString == ‘Hello’ is also true.
So, the value assigned to x is 3.
Reference: Apex Developer Guide: Primitive Data Types and Defaults
Which three data types can a SOQL query return? Choose 3 answers
- A . Double
- B . O Long
- C . sObject
- D . dg Integer
- E . List
A,C,E
Explanation:
sObject: SOQL queries can return single or multiple records assObjectinstances.
List: SOQL queries often return results as aListofsObject.
Double: SOQL aggregate queries can return numeric data types likeDouble (e.g., COUNT, SUM).
Reference: SOQL Query Return Types
Incorrect Options:
B (Long): SOQL does not directly returnLongvalues.
D (Integer): Aggregate results useDouble, notInteger
A developer needs to implement a custom SOAP Web Service that is used by an external Web Application. The developer chooses to include helper methods that are not used by the Web Application in the implementation of the Web Service Class.
Which code segment shows the correct declaration of the class and methods?
- A . apex
Copy
webservice class WebServiceClass {
private Boolean helperMethod () { /* implementation … */ } global static String updateRecords () { /* implementation … */ }
} - B . apex
Copy
global class WebServiceClass {
private Boolean helperMethod () { /* implementation … */ } webservice static String updateRecords () { /* implementation … */ }
} - C . apex
Copy
webservice class WebServiceClass {
private Boolean helperMethod () { /* implementation … */ } webservice static String updateRecords () { /* implementation … */ }
} - D . apex
Copy
global class WebServiceClass {
private Boolean helperMethod () { /* implementation … */ } global String updateRecords () { /* implementation … */ }
}
B
Explanation:
Comprehensive and Detailed Explanation From Exact Extract:
To determine the correct declaration of the class and methods for a custom SOAP Web Service in
Apex, we need to evaluate the syntax and access modifiers required for SOAP Web Services, as well as the handling of helper methods that are not exposed to the external Web Application. Let’s analyze the problem and each option systematically, referencing Salesforce’s official Apex Developer Guide.
Understanding SOAP Web Services in Apex:
SOAP Web Service: Salesforce allows developers to create SOAP Web Services using Apex by defining methods that can be called externally via SOAP. The Apex Developer Guide states: “Apex SOAP Web Services allow external applications to invoke Apex methods over SOAP by exposing them with the webservice keyword” (Salesforce Apex Developer Guide, SOAP Web Services).
Class Declaration: For an Apex class to be a SOAP Web Service, it must be declared as global to allow external access. The Apex Developer Guide specifies: “The class containing SOAP Web Service methods must be declared as global to be accessible externally” (Salesforce Apex Developer Guide, SOAP Web Services).
Method Declaration:
Methods exposed as Web Service operations must be static and annotated with the webservice keyword. The Apex Developer Guide notes: “Methods defined as SOAP Web Service operations must be static and use the webservice keyword” (Salesforce Apex Developer Guide, SOAP Web Services).
The return type and parameters of webservice methods must be compatible with SOAP (e.g String, Integer, sObjects, etc.).
Helper Methods: The question specifies that helper methods are included but not used by the Web Application, meaning they should not be exposed as part of the Web Service. Helper methods can be private or public and should not have the webservice keyword, ensuring they are not part of the WSDL (Web Service Definition Language) exposed to the external application.
Requirement Analysis:
Class: Must be global to expose the Web Service to external applications.
Web Service Method (updateRecords): Must be static, use the webservice keyword, and be part of the global class to be callable via SOAP.
Helper Method (helperMethod): Should be private (or not webservice) to ensure it’s not exposed in the WSDL and is only used internally within the class.
Evaluating the Options:
Universal Containers has an order system that uses an Order Number to identify an order for customers and service agents. Order records will be imported into Salesforce.
How should the Order Number field be defined in Salesforce?
- A . Indirect Lockup
- B . Direct Lookup
- C . External ID and Unique
- D . Lookup
C
Explanation:
Why External ID?
The Order Number is used to identify records uniquely, both in Salesforce and in external systems.
Marking it as an External IDensures it can be matched or referenced during data imports and integrations.
Why Unique?
Setting the field as Unique ensures that duplicate values are not allowed for the Order Number.
Why Not Other Options?
