Zend Framework Multiple choice Questions

25+ TOP Zend Framework Questions and Answers

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

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 ());
b. <code>
$element-:’attachDecoratc’r (‘Viewflelper’);
c. <code>
$element—>addt3eccratcr (‘ViewHelper9;
d. <code>
$element->addDecorator (‘Viewelper’,
array(’helper’ > ‘foo’));
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’;
b. <code>
$view—>assign (array (
‘foc’ > ‘bar’,
‘bar’ > ‘baz’,
c. <code>
$view—>assign (‘ f oo’, ‘bar’);
$view->assign(’bar’, ‘baz’);
</ code>
d. <code>
$view->as sign (
array(’foo’ > ‘bar’),
array(’bar’ > ‘baz’)
Ans: d

19. If $cache is an instance of Zend Cache Frontend Function, which ONE of the following will cache this function call:
$result = nultiply(S, 10);
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.
Ans: b

25. XML-RPC fault responses are reported by Zend XmlRpc Client
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
d. XML
Ans: d

Frequently asked Zend Framework MCQs