Last Updated On : 7-Apr-2026


Salesforce Accredited B2B Commerce Developer - AP-202 Practice Test

Prepare with our free Salesforce Accredited B2B Commerce Developer - AP-202 sample questions and pass with confidence. Our B2B-Commerce-Developer practice test is designed to help you succeed on exam day.

211 Questions
Salesforce 2026

Which two statements are accurate?

A. A Lightning Web Component cannot contain an Aura component

B. A Lightning Web Component can contain an Aura component

C. An Aura component can contain a Lightning Web Component which contains an Aura component

D. An Aura component can contain a Lightning Web Component

A.   A Lightning Web Component cannot contain an Aura component
D.   An Aura component can contain a Lightning Web Component

Explanation:

Salesforce provides an interoperability layer (Aura Coexistence) that allows Aura components and Lightning Web Components (LWC) to work together in the same app/page, but with strict nesting rules:

Aura components can contain Lightning Web Components (D is true)
You can embed an LWC inside an Aura component's markup using the standard syntax (for example, ). This is commonly used for gradual migration: wrap existing Aura apps with new LWCs, or embed LWCs in legacy Aura components.

Lightning Web Components cannot contain Aura components (A is true)
An LWC's DOM subtree must consist entirely of LWCs (including base components). Including an Aura component inside an LWC is not supported and will result in errors or failed rendering. This is a deliberate design choice for performance, standards compliance, and security in LWC.

Why the Other Options Are Incorrect

B. A Lightning Web Component can contain an Aura component
False. This directly contradicts the official rules. LWCs cannot nest Aura components.

C. An Aura component can contain a Lightning Web Component which contains an Aura component
False. While an Aura can contain an LWC, that inner LWC cannot contain another Aura component (because of rule A). Nesting would violate the "LWC subtree must be pure LWC" restriction. The chain Aura → LWC → Aura is not allowed.

References

Lightning Web Components Developer Guide — Aura Coexistence: "Aura components can contain Lightning web components. However, the opposite doesn't apply. Lightning web components can’t contain Aura components."

What is a best practice when passing query parameters from user interface to an apex controller?

A. Query parameters should be properly sanitized by using JSINHTMLENCODE within the VisualForce Page or Component.

B. String parameters should be trimmed using String.trim().

C. Query parameters should be passed only to Salesforce B2B Commerce classes that you are extending.

D. Query parameters should be stored on a backbone model prior to passing them to the server

A.    Query parameters should be properly sanitized by using JSINHTMLENCODE within the VisualForce Page or Component.

Explanation:

When passing query parameters from the UI to an Apex controller, the main concern is security, especially protection against:
* Cross-Site Scripting (XSS)
* Script injection
* Malicious URL manipulation

Salesforce best practice is to sanitize and encode user input before it reaches server-side logic.

Why JSINHTMLENCODE?
JSINHTMLENCODE safely encodes values inserted into JavaScript contexts inside Visualforce pages.

Why the Other Options Are Incorrect

B. String parameters should be trimmed using String.trim()
Incorrect. Trimming whitespace is good hygiene but does not protect against security attacks. It is not the primary best practice.

C. Query parameters should be passed only to Salesforce B2B Commerce classes that you are extending
Incorrect. There is no such restriction. Query parameters can be used by any Apex controller when properly validated.

D. Query parameters should be stored on a backbone model prior to passing them to the server
Incorrect. Backbone models relate to client-side architecture patterns. This is not a Salesforce security or Apex best practice.

Salesforce Concept Reference

Salesforce Secure Coding Guidelines:
* Input validation and output encoding
* Visualforce security best practices
* Preventing XSS attacks

Key encoding functions:
* JSENCODE
* HTMLENCODE
* JSINHTMLENCODE

AP-202 Exam Tip

Whenever you see:
✅ query parameters
✅ UI → Apex controller
✅ best practice

Think first:
👉 Security & encoding (XSS prevention)

CheckoutSavable

A. CheckoutSavable

B. Checkoutoutinterface

C. CustomCheckout

D. CheckoutStep

A.   CheckoutSavable

Explanation:

CheckoutSavable is an interface in Salesforce B2B Commerce that can be implemented on a checkout step. When a checkout step implements the CheckoutSavable interface, the platform automatically calls the saveState method on that step when certain events occur, such as when a buyer navigates away from the step or proceeds to the next step. This ensures that any data entered or modified on that step is properly persisted before moving forward in the checkout process.

Why the Other Options Are Incorrect:

B:
Checkoutoutinterface is not a valid interface name in B2B Commerce (note the typo "out" instead of "Sav").

C:
CustomCheckout is not a standard interface provided by the B2B Commerce platform for checkout step functionality.

D:
CheckoutStep is typically a class or component type, not an interface specifically designed for auto-saving functionality.

Reference:
Salesforce B2B Commerce Developer Guide: CheckoutSavable Interface

Which two statements are true regarding the cc_CallContext class in Salesforce B2B Commerce? (2 answers)

A. The Salesforce session is accessible via the getSession method

B. The class can be used internally within Salesforce B2B Commerce and in subscriber code to access context level parameters

C. The userLocale variable returns the current Locale for storefront.

D. The current storefront is accessible via thisclass

B.   The class can be used internally within Salesforce B2B Commerce and in subscriber code to access context level parameters
C.   The userLocale variable returns the current Locale for storefront.

Explanation:

B. Internal and Subscriber Code Usage:
cc_CallContext is designed to be the "source of truth" for context throughout the entire execution of a request. It is used by the managed package's internal logic (the "core" code) and is also fully accessible to developers (the "subscriber code"). It allows you to retrieve parameters like the current Account, Contact, and effective Account without having to perform redundant SOQL queries.

D. Current Storefront Access:
One of the primary uses of cc_CallContext is to determine which storefront the user is currently browsing. You can access this via the variable cc_CallContext.storefront. This is critical in multi-storefront environments where logic needs to change based on whether the user is on the "NorthAmerica" store vs. the "Europe" store.

Detailed Analysis of Incorrect Answers

A. The Salesforce session is accessible via the getSession method:
This is incorrect. While cc_CallContext manages session-related data, there is no standard getSession() method that returns a raw Salesforce Session ID or object. Session information is typically handled via the currSessionId variable or by interacting with the cc_api_User and context variables directly.

C. The userLocale variable returns the current Locale for storefront:
This is incorrect (subtle distractor). In the cc_CallContext class, the variable used to track the language and region of the current user is userLocale, but it is a String, not an object, and more importantly, it returns the locale associated with the user or the request context, not necessarily a hardcoded "storefront locale." Developers often use cc_CallContext.userLocale to pass the correct language code to the API, but as a "statement of truth" in the exam, the storefront and parameter access (Options B and D) are the fundamental architectural definitions of this class.

References
Salesforce B2B Commerce Developer Guide: cc_CallContext Class Reference
Salesforce Help: B2B Commerce Visualforce Global Variables

What are two considerations to keep in mind when including additional JavaScript files in a Lightning web component?

A. Each additional file needs a corresponding .js-meta.xml file.

B. The files must be ES6 modules and must have names that are unique within the component's folder.

C. A module can export named functions or variables

D. Additional JavaScript files should be minified before deployment

B.   The files must be ES6 modules and must have names that are unique within the component's folder.
C.   A module can export named functions or variables

Explanation:

When including additional JavaScript files in a Lightning Web Component, there are specific technical requirements and capabilities to consider:

B:
The files must be ES6 modules, which provide a standardized way to organize and share JavaScript code. Additionally, each file must have a unique name within the component's folder to ensure proper module resolution and prevent naming conflicts when importing these modules.

C:
ES6 modules in LWC can export named functions, variables, or classes. This allows developers to selectively expose specific functionality from their module files to be imported and used elsewhere.

Why the Other Options Are Incorrect:

A:
Additional JavaScript files do not require their own .js-meta.xml configuration files. Only the main component JavaScript file requires a metadata file. Helper modules are just standard ES6 modules without separate metadata.

D:
While minification is a common optimization practice for production deployment, it is not a requirement or consideration specific to including additional JavaScript files in LWC. The Salesforce platform handles optimization automatically during deployment.

Reference:
Salesforce Developer Guide: Create a Lightning Web Component That Uses Another JavaScript Module and JavaScript Modules in LWC

B2B-Commerce-Developer Exam Questions - Home Previous
Page 4 out of 43 Pages