Questão 1
Questão
You are building MyCompany/MyTheme and need to customize the header template. Where do you place the new phtml template to override the header?
Responda
-
MyCompany/MyTheme/templates/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/templates/html/header.phtml
-
MyCompany/MyTheme/Magento_Theme/templates/override/html/header.phtml
Questão 2
Questão
What is true regarding the differences between the define and require functions?(2)
Responda
-
define is passive and only runs when it is called.
-
require is always run (as long as the module's file is loaded).
-
define is an application's entry point. This is what should be used in a phtml template.
-
require is a dependency of the application and a error will result if this module is missing.
Questão 3
Questão
You are making some major modifications to the customer account page. These modifications mean that you are unable to use the original layout instructions for this page. In what file do you place your custom layout instructions?
Responda
-
app/design/frontend/MyCompany/MyTheme/layout/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/layout/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/layout/override/frontend/customer_account_index.xml
-
app/design/frontend/MyCompany/MyTheme/Magento_Customer/customer_account_index.xml
Questão 4
Questão
You are browsing the Magento_Catalog's widget file and see this:
<widget id="new_products" class="Magento\Catalog\Block\Product\Widget\NewWidget">
<parameters> <!-- ... --> </parameters> <containers> <container name="sidebar.additional">
<template name="default" value="list_default" /> <template name="names_only" value="list_names" />
<template name="images_only" value="list_images" />
</container>
</containers>
</widget>
What is the purpose of the template nodes?
Responda
-
It filters options for the template when the widget is inserted into a page's layout.
-
It sets a data value on the block when it is used in a CMS page or block.
-
It adds a new option to the widget configuration area.
-
It creates new templates when the widget is used in a container.
Questão 5
Questão
How do you locate strings to be translated a custom module.
Responda
-
Enable inline translation in Stores > Configuration
-
bin/magento i18n:collect-phrases
-
grep your module for __\(['"].*?['"]\)
-
Open the admin panel's Content > Translation Wizard.
Questão 6
Questão
What command symlinks files from a module or the var/view_preprocessed directories to their respective location in pub/static?
Responda
-
bin/magento dev:source-theme:deploy
-
bin/magento indexer:reindex
-
bin/magento setup:static-content:deploy
-
bin/magento setup:di:compile
Questão 7
Questão
On the catalog product page, this XML instruction is executed:
<block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="Magento_Catalog::product/view/review.phtml" after="product.info.stock.sku"/> You have created MyCompany_MyModule which needs to utilize your own version of review.phtml. What layout XML instruction do you use to accomplish this?
Responda
-
<referenceBlock name="product.info.review" template="MyCompany_MyModule::new-review.phtml"/>
-
<referenceBlock name="product.info.review">
<action method="setTemplate"><template>MyCompany_MyModule::new-review.phtml</template></action>
</referenceBlock>
-
<referenceBlock name="product.info.review">
<parameters>
<argument name="template" xsi:type="string">MyCompany_MyModule::new-review.phtml</argument>
</parameters>
</referenceBlock>
-
<referenceBlock name="product.info.review" remove="true"/>
<block name="product.info.review" template="MyCompany_MyModule::new-review.phtml"/>
Questão 8
Questão
Magento 2 Themes use a combination of ------ to achieve the desired look(Fill in gap)
Responda
-
PHP,HTML & XML
-
XML, CSS & HTML
-
CSS and JavaScript
-
HTML, JavaScript & CSS
-
All
Questão 9
Questão
Where Composer-based themes can be stored ?
Questão 10
Questão
You are building a module that will be sold on Magento Marketplace . This module adds significant functionality is meant as a foundation for building extra functionality & u need to provide developers with a way to easily add additional style. How do you do this?
Responda
-
In your _module.less file , add //@magento_import source/_foundation.less'; This will include all _foundation.less files into your module's _module.less
-
The _extends.less with an S at the end within the Blank Theme, is a file where they created all the classes that can be extended via LESS later within the theme, without the need of creating new components or modular structure for style changes
-
In your _modules.less file , Add @import 'source/_foundation.less'; .Magento has extentded the @import directive to search all modules
-
In view/web/css/source/includes.xml add: <includeAll>_foundation.less<includeAll>
-
You need to utilize the Assuilder class to compile other module's LESS files.
Questão 11
Questão
You see this <script/> in the source on a page:
{ "*": {"MyCompany_MyModule/js/modal": {} } }
What is the effect of the asterisk (*)?
Responda
-
The asterisk means that this module is not initialized with an associated element.
-
The asterisk means that this module is initialized with an associated element.
-
The asterisk is a typo & should be a dash (-)
-
The asterisk means that this module is initialize for each element on the page
-
The asterisk means that the module is initialized once for each root element
Questão 12
Questão
You are building a jQuery widget that renders this text : Welcome, %s! . How do you translate this?
Responda
-
Require mage/translate as $t , then : $t('Welcome, %s ').replace('%s', name)
-
Require magento/translate as $t , then : $t('Welcome, %s ').replace('%s', name)
-
_('Welcome, %s!', name);
-
Require mage/translate as $t , then : $t('Welcome, %s ', name)
-
Create a translation.json in view/web/js . Then , require MyCompany_MyModule/translation.json & parse the JSON
Questão 13
Questão
Your reviewing a Magento 2 build that another company developed , before the website goes live. In this process, you notice that while the original page load quickly ( and you see unformatted text & images ), it takes several seconds for the text & images to become styled. What is the solution ?
Responda
-
Switch the LESS compilation mode from Client-side to Server-side
-
Switch the SASS compilation mode from Client-side to Server-side
-
Switch the CSS compilation mode from Client-side to Server-side
-
Switch the JS compilation mode from Client-side to Server-side
Questão 14
Questão
You have been tasked with configuring a new setting in Content> Design. Where are the values saved that are set in this panel?
Responda
-
core_config_data
-
etc/system.xml
-
etc/config.xml
-
design_change
-
theme_confiquration
Questão 15
Questão
u r customizing the display of particular product. On this page u need to change the container in which the product option appear. Keeping ,maintainability in mind , how do u do this?
Responda
-
In the product admin page , choose the correct option in the "Display Product Option in" drop-down list
-
In the category that the product is associated with , choose the correct option in the "Product Options Container" dropdown
-
This is only possible with a layout XML update
-
In the product's admin page, change the Layout to be "2 columns with right bar"
Questão 16
Questão
U'v built a module: MyCompany_ProductEnhancements. ThirdParty_ProductModifier already exists in installation. u need to change a data variable set in <arguments> node . However, that change is not taking effect: it continues as value set by ThirdParty_SalesTax. How do u solve this problem?
Responda
-
Make MyCompany_ProductEnhancements dependent on ThirdParty_ProductUpdates
-
Copy the layout instructions from ThirdParty_ProductEnhancements into MyCompany_MyModule
-
Make ThirdParty_ProductUpdates depend on MyCompany_ProductEnhancements
-
Create a new layout XML file in MyCompany_ProductEnhancements layout/modifier directory
Questão 17
Questão
Magento contains the following layout instructions: <head><css src="css/styles-m.css"> <css src="css/style-l.css" meadia="screen and (min-width:768px)"> </head>. However, styles-m.css generated? How is styles-m.css generated?
Responda
-
Magento replace the .css files extension with .less & searches for styles-m.less in the web/css directory.
-
The Less preprocessor looks for all LESS files that match styles-m.less in the app/design/frontend directory
-
Magento automaticaly create styles-m.less which contain references to the other LESS files to be iported
-
The association of styles-m.less & sstyles-m.css is in a constant array it is always rendered
Questão 18
Questão
You Have been tasked with making a couple of small style modification in the Magento Luma Theme. Keeping upgrade-ability in mind, where do you add these changes?
Questão 19
Questão
u r creating a JS module that applies the magento accordion UI widget to an element . You have written this code: require(['jquery','accordion', ], function ($ , accordion){ var accordionWigdget = $ ("#accordion"). accordion(); }); How do u call method on the accordion after it has been initialized?
Responda
-
$("#accordion").accordion("activate");
-
$("#accordion").callWidgetMethod("accordion","activate");
-
$("#accordion").accordion.activate();
-
$("#accordion").accordion().activate();
Questão 20
Questão
What module initializes uiComponents?
Questão 21
Questão
What are differences between a container & a Block?(select 3)
Responda
-
Containers automatically render their children
-
container can render an HTML tag that surrounds child elements
-
Block render text or html
-
Blocks can only be placed inside containers
-
Only blocks render HTML
Questão 22
Questão
Magento provides a polyfill for ES6's string templates feature. This utilizes the syntax: ${}. What are valid values to be evaluated? (2)
Responda
-
$ { $.e1 }
-
$ { 1+1 }
-
${ bind:template }
-
${ this.value }
Questão 23
Questão
How do you configure a uiComponent on the frontend with layout XML?
Responda
-
<block name="my.block.name template="MyModule_MyCompany::block.phtml">
<arguments> <argument name="jsLayout" xsi:type="array"><!---Config here-->
</argument> </arguments> </block>
-
<block name="my.block.name template="MyModule_MyCompany::block.phtml">
<arguments> <argument name="cssLayout" xsi:type="array"><!---Config here-->
</argument> </arguments> </block>
-
<referenceBlock name="ui.components" >
<add name="new.component">
<!---Config here-->
<referenceBlock>
-
<block name="my.blcok.name" template="MyModule_MyCompany::block.phtml">
<ui_component>
<!---Config here-->
</ui_component>
</block>
-
<ui_component name = "conponent_name"/> Then , add configuration in
ui_component/component_name.xml
Questão 24
Questão
When you override an existing template using design fallback directories, what are potential problems? (2)
Responda
-
If the theme that contains the overriding template is not utilized for the website, the template will not be used
-
When original template is upgraded , it is easy to miss that the overriding template needs to be updated
-
If there is an error the new template file , the old one will be rendered
-
If the store configuration , design/templates/allow_symlinks == false , the overriding template will not be rendered
Questão 25
Questão
You have configured a new block in Layout XML with this code:
<block name ="my.block" template="MyCompany_MyModule::myTemplate.phtml"> <argument name="test_value" xsi:type="number">1000<argument> <argument> </arguments> </block> (2)
Responda
-
<?=block->test_value ?>
-
<?= $block->getTestValue; ?>
-
<?= $block->getTestData; ?>
-
<?= $block->getTestArg; ?>
Questão 26
Questão
ur creating a custom theme(MyCompany/MyTheme) that inherits ModuleVendor>BeautifulTheme. This inherite the Magento Blank theme. I what order will be the Magento fallback mechanism look for files?
Responda
-
MyCompany/MyModule >ModuleVendor/BeautifulTheme>Magento/Blank>Module
-
MyCompany/MyTheme >MyThemeVendor/BeautifulTheme>Magento/Blank>MyTheme
-
MyCompany/MyModule>Module
-
MyCompany/MyModule >ModuleVendor/BeautifulTheme>Module
Questão 27
Questão
u need to achieve this output fro a container:
<div class="product_view"> <!--content goes here--> </div> What attributes do you use on the <container/> layout instruction to achieve this? (2)
Questão 28
Questão
Themes provide customization options in etc/view.xml. You are writing a PHTML template that will utilize configuration in this file. In your templete, how do you load a value from etc/view.xml ?
Responda
-
<?= $block->getVar("image_width",Magento_Catalog");?>
-
<?= $block->getScopeConfig()->getValue('theme/Magento_Catalog/image_width'); ?>
-
<?= $block->getData('theme_Magento_Catalog_image_width'); ?>
-
<?php
$objectManager= \Magento\Framework\App\objectManager::getInstance();
$configuration =$objectManager->create('\Magento\Framework\Theme\Model\Configuration');
echo $configuration->getValue(Magento_Catalog/image_width);
?>
Questão 29
Questão
ur needing to add some extra spaces into the rendering of a customer's address. Keeping maintainability in mind , where do you make this change?
Responda
-
Store>Configuration>Customers>Customer Configuration>Address templates
-
Store>Configuration>Customers>Customer Configuration>Account Information Options
-
Store>Configuration>Customers>Customer Configuration>Name and Address Options
-
Store>Configuration>Customers>Customer Configuration>Login Options
Questão 30
Questão
Calling and initializing JavaScript, Magento 2, you have two options for specifying declarative notation: using the data-mage-init attribute & <script type="text/x-magento-init" /> tag Use the data-mage-init attribute to insert a JS component in a specified HTML element. The following example inserts a JS component in the <nav/> element:
What are valid ways to initialize Magento-dependent Javascript on a page? (Select 2)
Responda
-
In a HTML element: <div data-mage-init='{ "MyCompany_MyModule/js/modal": {} }' > </div>
-
In ur modules requirejs-config.js: var config = {deps: [MyConmpany_MyModule/js/modal ]};
-
using the data-mage-init attribute
-
using the <script type="text/x-magento-init" /> tag
Questão 31
Questão
U'v tasked with creating a new page layout type:text. This similar to a 2-column layout, except that larger of 2columns is slightly smaller so that text is easier to read. U'v created view/page_layout/text.xml but 2 columns r not rendering. Keeping upgradeability in mind, what dud to fix?
Responda
-
Add <update handle="2columns-right">
-
Add <update handle="2columns">
-
Add <update handle="3columns">
-
Add <update handle="1columns">
Questão 32
Questão
ur browsing the uiComponent confiquration in checkout_index_index.xml & see the following code:
<item name="customer-email" xsi:type="array"> <item name="component" xsi:type="string"> Magento_checkout/js/view. </item> <item name="displayArea" xsi:type="string">customer-email </item>
</item>
Responda
-
In a knockout template:
<!-- ko foreach: getRegion('before-login-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('after-login-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('before-register-form')-->
<!-- /ko -->
-
In a knockout template:
<!-- ko foreach: getRegion('login-form')-->
<!-- /ko -->
Questão 33
Questão
u see these layout handles r available for customization on the catalog product pages: catalog_product_view catalog_product_vew_type_bundle default 2columns-left ; Which layout handle is always loaded firest on the catalog product page?
Responda
-
default
-
blank
-
custom
-
luma
Questão 34
Questão
What effects does enableing a category's "Anchor" setting have?(select 2)
Responda
-
it enables layered navigation
-
it includes childs products alongside any products associated with the current category
-
it disables layered navigation
-
it delete layered navigation
Questão 35
Questão
ur maintaining Magento website that is hosted on an old server(& due to corporate bureaucracy cannot be moved to a better hosting). This server utlizes Apache 2.2 & serves files over a HTTP/1 connection. When the page loads, there is a significant gap untile any Javascript-enabled functionality is usable. What do u do to remediate the slow Javascript?
Responda
-
Enable javascript bundling in Store>Configuration>Advanced> Developer>JS
-
Enable css bundling in Store>Configuration>Advanced> Developer>CS
-
Enable full page cache
-
Remove unnecessary js from running requirejs-config.js
-
Buld the static assets with the --bundleJs flag
Questão 36
Questão
n browsing through Magento Luma theme, u see a etc/view.xml file .What is purpose of this file?
Responda
-
This file contains configuration settings for aspects of rendering the theme.
-
This file contains configuration settings for aspects of rendering the module.
-
This file contains directive for how to hanlde fallback theme
-
This file contains layout xml for updating parameter for exiting block
Questão 37
Questão
u have created a new module & all its required files. A ur then making additions to catlog_product_view.xml no change r visible. What is remedy?
Responda
-
Run bin/magento module:enable MyCompnay_MyModule
-
Run bin/magento module: set: enable MyCompnay_MyModule
-
Run bin/magento module:active MyCompnay_MyModule
-
Run bin/magento module:live MyCompnay_MyModule
Questão 38
Questão
Keeping maintability i mind , how d u render a link on a CMS pages/block?
Responda
-
{{ store url="/path/to/destination"}}
-
{{ store url="/path/to/theme"}}
-
{{ store url="/path/to/module"}}
-
{{ store url="/path/to/plugin"}}
Questão 39
Questão
u need to set cache_key on a block that does not contain a class attribute. How dud this?
Responda
-
<referenceBlock name="block.name">
<arguments> <argument name="cache_key" xsi:type="string"> kayName<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="block.name">
<arguments> <argument name="cache_key" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="page.name">
<arguments> <argument name="cache_key" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
-
<referenceBlock name="page.name">
<arguments> <argument name="kayName" xsi:type="string"> cache_key<argument> </arguments>
</referenceBlock>
Questão 40
Questão
Ur creating a new transactional email template. Keeping maintainability in mind , how du add an image located in u theme?
Responda
-
<img src="{{ view url="Mycompany _MyModule/images/image.png}}">
-
<img src ="/path/to/file.png"/>
-
<img src="{{ media url="Mycompany _MyModule/image/image.png}}">
-
{{ image theme ="MyCompany_MyModule/images/image.png"}}