Please check Upwork-Odesk and elance test with answer which is the Recent upwork magento testpapers which was done in Nov/2015. If you have any answer of these Recent odesk magento testpapers you can please post in the answer in this post so that other can get benefit on this.All multiple question with answer of recent Upwork(oDesk) as well for elance test.
1) Assuming a left column is going to be added, which of the following are possible values of the block type in the code below?
a: catalog/navigation b: core/text_list c: page/template_container d: page/html
Ans: d
2) Assuming that a column needs to be added under Catalog >> Manage Products in Magento, which file will need to be edited?
a) app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Layout.php b) app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Grid.php c) app/code/local/Myname/Catalogextended/Block/Adminhtml/Catalog/Product/Design.php d) A custom column cannot be added under Catalog >> Manage Products.
Ans: b
3) Assuming that product images need to be imported from a product import file, which folder should the images be uploaded to, before running the import profile routine?
a)/media/ b) /media/import/ c) /import/ d) /
Ans: b
4) Assuming that trees must have categories as parents and products as children, and that there are no sub-categories under main categories, which of the following code samples will get the full catalog tree?
a) $categories = Mage::getModel('catalog/category')->getCollection(); foreach ($categories as $category) { print $category->getName(); $categoryDetails = Mage::getModel('catalog/category')->load($category->getId()); $products = $categoryDetails->loadChildProducts(); foreach($products as $product){ Print $product->getName(); } } b) $categories = Mage::getModel('catalog/category')->getCollection(); foreach ($categories as $category) { print $category->getName(); $products = Mage::getModel('catalog/category')->load($category->getId())->getProductCollection(); foreach($products as $product){ Print $product->getName(); } } c) $categories = Mage::getModel('catalog/category')->getCollection()->setLoadProducts(true); foreach ($categories as $category) { print $category->getName(); foreach($category->getProducts() as $product){ print $product->getName(); } } d) $products = Mage::getModel('catalog/product')->getCollection(); foreach ($products as $product) { print $product->getCategory()->getName(); print $product->getName(); }
Ans: b
5) An observer in Magento is defined as a:
a: method b: class c: event d: non of these
Ans: b
6) Assuming the following choices are to be added to a custom theme layout’s local.xml file; which of the following will move the “related products” box in the “product details page” to the bottom center column?
a:b: catalog.product.related catalog.product.related c: catalog.product.related catalog.product.related 1 d: None of the above. catalog.product.related catalog.product.related 0
Ans: a
7) By default, Magento allows 3 themes to be loaded at any time. In what order are they loaded? (1 being first and 3 being last)
a: 1 Custom default theme 2 Magento base theme 3 Custom non-default theme b: 1 Magento base theme 2 Custom default theme 3 Custom non-default theme c: 1 Custom non-default theme 2 Custom default theme 3 Magento base theme d: None of the above
Ans: c
8) For data security and privacy reasons, Magento uses two cookies for frontend session.
All I know is that one of them is being set in Mage_Core_Model_Cookie::set(..) and the other one in Zend_Session::expireSessionCookie().
Why does Magento use the Zend_Session::expireSessionCookie()?
a: Because it is necessary for magento and you must use that session. b: Because Magento relies heavily on the Zend Framework as the underpinning and it will be able to be ignored. c: Because Magento relies heavily on the Zend Framework as the underpinning and I must use that for frontend session without condition. d: It is the vestigial code, so I was able to delete the Zend cookie without any apparent deleterious effects
Ans: d
9) How can a new column be added in sales_flat_order to save a custom value in Magento?
a: By adding column name in Model b: By adding column name in Controller c: By adding column name in Block d: By defining column name in Block and table
Ans: d
10) How can account navigation links be changed?
a: Using an XML file to define the template b: Using a third party module c: Either using an XML file to define the template, or using a third party module d: None of these.
Ans: a
11) How can programmatically added bundle products be shown in Magento’s front-end?
a: By re-indexing b: By using the following codes: Mage::register('product', $product); Mage::register('current_product', $product); $product->setCanSaveConfigurableAttributes(false); $product->setCanSaveCustomOptions(true); c: By using the following: 1. setBundleOptionsData() 2. setBundleSelectionsData() 3. setCanSaveBundleSelections(true) d: It is not possible to show programmatically added bundle products in the front-end.
Ans: b
12) Consider the following code:
What is the meaning of A/B?
a: "Module's alias" / "Class name relative to the alias" b: "Controller's Alias" / "Class name relative to the alias" c: "Controller's Class" / "Method Name" d: "Method Name" / "Parameter"
Ans: a
13) How can the checkout process be skipped for downloadable products in Magento?
a: The checkout step cannot be skipped in Magento. b: Downloadable products automatically do not require checkout. c: There is an option in the admin panel to skip the checkout step for downloadable products. d: Magento does not support downloadable products.
Ans: a
14) How magento contact form can be shown on a CMS page?
a: By using block syntax {{block type="core/template" name="contactForm" template="contacts/form.phtml"}} b: By Using Layout Updatec: By Creating an Widget of Contact form and adding that widget to CMS page d: All of above is correct
Ans: d
15) Is it possible to trigger an event after an order has been set to “processing”?
a: Yes, by using a custom module. b: Yes, by registering an event. c: No, since it's a security threat. d: No, since no additional action can be added at this stage.
Ans: a
16) Magento has the ability to run multiple stores from the same database. After adding the new store from System -> Manage Store, what is the correct code to add to the htaccess file to make Magento automatically load the new store?
a: RewriteCond %{HTTP_HOST} ^oldstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourOldStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] b: RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] c: RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website] d: RewriteCond %{HTTP_HOST} ^newstore.com RewriteRule ^ - [E=MAGE_RUN_CODE:yourNewStoreCode] RewriteRule ^ - [E=MAGE_RUN_TYPE:website]
Ans: b
17) Select which conditions can be checked to track down a product that is not showing in a category page.
a: Product visibility must be "Listed"; b: Product must be enabled; c: Stock and quantity must be greater than 0; d: If using multiple websites, check which website the product points to;
Ans: b
18) Select which method will register observers/hooks to events in Magento:
a: Mage::registerObserver(‘’,’MyClass::observerFunction’); b: Using the option in the Magento Admin panel:System > Configuration > Advanced > Developer > Register Observer c: Registering observers using the XML layout of the module: d: Mage::registerObserver(‘myglobalobserver’); Function myglobalobserver($event,$args){ switch($event){ case ‘event1’: processevent1($args); break; case ‘event2’: processevent2($args); break; } } singleton company_module_model_observer methodToCall
Ans: c
19) Select the correct sequence of methods to use to create a bundle product in Magento.
a: setBundleOptionsData, setBundleSelectionsData, setCanSaveBundleSelections, setAffectBundleProductSelections b: setBundleOptionsData,setCanSaveBundleSelections,setBundleSelectionsData,setAffectBundleProductSelections c: setBundleOptionsData, setBundleSelectionsData, setAffectBundleProductSelections, saveBundleOptions d: setBundleOptionsData, setCanSaveBundleSelections,setSelectionCollection, setAffectBundleProductSelections
Ans: a
20) The “Suspected Fraud” Order status is grouped under which state?
a: Processing state b: Payment Processing state c: Pending shipment state d: Payment Review state
Ans: d
21) The browser is ignoring the file referred on the code below:
Assume that this is a PHP file that is used as a stylesheet in a Magento extension.
Which of the following choices will make the browser apply the stylesheet?
a: There is no solution; a PHP file cannot be used as a stylesheet. b: Use the "href" attribute instead of "src" to specify the file's location, as in: c: Call a static CSS file instead of using a PHP file as a stylesheet. d: Send a valid Content-Type HTTP header, as in: header("content-type: text/css");
Ans: c
22) What is the best way to create global variables which can be used everywhere in Magento?
a: Creating a empty module and adding a system.xml file to it b: Using the Magento Admin panel: System > Custom Variables > create a new custom variable c: Via a Magento Session $myValue = 'Hello World'; Mage::getSingleton('core/session')->setMyValue($myValue); d: $myValue = 'Hello World'; Mage::getModel('core/variable')->addMyValue($myValue);
Ans: c
23) What is the best way to store session values in Magento?
a: $myValue=’Hello world’; Mage::getSingleton( 'customer/session' )->setMyValue($myValue); b: $myValue=’Hello world’; Mage::getSingleton( 'core/session' )->setMyValue($myValue); c: $myValue=’Hello world’; Mage::getSingleton( 'core/variable' )->setMyValue($myValue); d: $myValue=’Hello world’; $_SESSION[‘MyValue’] = $myValue;
Ans: b
24) What is the correct method for calling a single product inside a static block?
a: {{block type="media/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}} b: {{block type="catalog/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}} c: {{block type="all/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}} d: {{block type="categories/product_single" product_id="1" template="catalog/product/singleproduct.phtml"}}
Ans: b
25) What does the Capture method do in the Magento Purchase and Order Processing flow?
a: Sends an authorization request to the payment gateway's API. b: Collects funds from the authorized transaction and puts it in the merchant's account. c: Throws an exception when authorization has failed. d: Collects the order and makes the shipment.
Ans: b
26) What is the correct method to add an external JavaScript file to Magento’s local.xml file?
a:b: c: d: None of the above
Ans: c
27) What is the difference between “Flush Magento Cache” and “Flush Cache Storage” in the Magento Cache Management System?
a: "Flush Magento Cache" removes "/tmp/" folder's cache only, while "Flush Cache Storage" clears everything. b: "Flush Cache Storage" removes "/tmp/" folder's cache only, while "Flush Magento Cache" clears everything. c: "Flush Magento Cache" and "Flush Cache Storage" are equivalent; they work the same way. d: None of the above.
Ans: a
28) What is the difference between the isSaleable() and isAvailable() functions?
a: isAvailable() is used to decide whether to show an "Add to Cart" button or not, while isSaleable() is used to decide whether to display the product as "in stock" or "out of stock". b: isAvailable() is used to decide whether to show an "Add to Cart" button or not, while isSaleable() is used to decide whether to display the product as "in stock" or "out of stock". c: There is no difference between the two functions. d: isAvailable() is used to decide whether to display the product as "in stock" or "out of stock", while isSaleable() is used to decide whether to show an "Add to Cart" button or not.
Ans: d
29) What is the recommended way to override/extend Magento core functionality?
a: Directly edit the core files of Magento with proper commenting. b: Mage::registerOverride(‘CoreClassName’,’CoreFunctionName’,’MyClassName’,’MyFunctionname’); c: Copy the original Magento core file to the app/code/local folder and customize that file. d: Create extended versions of core files in their own folder with extension information. app/code/core/Mage/Cms/Model/Page.php app/code/core/Mage/Cms/Model/Page.1.php App/code/core/Mage/Cms/Model/Page.2.php
Ans: c
30) When migrating a Magento store to a new server, after moving the files and the database, where must the database access details be configured for the new server?
a: Database table ‘core_config_data’ b: config.inc file at magento root c: app/etc/config.xml d: app/etc/local.xml
Ans: d
31) When using a custom Magento logo as the default logo for transactional emails; which of the following is the correct way for the logo to be maintained even after Magento system upgrades?
a: Replace the logo in the base theme skin directory. b: Create a new theme and replace the new logo in the skin directory. c: Update the logo in all transactional emails. d: Create a new theme and place the new logo, named as "logo_email.png", in the skin directory.
Ans: d
32) Which file needs to change to update database when transfer a local Magento install onto live server?
a: app/etc/config.xml b: app/db/config.xml c: app/etc/local.xml d: app/code/core/db/local.xml
Ans: c
33) Which of the following attributes are the data member of magento Mage_Newsletter_Model_Subscriber Class?
a: STATUS_SUBSCRIBED b: STATUS_NOT_ACTIVE c: STATUS_UNSUBSCRIBED d: All the above
Ans: d
34) Which of the following code samples will detect if the account being checked on the front-end is an admin account?
a: < ?php require_once 'app/Mage.php'; ini_set('display_errors',true); Mage::setIsDeveloperMode(true); umask(0) ; Mage::app(); //get the admin session Mage::getSingleton('core/session', array('name'=>'adminhtml')); //verify if the user is logged in to the backend if(Mage::getSingleton('admin/session')->isLoggedIn()){ echo "Admin Logged in with following details".'
'; echo "Admin Username: - ".Mage::getSingleton('admin/session')->getData('user')->getUsername().'
'; echo "Admin Encrypted Password: - ".Mage::getSingleton('admin/session')->getData('user')->getPassword().'
'; } else { echo "You need to be logged in as an admin."; } ?> b: < ?php Mage::getSingleton('core/session', array('name'=>'adminhtml') ); $adminsession = Mage::getSingleton('admin/session', array('name'=>'adminhtml')); if($adminsession->isLoggedIn()) { echo "
". "Admin Logged in"; } else { echo "
". "Admin NOT logged in"; } ?> c: $sesId = isset($_COOKIE['adminhtml']) ? $_COOKIE['adminhtml'] : false ; $session = false; if($sesId){ $session = Mage::getSingleton('core/resource_session')->read($sesId); } $loggedIn = false; if($session) { if(stristr($session,'Mage_Admin_Model_User')) { $loggedIn = true; } } var_dump($loggedIn); d: $userArray = Mage::getSingleton('admin/session')->getData(); $user = Mage::getSingleton('admin/session'); echo $userId = $user->getUser()->getUserId(); echo $userEmail = $user->getUser()->getEmail(); echo $userFirstname = $user->getUser()->getFirstname(); echo $userLastname = $user->getUser()->getLastname(); echo $userUsername = $user->getUser()->getUsername(); echo $userPassword = $user->getUser()->getPassword();
Ans: a
35) When does the following error occur? “Not all products are available in the requested quantity”
a: When the products are out of stock, but the cart still proceeded to checkout b: When the products are in stock, but not in the cart c: When no products are available d: None of these.
Ans: a
36) Which of the following code samples will display a list of both active and inactive sub-categories of the current category?
a: < ?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): if($_category->getIsActive()): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); ?> < ?php echo $cat->getName();?> < ?php endif; endforeach; ?> b: < ?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $helper = Mage::helper('catalog/category'); foreach ($collection as $cat): $cur_category = Mage::getModel('catalog/category')->load($cat->getId()); ?> < ?php echo $cat->getName();?> < ?php endforeach; ?> c: < ?php $_helper = Mage::helper('catalog/category'); $_categories = $_helper->getStoreCategories(); if (count($_categories) > 0): foreach($_categories as $_category): ?> < ?php echo $_category->getName() ?> < ?php endforeach; endif; ?> d: None of the above.
Ans: d
37) Which of the following code samples will display products from a certain category in random order?
a: $_productCollection = Mage::getResourceModel('catalog/product_collection'); Mage::getModel('catalog/layer')->prepareProductCollection($_productCollection); $_productCollection->getSelect()->order('rand()'); b: $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSort() ->addAttributeToSelect('*'') ->addCategoryFilter(Mage::getModel('catalog/category')->load()); $products->getSelect()->order(new Zend_Db_Expr('RAND()')); c: $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSort('id', 'RAND()') ->addAttributeToSelect('small_image') ->addCategoryFilter(Mage::getModel('catalog/category') ->load($catId)); d: $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSort('id', 'RAND()') ->addAttributeToSelect('small_image') ->addCategoryFilter(Mage::getModel('catalog/category') ->load($catId));
Ans: b
38) Which of the following code samples will get all products sorted by ‘position’, assuming ‘position’ is of a numeric type?
a: $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addAttributeToSort('position', 'ASC'); ->load(); b: $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addOrder('position', 'ASC'); ->load(); c: function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->load(); usort($products, "cmp"); d: function mySortByPosition($a, $b) { if ($a['position'] == $b['position']) { return 0; } return ($a['position'] < $b['position']) ? -1 : 1; } $products = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*') ->addSorter(mySortByPosition) ->load();
Ans: a
39) Which of the following code samples will link a configurable product’s images to its constituent simple products, in the product details page?
a: $_parentIdArray = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($_product->getId()); if(sizeof($_parentIdArray)==1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_parentIdArray[0]); } b: $_childIdArray = Mage::getModel('catalog/product_type_configurable')->getChildIds($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel('catalog/product')->load($_childIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_childIdArray[0]); } c: $_parentIdArray = Mage::getModel('catalog/product')->getIdsByChild($_product->getId()); if(sizeof($_parentIdArray) >= 1 && Mage::getModel('catalog/product')->load($_parentIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_parentIdArray[0]); } d: $_childIdArray = Mage::getModel('catalog/product')->getChildIdsByParent($_product->getId()); if(sizeof($_childIdArray)==1 && Mage::getModel('catalog/product')->load($_childIdArray[0])->getTypeId() == 'configurable'){ $_product = Mage::getModel('catalog/product')->load($_childIdArray[0]); }
Ans: a
40) Which of the following Events are triggered when the payment has been confirmed?
a: checkout_onepage_controller_success_action b: checkout_payment_confirmed c: sales_order_payment_pay d: payment_confirmed_action
Ans: c
41) Which of the following is the correct method to use to check if custom options were added to a product?
a: $product->hasCustomType(); b: $product->hasCustomOptions(); c: $product->hasOptions(); d: $product->hasOptionsType();
Ans: c
42) Which of the following is the minimum memory requirement for running a Magento site?
a: at least 128MB b: at least 256MB c: at least 512MB d: over 512MB
Ans: b
43) Which of the following Magento classes should be used for adding custom duties/taxes to a quote during the checkout process?
a: Mage_Sales_Model_Quote_Item_Option b: Mage_Sales_Model_Quote_Address_Total_Abstract c: Mage_Sales_Model_Quote_Item d: Mage_Sales_Model_Quote_Payment
Ans: b
44) Which of the following Magento objects will be created during checkout?
a: sales/payment b: sales/tax c: sales/order d: sales/quote
Ans: d
45) Which of the following methods can be used add a new attribute to all products?
a: Using XML layout files b: By creating a new field in the database table named ‘catalog_attributes’ c: Via the Magento Admin panel (Manage Attributes) d: By creating a new module
Ans: c
46) Which of the following conditions must be met in order to successfully run a Magento install script?
a: The install script should be placed in MODULE/sql/RESOURCES_KEY/SCRIPT_NAME. b: The install script should be named using the convention, mysql4-install-MODULE_VERSION.php c: The module version in config.xml and in the install script file name must be same. d: All of these.
Ans: d
47) Which of the following methods will allow access to a Magento session from other sites on different subdomains?
a: subdomain.domain.com needs to be entered in Magento's Admin->System->Configuration->Web->Cookie Domain, to make session cookies available to other subdomains. b: subdomain.domain.com needs to be entered in Magento's app/code/core/Mage/Core/Model/Config.php file, to make session cookies available to other subdomains. c: Allowing access to session cookies from other subdomains is not part of Magento's core functionality, but it can be achieved using extensions. d: It is not possible to access a Magento site's cookies on a different subdomain.
Ans: a
48) Which of the following needs to be edited to input and display the order attributes in Magento?
a: /app/design/adminhtml/default/default/template/sales/order/view/info.phtml b: /app/design/adminhtml/default/default/template/salesext/edit_form.phtml c: /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php d: Both /app/design/adminhtml/default/default/template/sales/order/view/info.phtml and /app/code/local/CWACI/SalesExt/controllers/Adminhtml/Sales/OrderController.php
Ans: d
49) Which of the following statements are correct to store Contact form data in database of magento?
A. By default Magento store the Contact form data in database
B. Need to create a custom module which store data in database by override the core contacts module
a: Statement A is true and Statement B is false b: Statement B is true and Statement A is false c: Both statements are true. d: Both statements are false.
Ans: b
50) Which of the following statements are true regarding custom options for products in Magento?
a: Custom options are only stored on the quote as option IDs and values. b: Every time the options are rendered, they are reloaded from the database. c: If the values for custom options are modified, they would need to be saved, and that will set them for all users. d: None of these.
Ans: A,B,C
51) Which of the following statements are true regarding passing data between a controller and a block in Magento?
a: It can not be done by using Magento's MVC approach, but it can be done by emulating traditional PHP MVC behaviors. b: It can not be done by emulating traditional PHP MVC behaviors, but it can be done by using Magento's MVC approach. c: It can be done by writing this code on a controller: Mage::transfer('data', $data); and writing this in the block: $data = Mage::registry('data'); d: It can be done by writing this code on a controller: Mage::register('data', $data); and writing this in the block: $data = Mage::registry('data');
Ans: a
52) Which of the following will add a new custom block on the product details page after the media block, using a custom module?
a:b: < ?php echo $this->getChildHtml('mymodule_folder_class');?> c: < ?php echo $this->getChildHtml('mymodule_class');?> d: None of the above.
Ans: b
53) Which of the following will add a static block on the site’s home page in Magento?
a:home-page-block b: < ?php $ref = new Mage_Page_Block_Html_Header(); if($ref->getIsHomePage()){ ?> < ?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('Your_StaticBlock_Id')->toHtml();?> < ?php } ?> c: home-page-block d: home-page-block
Ans: a
54) Which of the following statements are correct about Magento quotes?
a: Quotes are offers to the user, which if the user accepts get converted into orders. b: The lifetime of the quote cannot be controlled. c: Quotes don't deal with metadata about the store. d: Quotes are not related to order payment and shipping method information.
Ans: a
55) Which of the following will add an external JavaScript file to a Magento page?
a:b: c: d: http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
Ans; a
56) Which of the following will call a static block inside one of Magento’s template files?
a: $this->setBlockId('my_static_block_name')->toHtml() b: $this->getLayout()->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml() c: $this->createBlock('cms/block')->setBlockId('my_static_block_name')->toHtml() d: $this->getLayout()->createBlock('cms/block')->BlockId('my_static_block_name')->toHtml()
Ans: b
57) Which of the following will change the order of existing blocks via XML?
a:b: child_block_alias child.block.name name_of_block 1 child_block_alias c: child.block.name name_of_block 1 child_block_alias child_block_alias d: It is not possible to edit the order of existing blocks. child_block_alias parent.block.name name_of_block 1 child_block_alias
Ans: a
58) Which of the following will check whether the currently logged-in customer ever placed an order at the Magento store?
a: $order = Mage::getModel('sales/order')->getCollection() ->addAttributeToFilter('customer_id',$session->getId()) ->getFirstItem(); if ($orders->getSizeValue()) { } b: $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('entity_id', $customer->getEntityId()); if ($orders->getSize()) { } c: $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToFilter('customer_id', $customer->getId()); if ($orders->getValue()) { } d: $orders = Mage::getResourceModel('sales/order_collection') ->addFieldToSelect('*') ->addFieldToFilter('customer_id', $customer->getId()); if ($orders->getSize()) { }
Ans: d
59) Which of the following will correctly add a custom event in Magento?
a: Mage::registerEvent b: Mage::dispatchEvent c: Mage::addAction d: Mage::registerObserverEvent
Ans: b
60) Which of the following will correctly display the current theme name in Magento?
a: Mage::getSingleton('core/design_package')->getName(); b: Mage::getDesignPackage()->getName(); c: Mage::getSingleton('core/design_package')->getTheme('frontend'); d: Mage::getSingleton('core/design_package')->getName('package');
Ans: c
61) Which of the following will display a customer’s TAX/VAT number?
a: $taxvat = $order['customer_taxvat']; b: $order->getData('customer_taxvat'); c: $order->getQuote()->getCustomerTaxvat(); d: $order->getData()->getCustomerTaxvat();
Ans; A,B
62) Which of the following will check if the current request is for a backend page or a frontend page?
a: Mage::app()->getStore()->isAdmin() b: Mage::code()->getStore()->isAdminArea() c: Mage::app()->getStore()->Admin() d: Mage::app()->getStore()->AdminHtml()
Ans: a
64) Which of the following will display a product’s thumbnail?
a: $product->hasThumbnail()) $product->setThumbnail($product->getImage()); b: c: d:
Ans: d
65) Which of the following will display only ‘configurable’ products in a page?
a: $_productCollection = $this ->getLoadedProductCollection()->addAttributeToFilter('type_id','configurable'); b: < ?php if($_product->getTypeId() == "configurable"): ?> < ?php $_configurable = $_product->getTypeInstance()->getUsedProductIds(); ?> < ?php foreach ($_configurable as $_config): ?> < ?php $_simpleproduct = Mage::getModel('catalog/product')->load($_config); ?> < ?php //Magic php with a $_simpleproduct. ?> < ?php endforeach; ?> < ?php endif; ?> c: $_productCollection = $this->getLoadedProductCollection(); foreach ($_productCollection as $_product) { if ($_product->_data['type_id'] == 'configurable') { ... } } d: $collectionConfigurable = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', array('eq' => 'configurable'));
Ans: d
66) Which of the following will get a list of products belonging to a specific category within a view file?
a: $productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($category); b: {{block type="catalog/product_list" category_id="7" template="catalog/product/list.phtml"}} c: $productCollection = Mage::getResourceModel('catalog/product_collection')->addFilter($category); d: $productCollection = Mage::getModel('catalog/product_collection')->addCategoryFilter($category);
Ans: a
67) Which of the following will get active store information (such as the store’s name) in Magento?
a: Mage::app()->getStore(); b: Mage::app()->getStoreId(); c: Mage::app()->getName(); d: None of the above
Ans: a
68) Which of the following will get information (‘customer_referrer_id’) from a currently logged-in admin user?
a: $collection->addAttributeToFilter('customer_referrer_id', $referrer_id); $referrer_id = Mage::getSingleton('admin/session')->getUser()->getId(); b: $collection->addAttributeToSelection('customer_referrer_id', $referrer_id); $referrer_id = Mage::getSingleton('admin/session')->getUser()->getId(); c: $collection->addAttributeToFilter('customer_referrer_id', $referrer_id); $referrer_id = getSingleton('admin/session')->getUser()->getId(); d: None of these.
Ans: a
69) Which of the following will get the order increment ID in Magento?
a: $order = Mage::getSingleton('sales/order')->getLastOrderId(); $lastOrderId = $order->getIncrementId(); b: $orderId = $this->getOrderId(); c: $order = Mage::getModel('sales/order'); $order->load(Mage::getSingleton('sales/order')->getLastOrderId()); $lastOrderId = $order->getIncrementId(); d: None of these.
Ans: a
70) Which of the following will get the tax amount on a page in Magento?
a: Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount'); b: $totalItemsInCart = Mage::helper(‘checkout/cart’)->getItemsCount(); $totals = Mage::getSingleton(‘checkout/session’)->getQuote()->getTotals(); $subtotal = round($totals["subtotal"]->getValue()); $grandtotal = round($totals["grand_total"]->getValue()); >if(isset($totals['discount']) && $totals['discount']->getValue()) { $discount = round($totals['discount']->getValue()); } else { $discount = ”; } if(isset($totals['tax']) && $totals['tax']->getValue()) { $tax = round($totals['tax']->getValue()); } else { $tax = ”; } c: $order = Mage::getModel('sales/order')->load($order_id); $items = $order->getAllItems(); $subtotals = array(); foreach ($items as $_item) { if (array_key_exists($subtotals[$_item->getTaxClassId()])) { $subtotals[$_item->getTaxClassId()] += $_item->getRowTotal(); } else { $subtotals[$_item->getTaxClassId()] = $_item->getRowTotal(); } } d: < ?php $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); $data = $order->getData(); ?>
Ans: a
71) Which of the following will list all products from a particular category?
a: $products = Mage::getModel('catalog/category')->load($category_id) ->getProductCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addAttributeToFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ; b: $productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($category); c: $products = Mage::get(('catalog/category')->load($category_id) ->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addAttributeToFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ; d: $products = Mage::getModel('catalog/category')->load($category_id) ->getProduct() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addFilter('special_price', array('neq' => "")) ->setOrder('price', 'ASC') ;
Ans: b
72) Which of the following will not increase the performance of a Magento site?
a: Reducing the time spent on creation of the blocks b: Disabling the cache in the admin panel c: Switching on compiler mode d: Using auto-optimization extensions
Ans: b
73) Which of the following will retrieve a list of all shipping methods in Magento?
a: public function toOptionArray($isMultiSelect = false) { $methods = Mage::getSingleton('shipping/config')->getActiveCarriers(); $options = array(); foreach($methods as $_code => $_method) { if(!$_title = Mage::getStoreConfig("carriers/$_code/title")) $_title = $_code; $options[] = array('value' => $_code, 'label' => $_title . " ($_code)"); } if($isMultiSelect) { array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--'))); } return $options; } b: $salesQuoteRate = Mage::getModel('sales/quote_address_rate')->load($rate_id); if($salesQuoteRate){ echo '
CODE : '.$salesQuoteRate->getCode(); echo '
METHOD : '.$salesQuoteRate->getMethod(); } c: $iOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId(); $oOrder = Mage::getModel('sales/order')->loadByIncrementId($iOrderId); echo $oOrder->getShippingMethod(); echo $oOrder->getShippingDescription(); d: echo Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getShippingMethod();
Ans: a
74) Which of the following will return a visitor’s UserAgent information?
a: Mage::helper('core/http')->getHttpUserAgent() b: Mage::helper('core/mage')->getHttpUserAgent() c: Mage::helper('core/mage')->getHttpAgent() d: Mage::helper('core/http')->getHttpUserServer()
ans: a
75) Which of the following will return the absolute path for a product image in Magento?
a: A) echo $_product->getImageUrl(); b: B) echo $_product->getImagePath(); c: C) Both A and B d: D) None of the above
Ans: a
76) Which of the following will get a specific product attribute from its product ID without loading the whole product?
a: Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId); b: $product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($product); c: $object->getData($this->getAttribute()->getAttributeCode()); d: None of the above
Ans: a
77) Which of the following will save a custom session variable in Magento?
a: $_SESSION['name'] = 'frontend'; b: $session = Mage::getSingleton("core/session", array("name"=>"frontend")); $session->setData("device_id", 4); c: Mage::getSingleton( 'customer/session' )->setValue( 'name', array( 1, 2, 3 ) ); d: None of the above
Ans: b,c
78) Which of the following will set a template only if a particular module is disabled in Magento?
a:mytemplate.phtml b: Using File: app/code/core/Mage/Core/Model/Layout.php protected function _generateAction($node, $parent) { if (isset($node['ifconfig']) && ($configPath = (string)$node['ifconfig'])) { if (!Mage::getStoreConfigFlag($configPath)) { return $this; } } } c:d: None of these.
Ans: a
89) Which of the following will sort products in the catalog by the date they were added?
a: Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'created_at' => Mage::helper('catalog')->__('Date') b: Under "app/code/core/mage/catalog/model/resource/eav/mysql4/product/collection.php", add this value to the $options array: $this->getSelect()->order("e.entity_id desc"); c: Under "app/code/core/Mage/Catalog/Model/Config.php", add this value to the $options array: 'sort_by' => Mage::helper('catalog')->__('Date' d: It's not possible to sort products in the catalog by date.
Ans: a
80) Which of the following XML files will remove an item from Magento’s admin panel navigation?
a: < ?xml version="1.0" ?>b: < ?xml version="1.0" ?> c: < ?xml version="1.0" ?> d: Items under the Magento admin panel can't be removed.
Ans: a
81) Which XML file(s) should be checked when the following Magento error occurs during installation?
“PHP Extensions “0” must be loaded”
a: config.xml in app/code/core/Mage/Install/etc b: install.xml in app/code/core/Mage/Install/etc c: extensions.xml in app/code/core/Mage/Install/etc d: None of these
Ans: a
82) Why does the error, “front controller reached 100 router match iterations”, occur?
a: There is an error in the code. b: Some modules failed to load. c: Router references were set incorrectly. d: .htacces is blocking URLs.
Ans; c
83) Which of the followings magento features are related to CRM?
a: Newsletters b: Contact and Transactional Emails c: Poll d: All of above
Ans: d