Magento 2 Certified Associate Developer v1.0 (Magento 2 Certified Associate Developer)

Page:    1 / 7   
Total 109 questions

A Magento industry partner shipping provider has tasked you to build their integration module called MyCompany_ShippingProvider.
Where do you define the class that provides options for the select field that enables or disables the provider in the file etc/adminhtml/system.xml?

  • A. <option_model>Magento\Config\Model\Config\Option\Yesno</option_model>
  • B. <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
  • C. <frontend_model>Magento\Config\Model\Config\Frontend\Yesno</frontend_model>
  • D. <backend_model>Magento\Config\Model\Config\Backend\Yesno</backend_model>


Answer : B

Reference:
https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout-add-custom-carrier.html

Where do you change the frontName for the admin router?

  • A. app/etc/config.xml
  • B. app/etc/env.php
  • C. app/etc/local.xml
  • D. composer.json


Answer : B

Reference:
https://amasty.com/knowledge-base/magento-2-admin-url.html

You added a new constructor argument to an existing action controller class.
When you reload the page you get a PHP error that the wrong argument is passed to the class.
How do you fix this?

  • A. Clean the page cache
  • B. Deploy static content
  • C. Clean the <magento_root>/generated/ folder
  • D. Clean the config cache


Answer : A

The module MyCompany_MyModule provides custom admin interface pages.
Access to these pages should only be granted to specific users.
You add the required configuration to the moduleג€™s acl.xml file, but the setting does not seem to work as expected.
How do you visually check if Magento evaluates your ACL resource as expected?

  • A. Write a plugin for the class \Magento\Framework\Acl\LoaderInterface::populateAcl() and echo out the loaded roles
  • B. Inspect the output of the CLI command bin/magento admin:role:resources ג€" all
  • C. In the browser, open the admin User Roles page. Choose a role and inspect the tree of available resources
  • D. Inspect the response of a GET request to the webapi endpoint http://example.com/rest/V1/acl/resources


Answer : D

You need to find all orders in the processing state. You have written the code:


When you run the code, you get the following exception:

How do you resolve the exception?

  • A. Specify a preference in di.xml to map SearchCriteriaBuilder to SearchCriteriaInterface
  • B. Use dependency injection to load an instance of the SearchCriteria class
  • C. Change the getList parameter to: $searchCriteriaBuilder->addFilter(ג€˜stateג€™, ג€˜processingג€™)->create()
  • D. Clear generated code to get a new version of SearchCriteriaBuilder


Answer : C

How can you render a text on a page using only layout xml?
A.


B.

C.

D.



Answer : B

In layout files you can change an elementג€™s order on a page. This can be done using one of the following:
✑ <move> instruction
✑ before and after element attributes?
How are two methods different?

  • A. They are the same, both provide access to the same functionality
  • B. Elements are renamed by default when using the move instruction
  • C. The move instruction allows altering an elementג€™s parent node
  • D. Before and after attributes can only be used with referenceContainer and referenceBlock


Answer : C

You want to declare a block of the type \Magento\Framework\View\Element\Template with a template named view.phtml in the layout XML.
What is the correct layout declaration for this?
A.


B.

C.

D.



Answer : D

How do you set the custom block MyCompany\MyModule\Block\A as a child for the block named product.info using layout XML?
A.


B.

C.

D.



Answer : B

Reference:
https://magento.stackexchange.com/questions/219813/magento2-how-to-add-custom-block-on-product-page

Your module adds a new controller class which will return a JSON response.
What will be the return type of the execute method?

  • A. You should implement a new API endpoint instead of returning JSON from a controller
  • B. The string value of \Zend_Json::encode()
  • C. An instance of \Magento\Framework\Controller\Result\Json
  • D. No return needed, an object that can be converted to JSON must be set as the Response body


Answer : C

Reference:
https://www.brainacts.com/blog/how-to-return-a-json-response-from-a-controller-in-magento-2

You want to remove a column introduced by a third-party extension via declarative schema.
How do you do that?

  • A. Create the etc/db_schema.xml file and specify disable=ג€trueג€ on the column
  • B. Modify the original etc/db_schema.xml file and remove the column from there
  • C. Create a SchemaPatch file and remove the column programmatically
  • D. Copy the etc/db_schema.xml file into your module and remove the column from your copy


Answer : D

You are working on a new entity called vendor. You implemented the model, resource model and collection. You want to ensure that standard model events will be fired for your model, so an observer can be created for the events vendor_save_after, vendor_save_commit_after and others.
How do you do that?

  • A. Create an entry in etc/di.xml and add the argument eventPrefix with the value of vendor
  • B. Declare the $_eventPrefix property in your vendor model and set it to vendor
  • C. You must implement all appropriate methods and fire the events manually
  • D. Ensure that the primary key in the corresponding table is named vendor_id


Answer : B

Reference:
https://medium.com/@kangpaper/crud-models-in-magento-2-4e031861909b

You have added a new attribute origin of the type varchar to the product entity.
Which two calls will filter a product collection with origin set to ג€Californiaג€? (Choose two.)

  • A. $collection->addFieldToFilter(ג€˜originג€™, ג€Californiaג€);
  • B. $collection->addAttributeToSelect(ג€˜originג€™, ג€Californiaג€);
  • C. $collection->joinAttribute(ג€˜originג€™, ג€˜catalog_product/originג€™, ג€˜originג€™, ג€˜Californiaג€);
  • D. $collection->addAttributeToFilter(ג€˜originג€™, ג€Californiaג€);


Answer : BD

You are working on a custom web API endpoint and have configured it in etc/webapi.xml. This config is cached as part of the config_webservice cache type.
Keeping performance in mind, how do you refresh the cached version of this config using Magento CLI?

  • A. cache:clean config_webservice
  • B. cache:refresh config_webservice
  • C. cache:flush
  • D. cache:purge


Answer : A

You are implementing a custom module MyModule, which provides an implementation of \Psr\Log\LoggerInterface called \MyCompany\MyModule\Logger.
The LoggerInterface has the default preference declared in app/etc/di.xml.
Keeping upgradability in mind, how do you make \MyCompany\MyModule\Logger the default implementation of the LoggerInterface globally?

  • A. Declare a new preference for the LoggerInterface in app/code/myCompany/MyModule/etc/frontend/di.xml
  • B. Declare a new preference for the LoggerInterface in MyCompany/MyModule/etc/di.xml
  • C. Overwrite the existing preference for the LoggerInterface in app/etc/di.xml
  • D. Declare a new preference for the LoggerInterface in app/code/MyCompany/MyModule/etc/global/di.xml


Answer : C

Reference:
https://inchoo.net/magento-2/magento-2-logging/

Page:    1 / 7   
Total 109 questions