Pages

Tuesday, 15 August 2017

30 Latest Zend Framework Multiple choice Questions and Answers for freshers and experienced pdf


Real Time Zend Framework Online Quiz Questions and Answers


=> Also Read Zend Framework Questions
1. ZendAcl supports _____ inheritance among Resource objects.
a. cyclic
b. multiple
c. no
d. single
Ans: d

2. Zend_Auth throws an exception upon an unsuccessful  authentication attempt due to invalid credentials (e.g., the username does not exist).
a. True
b. False
Ans: b
Zend Framework Online Quiz Questions

3. Is the following class name valid?: My Foo 123
a. Yes
b. No
Ans: a

4. The filename “Zend/Db/Table.php” must map to the class name _______?
a.   Zend Table
b.  Zend Db Table
Ans: b

5. ZendDb contains a f actory() method by which you may instantiate a database adapter object
a. True
b. False
Ans: a

6. Zend DB Select supports querying columns containing expressions (e.g., LOWER(someColumn))
a. True
b. False
Ans: a

7. Which ONE of the following will NOT display the value of $ var?
a. echo ZendDebug::dump($var, ‘var’, false);
b. obstartO;
Zend debug: :dump ($var, ‘var’, false);
ob end f lush ;
c. Zend Debug: :dump($var, ‘var’, true);
d. ZendDebug::dump($var, ‘var’);
Ans: b

8. Which formatters are provided with Zend Log? (choose two)?
a. Zend Log Formatter Db
b. Zend Log Formatter Simple
c. Zend Log Formatter Text
d. Zend Log Formatter Xml
Ans: d

9. Validators used with Zend Form should implement which class?
a. Zend_Form_ValidatorAbstract
b. Zend_Validate_Abstract
c.Zend_Validate_Inter face
d. Zend Fo rm Validate Inter face
Ans: c

10. Which of the following is NOT a valid mechanism for adding a decorator to an element?
a. <code>
$element->addDecorator (new
ZendForrnDecoratorViewlielper ());
</code>
b. <code>
$element-:’attachDecoratc’r (‘Viewflelper’);
</code>
c. <code>
$element—>addt3eccratcr (‘ViewHelper9;
</code>
d. <code>
$element->addDecorator (‘Viewelper’,
array(’helper’ > ‘foo’));
</code>
Ans: b

11. Zend_Config allows hierarchical and sectioned key-value pairs to exist in a single file.
a. True
b. False
Ans: a

12. Given $tree = new Tree(array(’type’ => ‘cedar’)); , and you
wish to persist this object via Zend_Session, which call
will put this object in the default namespace?
a. Zend Session Nanespace: :set(’tree’, Stree);
b. $sess = new Zend Session NamespaceQ;
$sess->tree = Stree;
c. $sess = new ZendSessionQ;
$sess->tree = $tree;
d. $sess = Zend Session: :getlnstance()
$sess—>set (‘‘, $tree);
Ans: b

13. Which method of Zend Locale will check if a given string is a locale?
a. isLocale
b. areLocale
Ans: a

14. Which Zend Date constant should you use when you want to have the date formatted for an RS3 feed?
a. Zend_Date: :RSS FEED
b. Zend Date: :RSS2
c. Zend_Date: :RSS
d. Zend_Date: :RSSFEED
Ans: c

15. With quotas enabled which methods might fail because you’re over quota? 
a. appendNessage()
b. removeMessage()
c. createFolder()
d. getMessage()
Ans: a,b

16. Which one of the following will NOT assign the values to the view object?
a. <?php
$mail = new Zend Mail Storage Pop3 Tls (array( ‘host’
=‘example.com’,’user’ =‘test’)); ?>
b. <?php
$mail = new Zend Mail Storage Pop3 (array(’host’
=‘example.com’,’user’ =‘test’,
‘ssl’ = true)); ?>
c. <?php
$mail = new Zend Mail Storage Pop3 (array( ‘host’
=‘example.com’, ‘user’ =‘test’,
‘ssl’ = ‘tls’)); ?>
d. <?php
$mail = new Zend Mail Storage Pop3 (array(’host’
=‘exarnple.com’, ‘user’ =‘test’,
‘tls’ = true)); ?>
Ans: c

17. Front Controller plugins and Action Helpers share what comon feature?
a. pre— and postDispatch() hooks
b. Introspection of the action controller
c. Ability to change routing behavior
d. Registration with a comon broker
Ans: a

18. Which one of the following will NOT assign the values to the
view object?
a. <code>
$view—>foo = ‘bar’;
$view->bar = ‘baz’;
</code>
b. <code>
$view—>assign (array (
‘foc’ > ‘bar’,
‘bar’ > ‘baz’,
));
</code>
c. <code>
$view—>assign (‘ f oo’, ‘bar’);
$view->assign(’bar’, ‘baz’);
</ code>
d. <code>
$view->as sign (
array(’foo’ > ‘bar’),
array(’bar’ > ‘baz’)
</code>
Ans: d

19. If $cache is an instance of Zend Cache Frontend Function, which ONE of the following will cache this function call:
<php>
$result = nultiply(S, 10);
</php>
a. $result = $cache—>call(’ntultiply’, array(S, 10));
b. $result = $cache->call(’nultiply’, 5, 10);
c. $result = $cache—>niultiply(array(5, 10));
d. $result = $cache->rnultiply(5, 10);
Ans: a

20. Which ONE of the following will create a memory manager object?
a. $memoryManager = new ZendMemory(’None’);
b. $memoryMar.ager = new ZendMemoryBackendNorieQ;
c. $memory&lanager = ZendMemory::factory(’None’);
d. $memoryManager = Zend Memory: :getlnstance(’Nrne’);
Ans: c

21. Which method should be used to retrieve total number of documents stored in the index (including deleted documents)?
a. $index—>countDocuxnents fl;
b. $index->numooc O;
c. $index->docCountQ;
d. $index—>countO;
Ans: d

22. How to get full list of indexed fields from the index?
a. $index->getFields(true);
b. $index->getFields (false);
c. $index->getFields(Zendsearchtucene Field: :INDEXED);
d. $index->getFields fl;
Ans: a

23. When using Zerid_View with unescaped data, which of the following view script calls would escape your data, $data:
a. $this->filter ($data)
b. $this->escape($data)
c. $this->htmlEntities ($data)
d. $data->escape ()
Ans: b

24. Zend Auth will, regardless of the adapter used to process identities and credentials, will encrypt the information sent from the browser to the application using it.
a. TRUE
b. FALSE
Ans: b

25. XML-RPC fault responses are reported by Zend XmlRpc Client
by:
a. Raising an exception
b. Triggering an error
c. Using the client’s isFault() method
d. Checking for a fault Message in the response
Ans: a

26. Zend Rest Client expects a REST service that returns what type of content?
a. Plain text
b. JSON
c. HTML
d. XML
Ans: d

TOP Zend Framework Objective type Questions for freshers

30 TOP Zend Framework Interview Questions and Answers pdf download


Real Time Zend Framework Interview Questions and Answers PDF

=> Also Read Zend Framework MCQs
1. Which version of PHP does Zend Framework require? 
Zend Framework requires PHP 5.2.4 and up. Some Zend Framework components may work with earlier versions of PHP, but these components are tested and supported only on 5.2.4 and up.

2. Does Zend Framework support PHP 4?
No. Zend Framework was built to use all of the sophisticated object oriented features of PHP 5 and take advantage of significant performance and security enhancements.
Another consideration was support of the platform ZF would be running on. The PHP community officially discontinued support for PHP 4 as of 2008-01-01, and no critical security updates will be published for PHP 4 after 2008-08-08.
These factors, among others, convinced us that PHP 5 was the best platform for Zend Framework and applications built on ZF.
Zend Framework FAQs

3. Where is the model in ZF's MVC implementation?
The model component can vary dramatically in responsibilities and data store from one MVC application to the next. The ZF community has not defined a model interface, class, or other formalism simply because we wanted to avoid introducing limitations without significant added value.

4. Is ZF a component library or a framework?
Simple answer: both. Zend Framework provides all the components required for most web applications in a single distribution. But Zend Framework components are also loosely coupled, making it easy to use just a few components in a web application- even alongside other frameworks! Using this use-at-will architecture, we are implementing features commonly found in more monolithic frameworks. In fact, we are currently working on a tooling component for the 1.8 release that will make it simpler to build applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components. It's a testament to the use-at-will architecture of Zend Framework that the tooling component itself can be used standalone.

5. Where's the model?
Unlike the view and the controller components, the model component can vary dramatically in responsibilities and data storage from one MVC application to the next. It should represent what your application does in the abstract. The Zend Framework community has not defined a model interface, class, or other formalism because we haven't identified enough added value to justify limitations on what constitutes a model.

6. I want to use a SQL function or perform calculations in a statement I'm generating with Zend_Db_Select. How can I do this?
Actually, by default, if your expression includes parentheses, Zend_Db_Select will cast the statement appopriately. However, if it does not, or you are having problems, you can useZend_Db_Expr to explicitly create the expression:
* Build the SQL:
* SELECT p."product_id", p.cost * 1.08 AS cost_plus_tax
* FROM "products" AS p
*/
$select = $db->select()
->from(array('p' => 'products'),
array(
'product_id',
'cost_plus_tax' => new Zend_Db_Expr('p.cost * 1.08'),
));

7. Is ZF a component library or a framework?
ZF is both. Zend Framework provides all the components required for most web applications in a single distribution. But Zend Framework components are also loosely coupled, making it easy to use just a few components in a web application- even alongside other frameworks! Using this use-at-will architecture, we are implementing features commonly found in more monolithic frameworks. In fact, we are currently working on a tooling component for the 1.8 release that will make it simpler to build applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components. It’s a testament to the use-at-will architecture of Zend Framework that the tooling component itself can be used standalone.

8. What is autoloader?
Autoloader is function that load all the object on start up.

9. What is use of Zend front controller?
Routing and dispatching is managed in the front controller. It collects all the request from the server and handles it.

10. What is the use of Bootstrap?
Apart from index if we want to do any extra configuration regarding database and other things that is done within bootstrap.

11. Zend auth?
It is used to authenticate user, for example like admin, general etc.

12. Zend Acl?
Based on the zend authentication it allows the user to access certain actions.

13. How do u set Module name, Controller name, and Action name in Zend framework?
a) $request->setModuleName(‘front’);
b) $request->setControllerName(‘address’);
c) $request->setActionName(‘addresslist’);

14. Configuration in Zend Framework, application.ini file?
Configuration can be done in application.ini file in Zend framework. This file in the path application/configs/application.ini.

15. Checking whether form posted or not in Zend framework?
$request = $this->getRequest();
$_GET = $request->getParams();
$_POST = $request->getPost();

16. Does Zend Framework support PHP 4?
No. Zend Framework was built to use all of the sophisticated object oriented features of PHP 5 and take advantage of significant performance and security enhancements.

17. Fetch last inserted id, fetch all record and fetch a single record.
$this->_db->lastInsertId();
$this->_db->fetchAll($sql);
$this->_db->fetchRow($sql);

18. Difference between Zend_Registry and Zend_Session?
The basic difference between these objects is the ‘scope’ in which they are valid:
a) Zend_Registry : request scope
b) Zend_Session : session scope
Zend_Registry is used to store objects/values for the current request. In short, anything that you commit to Registry in index.php can be accessed from other controllers/actions (because EVERY request is first routed to the index.php bootstrapper via the .htaccess file). Config parameters and db parameters are generally prepped for global use using the Zend_Registry object.
Zend_Session actually uses PHP sessions. Data stored using Zend_Session can be accessed in different/all pages. So, if you want to create a variable named ‘UserRole’ in the /auth/login script and want it to be accessible in /auth/redirect, you would use Zend_Session.

19. When do we need to disable layout?
At the time of calling AJAX to fetch we need to disable layout.
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

20. Filters in Zend Framework with Examples?
The Zend_Filter component provides a set of commonly needed data filters. It also provides a simple filter chaining mechanism by which multiple filters may be applied to a single datum in a user-defined order.
Example:
// Add an email element
$this->addElement(‘text’, ‘email’, array(
‘label’ => ‘Your email address:’,
‘required’ => true,
‘filters’ => array(‘StringTrim’),
‘validators’ => array(
‘EmailAddress’,
)
));
Other Filters:
Alnum – Zend_Filter_Alnum is a filter which returns only alphabetic characters and digits. All other characters are supressed.
Alpha – Zend_Filter_Alpha is a filter which returns the string $value, removing all but alphabetic characters. This filter includes an option to also allow white space characters.

21. Name some important component in zend framework?
Uses of Zend_Controller
Gives the request & reponse methods by using its sub-classes.
$request = new Zend_Controller_Request_Http()
$response = new Zend_Controller_Response_Http()

Uses of Zend_Date
Date related processing can be done using this component.

Uses of Zend_File_Transfer
it provides extensive support for file uploads and downloads.

Uses of Zend_Db
It is used to doing database related purpose in our appication.

Uses of Zend_Paginator
Doing the pagination in our application.

Uses of Zend_Auth
It is used to authenticate a user.

$auth = Zend_Auth::getInstance();
$results = $auth->authenticate($adapter);
if ($results->isValid()){
/* user successfully authenticate into login process */
}

Zend_Session_Namespace
This is a simple proxy class to use API into the Zend_Session managed $_SESSION Superglobal.


22. Where is the model in ZF’s MVC implementation?
The model component can vary dramatically in responsibilities and data store from one MVC application to the next.

23. How to call two different views from same action?
Example1:
Public function indexAction() {
If(condition)
$this->render(‘yourview.phtml’);
Else
Index.phtml;
Example2:
Public function indexAction() {
}
Now in your index.phtml you can have this statement to call other view
$this->action(‘action name’,’controller name’,’module name’,array(‘parameter name’=>’parameter value’));

24. Can we call a model in view?
Yes, you can call a model in view. Simple create the object and call the method.

25.  How can I customize the appearance of forms generated by Zend_Form?
You're probably looking for decorators. All forms and form elements in Zend_Form use decorators to render their output.

26. Why can't Zend_Form render my File element without errors?
The file element needs a special file decorator, which is added by default. When you set your own decorators for file elements, you delete the default decorators. For example:
$element->setDecorators(array(
    array('ViewHelper'),
    array('Errors')
));
You should use a File decorator instead of the ViewHelper for the file element, like so:
$element->setDecorators(array(
    array('File'),
    array('Errors')
));

27. How can I detect if an optional file has been uploaded?
The receive() method will return true for file elements that are not required. The reason is that you said "the file can be omitted, and that's ok for me". The receive() method will return false only in the event of a failure.
Still there are several ways to detect if a file has been uploaded or not:
    Use isUploaded which returns a boolean
    Use getFileName which returns null in this case (note that you must use the latest release for this behaviour)
    Use getFileInfo which will have an empty 'file' key and the flag 'isUploaded' set to false


28. Custom function to Fetch last Insert ID in Zend Framework
 public function insertData($tableName,$colName) {
    $this->_name = $tableName;
    $sql = "INSERT INTO $tableName SET $colName";
    $this->_db = $this->getAdapter();
    $this->_db->query($sql);
    return $this->_db->lastInsertId();
 }


Latest Zend Framework Interview Questions for freshers and Experienced pdf