Adobe Commerce Developer Expert study materials
Adobe Commerce Developer Expert study resources

Adobe Commerce Developer Expert practice questions

One question at a time. Build your Adobe Commerce Developer Expert understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Adobe Commerce architecture and customization

In Adobe Commerce's layered architecture, which layer is responsible for rendering the final HTML response to the browser?

  1. The service contract layer, composed of API interfaces and repositories
  2. The view layer, composed of layout XML, templates, and blocks Correct answer.
  3. The persistence layer, composed of resource models and collections
  4. The presentation model layer, composed of view models only

Explanation

The view layer in Magento combines layout configuration, block classes, and template files to produce output. Resource models and repositories belong to persistence and service layers respectively. View models are a helper mechanism inside the view layer, not the whole layer.

Question 2Adobe Commerce architecture and customization

What is the primary purpose of a dependency injection preference declared in di.xml?

  1. To set a default configuration value for a system configuration path
  2. To define the load order of CSS and JavaScript assets
  3. To map a concrete class to an interface so the object manager can resolve it Correct answer.
  4. To register a new module's dependency on another module

Explanation

A preference tells the object manager which concrete implementation to instantiate when an interface or virtual type is requested. Configuration defaults, module dependencies, and asset ordering are handled by other mechanisms.

Question 3Adobe Commerce architecture and customization

A developer needs to change the behavior of a core class method without modifying the original class. Which mechanism is designed for this?

  1. A rewrite declared with a preference in di.xml
  2. A virtual type that extends the original class
  3. A plugin declared in di.xml targeting the class method Correct answer.
  4. An observer subscribed to a dispatched event

Explanation

Plugins (interceptors) wrap public methods to add before, after, or around behavior without altering the original class. Preferences and rewrites replace the class entirely, and observers only react to events the code dispatches.

Question 4Adobe Commerce architecture and customization

Which file in a module declares the module name and its dependency on other modules?

  1. etc/di.xml
  2. registration.php
  3. etc/module.xml Correct answer.
  4. etc/config.xml

Explanation

etc/module.xml holds the module name and a sequence of dependent modules that affect load order. di.xml configures object manager settings, config.xml holds default configuration, and registration.php registers the module with the component registrar.

Question 5Adobe Commerce architecture and customization

Which layout instruction should be used to reuse an existing block instance in another location of the page?

  1. <block> with a new class attribute
  2. <referenceBlock> with a nested <block> child Correct answer.
  3. <move> targeting the block name
  4. <update> referencing a layout handle

Explanation

A referenceBlock targets an already-declared block so arguments, children, or display settings can be adjusted without redeclaring it. Declaring a new block creates a separate instance, and update pulls in an entire handle.

Question 6Adobe Commerce architecture and customization

What does the object manager's shared-instance behavior mean for classes requested as singletons?

  1. The instance is cloned for each injected dependency
  2. A new instance is created each time the class is requested
  3. The instance is persisted across requests in the cache
  4. The same instance is returned for repeated requests within a request lifecycle Correct answer.

Explanation

By default the object manager caches created instances and returns the same object for subsequent requests during a single PHP process. Non-shared instances must be explicitly configured to be recreated. Instances are not persisted across requests.

Question 7Adobe Commerce architecture and customization

Which XML element in a module's di.xml is used to declare a virtual type?

  1. <argument>
  2. <preference>
  3. <type>
  4. <virtualType> Correct answer.

Explanation

A virtualType element defines a type that inherits configuration from a base class but is instantiated with different arguments. The type element configures an existing class, preference maps interfaces, and argument injects constructor values.

Question 8Adobe Commerce architecture and customization

What is the role of a repository class in Adobe Commerce's service contract architecture?

  1. To cache query results for collections automatically
  2. To render admin grids and forms for entity management
  3. To define database schema through declarative schema files
  4. To expose business operations over a stable interface while delegating persistence to resource models Correct answer.

Explanation

Repositories implement service contracts and mediate between API consumers and the persistence layer, delegating storage concerns to resource models. They do not render UI, and schema is defined in db_schema.xml.

Question 9Adobe Commerce architecture and customization

A developer adds an around plugin on a public method that returns a value. What must the plugin method do to preserve the original return value?

  1. Call the parent method directly with parent::method()
  2. Call the proceed callable and return its result Correct answer.
  3. Return null and let the framework substitute the original value
  4. Dispatch an event so observers can supply the return value

Explanation

An around plugin receives a callable that invokes the next plugin or the original method, and it must call that callable to obtain and return the result. Returning null or bypassing the callable discards the original behavior.

Question 10Adobe Commerce architecture and customization

In layout XML, a block is declared with the attribute cacheable="false". What is the practical effect?

  1. The block is excluded from full-page cache so its output is generated per request Correct answer.
  2. The block's template is compiled on every request but output is cached
  3. The block is removed from the page entirely when caching is enabled
  4. The block's output is cached only for logged-in customers

Explanation

Marking a block as non-cacheable excludes it from the full-page cache, causing it to be rendered dynamically on each request. It does not remove the block or restrict caching to a customer group.

Question 11Adobe Commerce architecture and customization

Which approach correctly injects a configuration value into a class constructor using di.xml?

  1. Add the value to the class as a static property in PHP
  2. Reference the config path in the constructor signature as a default value
  3. Declare a type element with an argument of xsi:type="string" for the parameter Correct answer.
  4. Create a preference mapping the parameter name to the config path

Explanation

Constructor arguments are supplied in di.xml using an argument element with the appropriate xsi:type, such as string, number, or const. PHP default values and static properties are not configuration injection, and preferences map types, not parameters.

Question 12Adobe Commerce architecture and customization

A module needs to run code whenever an order is placed, reacting to an existing event. Which component should be created?

  1. An observer class registered under the event name in events.xml Correct answer.
  2. A cron job that polls for new orders
  3. A preference overriding the order repository
  4. A plugin on the order placement service method

Explanation

Observers are registered in events.xml against a dispatched event name and execute when that event fires. Plugins intercept methods, preferences replace implementations, and cron polling is not event-driven.

Question 13Adobe Commerce architecture and customization

What is the difference between an after plugin and an around plugin when both are applied to the same method?

  1. After plugins apply only to static methods, while around plugins apply to instance methods
  2. After plugins run before the method, while around plugins run only after it
  3. After plugins can change arguments, while around plugins cannot
  4. After plugins modify the result after the method executes, while around plugins wrap execution and control whether the method runs Correct answer.

Explanation

After plugins receive the method result and can modify it after execution, whereas around plugins receive a proceed callable and can run code before and after, or skip the original method. Neither is restricted to static methods.

Question 14Adobe Commerce architecture and customization

Which mechanism lets a module modify the database schema without writing install scripts in modern Adobe Commerce?

  1. A recurring script declared in crontab.xml
  2. A data patch class implementing DataPatchInterface
  3. Declarative schema defined in db_schema.xml Correct answer.
  4. Setup install scripts in the Setup directory

Explanation

Declarative schema uses db_schema.xml files to define the desired table structure, and the system computes the difference. Data patches handle data changes, not schema definition, and install scripts are the legacy approach.

Question 15Adobe Commerce architecture and customization

A developer wants to add a new column to an existing table using declarative schema. What is required?

  1. Add the column to the table definition in db_schema.xml and run the schema upgrade command Correct answer.
  2. Add the column to a data patch with a direct SQL query
  3. Modify the existing whitelist schema file in the core module
  4. Create a new install script that issues an ALTER TABLE statement

Explanation

Declarative schema compares db_schema.xml to the database and applies differences when the upgrade command runs. Direct SQL in scripts or patches bypasses the declarative approach, and core files must not be modified.

Question 16Adobe Commerce architecture and customization

How does a virtual type differ from a preference in di.xml?

  1. A virtual type creates a configured instance of an existing class with custom arguments, while a preference substitutes one class for another globally Correct answer.
  2. A virtual type is only usable in the admin area, while a preference applies to the frontend
  3. A virtual type replaces an interface globally, while a preference defines constructor arguments
  4. A virtual type must extend the base class in PHP, while a preference does not

Explanation

Virtual types let you define named configurations of an existing class with different injected arguments without creating a PHP subclass. Preferences change which concrete class is used whenever a given type is requested.

Question 17Adobe Commerce architecture and customization

Which cache context is used to vary full-page cached content by customer group?

  1. session
  2. customer_group Correct answer.
  3. customer_logged_in
  4. store

Explanation

The customer_group context varies cached pages by the customer's group. The logged-in context varies by authentication state, store varies by store view, and session is not a standard FPC context for this purpose.

Question 18Adobe Commerce architecture and customization

A block needs data from a view model rather than embedding logic in the template. How is the view model associated with the block in layout XML?

  1. Pass an argument of xsi:type="object" named view_model with the class name Correct answer.
  2. Add the view model to the block's template using a helper call
  3. Set the class attribute of the block to the view model class
  4. Declare the view model as a child block of type view_model

Explanation

View models are injected as block arguments using an object argument named view_model, then accessed in the template. The block class itself remains the rendering class, and view models are not child blocks.

Question 19Adobe Commerce architecture and customization

What is the purpose of the sequence node in a module's module.xml file?

  1. To declare which modules must load before this module Correct answer.
  2. To list the modules this module overrides completely
  3. To define the order in which cron jobs execute
  4. To specify the dependency injection compilation order for plugins

Explanation

The sequence node declares module load-order dependencies so that a module's configuration is processed after the listed modules. It does not override modules or control cron or plugin ordering directly.

Question 20Adobe Commerce architecture and customization

A developer needs to alter the arguments passed to a method before it executes, without changing the method itself. Which plugin type applies?

  1. An observer on the method's event
  2. An around plugin that returns null
  3. A before plugin that returns an array of modified arguments Correct answer.
  4. An after plugin that returns a modified result

Explanation

Before plugins receive the original arguments and may return a modified argument array that is passed to the method. After plugins operate on the result, and around plugins wrap execution rather than being the idiomatic choice for argument modification.

Question 21Adobe Commerce architecture and customization

Two modules declare plugins on the same method. How is execution order determined when neither specifies sortOrder?

  1. The plugin declared last alphabetically always runs first
  2. Order depends on module load order, and sortOrder attributes should be used to make it deterministic Correct answer.
  3. The framework runs only the first plugin and ignores the rest
  4. Execution order is random on each request and cannot be controlled

Explanation

Without explicit sortOrder, plugin ordering can depend on the order modules are loaded, which is fragile. Developers should set sortOrder to guarantee deterministic chaining. Order is not alphabetical or random.

Question 22Adobe Commerce architecture and customization

What happens when an around plugin does not call the proceed callable and instead returns its own value?

  1. The original method still runs and its result is merged with the plugin's return value
  2. The original method and any remaining plugins in the chain are skipped Correct answer.
  3. The framework calls the original method twice to compensate
  4. A fatal error is thrown because proceed is mandatory

Explanation

The proceed callable advances the chain to the next plugin or the original method. If an around plugin returns without calling it, the remainder of the chain, including the original method, does not execute.

Question 23Adobe Commerce architecture and customization

A custom module must intercept a method on a class that is instantiated directly with the new keyword inside core code. What is the outcome?

  1. The plugin applies but only to the first instantiation
  2. The plugin applies because plugins are applied at the PHP language level
  3. The plugin applies only in developer mode
  4. The plugin does not apply because the object manager was bypassed Correct answer.

Explanation

Plugins are generated through the object manager's interceptor mechanism, so classes created with direct instantiation bypass interception. The plugin does not apply regardless of mode or instance count.

Question 24Adobe Commerce architecture and customization

How does the framework resolve which class to instantiate when a constructor type-hints an interface that has both a preference and a virtual type argument configuration?

  1. The preference determines the concrete class, and the virtual type's arguments apply only where that virtual type is requested Correct answer.
  2. The virtual type always overrides the preference for every injection point
  3. The interface is instantiated directly because it is type-hinted
  4. An error is thrown because interfaces cannot be type-hinted

Explanation

A preference maps the interface to a concrete class for injection points requesting that interface. A virtual type is a separate named type whose custom arguments apply only where that virtual type name is requested, not globally.

Question 25Adobe Commerce architecture and customization

Which statement best describes how areas in Adobe Commerce affect dependency injection configuration?

  1. Areas affect only layout files and have no effect on dependency injection
  2. Only global di.xml is loaded, and area files are ignored at runtime
  3. Area configuration replaces global configuration entirely for that area
  4. Area-specific di.xml files merge with global configuration and apply when code runs in that area Correct answer.

Explanation

Configuration is loaded per area, with global di.xml merged with the area-specific file for the current area such as frontend or adminhtml. Area files augment rather than replace global configuration, and they do affect dependency injection.

Question 26Adobe Commerce architecture and customization

In Adobe Commerce, which class is responsible for creating object instances and managing their dependencies?

  1. Magento\Framework\ObjectManager
  2. Magento\Framework\ObjectManagerInterface Correct answer.
  3. Magento\Framework\App\ObjectManager
  4. Magento\Framework\App\ObjectManager\Factory

Explanation

The ObjectManagerInterface defines the contract for object creation and dependency injection in Adobe Commerce. The concrete implementation is typically Magento\Framework\App\ObjectManager, but the interface is what developers type-hint and use. The other options are either the concrete class or non-existent.

Question 27Adobe Commerce architecture and customization

Which file in a module is used to declare a preference for an interface?

  1. etc/module.xml
  2. etc/events.xml
  3. etc/config.xml
  4. etc/di.xml Correct answer.

Explanation

Preferences are declared in a module's di.xml file using the <preference> element, which maps an interface to a concrete class. The other files serve different purposes: module.xml defines module dependencies, config.xml holds default configuration, and events.xml declares event observers.

Question 28Adobe Commerce architecture and customization

What is the primary purpose of a virtual type in Adobe Commerce?

  1. To declare a plugin on a specific class
  2. To override a core class with a custom implementation
  3. To define a new DI configuration instance with specific arguments without creating a PHP class Correct answer.
  4. To create a new class that extends an existing one

Explanation

A virtual type allows you to define a new instance of an existing class with custom dependency injection arguments, without writing a new PHP class. It is declared in di.xml and can be used to simplify configuration for multiple instances with different dependencies.

Question 29Adobe Commerce architecture and customization

Which XML element in a module's di.xml is used to declare a plugin?

  1. <preference>
  2. <type>
  3. <virtualType>
  4. <plugin> Correct answer.

Explanation

Plugins are declared inside a <type> element using the <plugin> element, which specifies the plugin name, type, and sort order. The other elements serve different purposes: <preference> for interface mapping, <type> for configuring a class, and <virtualType> for virtual types.

Question 30Adobe Commerce architecture and customization

In Adobe Commerce, what does the sequence node in a module's module.xml file define?

  1. The list of modules that must be loaded before this module Correct answer.
  2. The order in which modules are loaded
  3. The order in which event observers are executed
  4. The list of modules that depend on this module

Explanation

The <sequence> node lists modules that must be loaded before the current module, ensuring dependencies are available. It does not define the overall load order of all modules, nor does it affect event observer execution.

Question 31Adobe Commerce architecture and customization

Which area in Adobe Commerce is used for frontend requests?

  1. webapi_rest
  2. frontend Correct answer.
  3. adminhtml
  4. crontab

Explanation

The frontend area is used for customer-facing requests. Adminhtml is for the admin panel, webapi_rest for REST API calls, and crontab for scheduled tasks.

Question 32Adobe Commerce architecture and customization

What is the purpose of a repository in Adobe Commerce's service contract architecture?

  1. To directly execute SQL queries for performance
  2. To cache data for faster retrieval
  3. To handle user authentication
  4. To provide a layer of abstraction between business logic and data storage Correct answer.

Explanation

Repositories provide a consistent interface for data access, hiding the underlying storage details. They are part of the service contract layer, allowing business logic to remain decoupled from the database.

Question 33Adobe Commerce architecture and customization

Which file is used to declare a new database table using declarative schema?

  1. di.xml
  2. install.xml
  3. schema.xml
  4. db_schema.xml Correct answer.

Explanation

Declarative schema uses db_schema.xml to define the desired database structure. The system compares this file with the current database and applies changes automatically.

Question 34Adobe Commerce architecture and customization

What is the role of a plugin in Adobe Commerce?

  1. To handle exceptions thrown by a method
  2. To modify the behavior of a public method without changing the original class Correct answer.
  3. To replace an entire class with a custom implementation
  4. To add new methods to a class

Explanation

Plugins allow you to intercept and modify the behavior of public methods by running code before, after, or around the method. They do not replace the class (that's a preference) or add new methods.

Question 35Adobe Commerce architecture and customization

In layout XML, what does the <referenceBlock> element do?

  1. It creates a new block instance
  2. It modifies an existing block Correct answer.
  3. It removes a block from the layout
  4. It defines a container for blocks

Explanation

<referenceBlock> is used to modify an existing block, such as changing its arguments, adding child blocks, or removing it. It does not create a new block; that is done with <block>.

Question 36Adobe Commerce architecture and customization

A developer needs to pass a custom argument to a block defined in layout XML. Which approach is correct?

  1. Use the <arguments> element inside the <block> declaration Correct answer.
  2. Use the <action> element to call a setter method
  3. Define the argument in di.xml
  4. Add the argument to the block's PHP class constructor

Explanation

Arguments for a block can be passed via the <arguments> element within the <block> declaration in layout XML. These arguments are injected into the block's constructor as an array.

Question 37Adobe Commerce architecture and customization

What is the purpose of a view model in Adobe Commerce?

  1. To handle user input validation
  2. To provide a layer between the block and the template for business logic Correct answer.
  3. To replace the block entirely
  4. To manage database transactions

Explanation

View models are used to encapsulate presentation logic, keeping templates clean and blocks focused on rendering. They are typically injected into blocks via layout XML or di.xml.

Question 38Adobe Commerce architecture and customization

How can a developer add a new column to an existing table using declarative schema?

  1. By adding the column to the module's config.xml
  2. By adding a <column> element to the table definition in db_schema.xml Correct answer.
  3. By creating a new setup script with the column definition
  4. By modifying the table directly with SQL

Explanation

In declarative schema, you add a <column> element within the <table> definition in db_schema.xml. After updating the file, running the schema upgrade command applies the change.

Question 39Adobe Commerce architecture and customization

A developer wants to add a new method to an existing class without modifying the class. Which mechanism should be used?

  1. Use an observer
  2. Create a subclass and use a preference Correct answer.
  3. Use a virtual type
  4. Use a plugin

Explanation

Plugins cannot add new methods; they only intercept existing ones. To add a new method, you must create a subclass that extends the original class and then use a preference to replace the original class with the subclass.

Question 40Adobe Commerce architecture and customization

What is the effect of setting sortOrder on a plugin?

  1. It sets the priority of the plugin in the dependency injection container
  2. It determines the order in which plugins are executed when multiple plugins are applied to the same method Correct answer.
  3. It controls the order of event observers
  4. It determines the order of methods within a class

Explanation

The sortOrder attribute in a plugin declaration controls the execution order of plugins on the same method. Lower numbers execute first.

Question 41Adobe Commerce architecture and customization

Which XML file is used to declare an event observer?

  1. events.xml Correct answer.
  2. di.xml
  3. config.xml
  4. module.xml

Explanation

Event observers are declared in events.xml within the appropriate area (e.g., etc/events.xml for global, etc/frontend/events.xml for frontend).

Question 42Adobe Commerce architecture and customization

A developer needs to modify the arguments passed to a method before it executes. Which plugin type should be used?

  1. After plugin with arguments
  2. Around plugin Correct answer.
  3. After plugin
  4. Before plugin

Explanation

Around plugins can modify the arguments before calling the proceed method, which invokes the original method with the modified arguments. Before plugins cannot change arguments; they can only observe or modify the object state.

Question 43Adobe Commerce architecture and customization

Two modules declare plugins on the same method without specifying sortOrder. How is their execution order determined?

  1. By the order of module loading, which is determined by the sequence in module.xml Correct answer.
  2. By the order in which the plugins are declared in di.xml
  3. By the priority defined in the module's composer.json
  4. By the alphabetical order of the plugin names

Explanation

When sortOrder is not specified, plugins are executed in the order their modules are loaded, which is determined by the <sequence> node in module.xml. Modules loaded earlier have their plugins executed first.

Question 44Adobe Commerce architecture and customization

What happens when an around plugin does not call the proceed callable and returns its own value?

  1. An exception is thrown
  2. The original method is executed, and its return value is ignored
  3. The original method is not executed, and the plugin's return value is used Correct answer.
  4. The plugin's return value is merged with the original method's return value

Explanation

If an around plugin does not call proceed, the original method is skipped entirely, and the plugin's return value is returned to the caller. This effectively replaces the method's behavior.

Question 45Adobe Commerce architecture and customization

A custom module must intercept a method on a class that is instantiated directly with the new keyword inside core code. Which approach is most appropriate?

  1. Use a preference to replace the class with a subclass that overrides the method Correct answer.
  2. Create an observer for the method's event
  3. Use a virtual type to modify the class
  4. Declare a plugin on the class in di.xml

Explanation

Plugins only work on classes instantiated through the object manager. If a class is instantiated directly with new, plugins will not be applied. The solution is to use a preference to replace the class with a subclass that overrides the method.

Question 46Adobe Commerce architecture and customization

How does the framework resolve which class to instantiate when a constructor type-hints an interface that has both a preference and a virtual type defined?

  1. An error is thrown due to ambiguity
  2. The virtual type is used, and the preference is ignored
  3. The interface is instantiated directly
  4. The preference is used, and the virtual type is ignored Correct answer.

Explanation

Preferences map an interface to a concrete class and are used when the interface is type-hinted. Virtual types are not used for type-hinting; they are used when a specific virtual type is requested by name. Therefore, the preference takes precedence.

Question 47Adobe Commerce architecture and customization

In Adobe Commerce, what is the purpose of the di.xml file located in the etc/frontend directory?

  1. To declare frontend-specific events
  2. To configure frontend layout updates
  3. To provide DI configuration that applies only to the frontend area Correct answer.
  4. To define frontend routes

Explanation

The etc/frontend/di.xml file contains dependency injection configuration that is specific to the frontend area. It is merged with the global di.xml when the frontend area is active.

Question 48Adobe Commerce architecture and customization

A developer wants to extend a class and add a new method, then ensure that the new method is available wherever the original class is used. Which approach is correct?

  1. Create a virtual type that includes the new method
  2. Use an observer to inject the new method
  3. Create a plugin that adds the new method
  4. Create a subclass with the new method and declare a preference for the original class Correct answer.

Explanation

To add a new method and have it available, you must create a subclass that extends the original class, add the method, and then declare a preference to use the subclass instead of the original class. Plugins and virtual types cannot add new methods.

Question 49Adobe Commerce architecture and customization

In Adobe Commerce, which mechanism allows a module to inject a custom implementation of an interface without editing the class that consumes it?

  1. Registering the class in the module's module.xml sequence node
  2. Declaring a preference for that interface in the module's di.xml Correct answer.
  3. Creating a layout XML handle that maps the interface to the class
  4. Adding the implementation to the module's registration.php file

Explanation

Object Manager configuration in di.xml lets a module specify which concrete class should be produced for a given type, including interface preferences. Because consumers type-hint the interface, the substitution happens at dependency-injection time without touching consumer code.

Question 50Adobe Commerce architecture and customization

A module must run a small routine on every request before any controller action is dispatched, and the routine must be able to short-circuit request processing. Which approach fits these requirements?

  1. Declare a preference for the front controller class in di.xml
  2. Add an observer for the controller_action_predispatch event in etc/frontend/events.xml Correct answer.
  3. Declare a before plugin on the execute method of every action class
  4. Add a frontend router class that is registered in routes.xml

Explanation

Observers on controller_action_predispatch fire before the action is dispatched, and an observer can stop propagation to prevent the action from running. This makes it the standard hook for pre-dispatch logic that may short-circuit the request.