YouTube Icon

Interview Questions.

Zend Framework Interview Questions and Answers - Jul 17, 2022

fluid

Zend Framework Interview Questions and Answers

Q1. What is a Framework?

Ans: In software improvement, a framework is a described assist shape in which some other software program venture may be organized and advanced.

An summary design

 Set of not unusual capability

 Developed for a specific area

 Q2. How to disable format from controller?

Ans: $this->_helper->format()->disableLayout();

Disable Zend Layout from controller for Ajax call handiest

if($this->getRequest()->isXmlHttpRequest())

$this->_helper->format()->disableLayout();

Q3. How to change the View render record from controller?

Ans: feature listAction()

//call any other view report document

$this->render("anotherViewFile");

Q4. How to shield your web page from square injection in zend when the use of pick query?

Ans: $choose = $this->pick out()

from(array('u' => 'customers'), array('identity', 'username'))

where('call like ?',"%Hypertext Preprocessor%")

where('user_id=?','five')

wherein('rating<=?',10);

Q5. How to check post method in zend framework?

Ans: if($this->getRequest()->isPost())

//Post

else

//Not submit

Q6. How to get all POST information?

Ans: $this->getRequest()->getPost();

Q7. How to get all GET facts?

Ans: $this->getRequest()->getParams();

Q8. How to redirect to every other page from controller?

Ans: $this->_redirect('/customers/login');

Q9. How to get variable's value from get?

Ans: $identity= $this->getRequest()->getParam('identification');

Q10. Create Model document in zend framework?

Ans: elegance Application_Model_Users extends Zend_Db_Table_Abstract 

blanketed $_name = "users";

included $_primary = "id";

Q11. How to create item of Model?

Ans: $userObj = new Application_Model_Users();

Q12. Which Class amplify the Zend Controller?

Ans: Zend_Controller_Action

For Example:

magnificence AjaxController extends Zend_Controller_Action 

Q13. Which Class extend the zend Model?

Ans: Zend_Db_Table_Abstract

For Example :

class Application_Model_Users extends Zend_Db_Table_Abstract  

Q14. What is a framework?

Ans: In software program improvement, a framework is a described support shape in which any other software task can be organized and developed.

HubSpot Video
 

Q15. Why should we use framework?

Ans: Framework is a dependent system in which we get following things

Rapid software development(RAD).

Source codes turn out to be greater achievable.

Easy to increase functions.

Q16. Where we set configuration in zend framework?

Ans: We set the config in application.Ini that's located in utility/configs/software.Ini.

Q17. What is Front Controller?

Ans: It used Front Controller sample. Zend additionally use singleton sample.

RouteStartup: This feature is known as earlier than Zend_Controller_Front calls on the router to evaluate the request.

RouteShutdown: This characteristic is called after the router finishes routing the request.

DispatchLoopStartup: This is referred to as earlier than Zend_Controller_Front enters its dispatch loop.

PreDispatch: referred to as earlier than an motion is dispatched by using the dispatcher.

 PostDispatch: is called after an movement is dispatched by using the dispatcher.

Q18. What is complete form of CLA in Zend Framework?

Ans: Contributor License Agreement

Q19. Should I signal an person CLA or a corporate CLA?

Ans: If you're contributing code as an individual- and no longer as a part of your activity at a corporation- you ought to signal the man or woman CLA. If you are contributing code as part of your duties as an worker at a organization, you need to put up a corporate CLA with the names of all co-employees that you foresee contributing to the venture.

Q20. How to include js from controller and think about in Zend?

Ans: From within a view report: $this->headScript()->appendFile('filename.Js'); From within a controller: $this->view->headScript()->appendFile('filename.Js'); And then someplace to your layout you need to echo out your headScript object: $this->headScript();

Q21. What are Naming Convention for PHP File?

Ans:

There must now not any PHP closing tag (?>)in controller & Model document.

Indentation must include 4 spaces. Tabs aren't allowed.

The target line period is 80 characters, The most duration of any line of PHP code is one hundred twenty characters.

 Line termination follows the Unix textual content record convention. Lines have to quit with a unmarried linefeed (LF) man or woman.                  Linefeed characters are represented as ordinal 10, or hexadecimal 0x0A

 

Q22. What Zend Acl?

Ans: Based on the zend authentication it allows the user to get entry to sure movements.

Q23. How to use replace statemnet in Zend Framework?

Ans: elegance Application_Model_Users extends Zend_Db_Table_Abstract

included $_name = 'users';

protected $_primary = 'id';

feature updateData($updateData = array()) 

//please replace dynamic records

$this->replace(array('name' => 'arun', 'kind' => 'user'), array('identity=?' => 10));

Q24. How we can do multiple column ordering in Zend Framework?

Ans: class Application_Model_Users extends Zend_Db_Table_Abstract 

covered $_name = 'customers';

blanketed $_primary = 'identification';

function users() 

$pick = $this->choose()

->setIntegrityCheck(fake)

->from(array('u' => 'users'), array('call as t_name'))->order('first_name asc')->order('last_name des');

go back $this->fetchAll($pick);

Q25. Why have to we use framework?

Ans: Framework is a established system

Source codes grow to be greater achievable

Easy to extend capabilities

Rapid application improvement

Q26. Configuration in Zend Framework, software.Ini report?

Ans: Configuration may be finished in application.Ini report in Zend framework. This document within the course software/configs/software.Ini.

Q27. Checking whether or not shape posted or not in Zend framework?

Ans: if($this->getRequest()->isPost()) echo "Form published"; 

Q28. Does Zend Framework aid PHP four?

Ans: No. Zend Framework become built to use all the state-of-the-art item oriented functions of PHP 5 and take advantage of large performance and security improvements.

Q29. What is Bootstrapping?

Ans: Many PHP packages funnel server requests right into a unmarried (or few) PHP source record that units up the surroundings and configuration for the application, manages sessions and caching, and invokes the dispatcher for their MVC framework. They can do extra, however their essential process is to attend to the consistent wishes of every web page of a web application.

In our Blueprint for PHP Applications, we are able to have a center bootstrapper that gets all dynamic requests for an software and applies a template for software behavior that we are able to later enlarge. It will permit us to later customise the capability for every precise application.

Q30. What is zend engine?

Ans: Zend Engine is used internally via PHP as a complier and runtime engine. PHP Scripts are loaded into memory and compiled into Zend opcodes.

Q31. What is zend engine in PHP?

Ans: Zend engine is sort of a digital gadget and is an open supply, and is known for its position in automating the net the use of PHP. Zend is called after its builders Zeev and Aandi. Its reliability, overall performance and extensibility has a significant role in increasing the PHP’s popularity. The Zend Engine II is the coronary heart of PHP 5. It is an open source project and freely to be had under BSD style license.

Q32. What is routing and how it is paintings?

Ans: Zend_Controller_Router_Rewrite is the standard framework router. Routing is the technique of taking a URI endpoint (that a part of the URI which comes after the bottom URL) and decomposing it into parameters to determine which module, controller, and action of that controller must receive the request. This values of the module, controller, action and different parameters are packaged right into a Zend_Controller_Request_Http object that is then processed with the aid of Zend_Controller_Dispatcher_Standard. Routing happens most effective once: whilst the request is first of all received and before the primary controller is dispatched.

Zend_Controller_Router_Rewrite is designed to permit for mod_rewrite-like capability the usage of natural PHP structures. It could be very loosely based totally on Ruby on Rails routing and does now not require any earlier information of webserver URL rewriting. It is designed to work with a single Apache mod_rewrite rule.

Q33. What are Plugins in zend framework?

 Ans: Triggered by using the front controller events

 Events bookend each fundamental method of the the front controller

 Allow automating movements that follow globally

Creating Plugins:

 Extend Zend_Controller_Plugin_Abstract

 Extend one or extra of the occasion strategies

Q34. Zend_Cache provides a established way to cache any information.

Ans: Caching in Zend Framework is operated with the aid of frontends at the same time as cache data are saved thru backend adapters (File, Sqlite,Memcache...) through a bendy system of IDs and tags. Using the ones, it is straightforward to delete particular kinds of facts afterwards (as an instance: "delete all cache data marked with a given tag").

The center of the module (Zend_Cache_Core) is ordinary, bendy and configurable. Yet, on your specific desires there are cache frontends that expand Zend_Cache_Core for comfort: Output, File, Function and Class.

Q35. Difference among Zend_Registry and Zend_Session?

Ans: The basic distinction among these items is the ‘scope’ wherein they're legitimate:

a) Zend_Registry : request scope

b) Zend_Session : consultation scope

a) Zend_Registry is used to save gadgets/values for the contemporary request. In brief, some thing that you decide to Registry in index.Hypertext Preprocessor can be accessed from different controllers/movements (because EVERY request is first routed to the index.Personal home page bootstrapper through the .Htaccess report). Config parameters and db parameters are typically prepped for worldwide use the usage of the Zend_Registry object.

B) Zend_Session clearly uses PHP sessions. Data saved using Zend_Session can be accessed in extraordinary/all pages. So, if you need to create a variable named ‘UserRole’ within the /auth/login script and want it to be handy in /auth/redirect, you would use Zend_Session.

Q36. When can we want to disable layout?

Ans: At the time of calling AJAX to fetch we want to disable format.

$this->_helper->layout()->disableLayout();

$this->_helper->viewRenderer->setNoRender(actual);

Q37. Where is the model in ZF’s MVC implementation?

Ans: The version thing can vary dramatically in obligations and records shop from one MVC application to the subsequent.

Q38. How to name two one of a kind views from equal motion?

Ans:

Example1:

Public characteristic indexAction() 

If(circumstance)

$this->render(‘yourview.Phtml’);

Else

Index.Phtml;

Example2:

Public feature indexAction() 

Now for your index.Phtml you could have this declaration to call other view

$this->action(‘action name’,’controller name’,’module call’,array(‘parameter name’=>’parameter price’));

Q39. How to consist of css from controller and look at in zend.

Ans: From within a view file: $this->headLink()->appendStylesheet(‘filename.Css’);

From inside a controller: $this->view->headLink()->appendStylesheet(‘filename.Css’);

And then somewhere in your layout you need to echo out your headLink object:

headLink();?>

Q40. How do you defend your website online from square injection in zend while using pick query?

Ans: You must quote the strings,

$this->getAdapter ()->quote ( );

$choose->in which ( ” = “, );

OR (If you are using the query mark after identical to signal)

$choose->wherein ( ” = ? “, );

Q41. What is MVC?

Ans:

 Model-View-Controller development pattern.

 MVC is a software technique that separates utility common sense from presentation.

Q42. Features of MVC in Zend Framework?

Ans:

 Declare custom routing rulesNot confined to “controller/action/param” layout

 Optional Controller Plugins, Action Helpers, and View HelpersErrorHandler plugin handles exceptions, 404 errors, etc.FlashMessenger, Redirector, ViewRenderer helpersOutput not unusual HTML factors in views

Extensible interfaces

Q43. Why can not Zend_Form render my File detail with out errors?

Ans: The file element wishes a unique record decorator, that's brought by means of default. When you put your personal decorators for report elements, you delete the default decorators.

For example:

$element->setDecorators(array(

array('ViewHelper'),

array('Errors')

));

You must use a File decorator as opposed to the ViewHelper for the document detail, like so:

$element->setDecorators(array(

array('File'),

array('Errors')

));

Q44. How can I personalize the appearance of forms generated through Zend_Form?

Ans: You're in all likelihood searching out decorators. All paperwork and form elements in Zend_Form use decorators to render their output.

Q45. Why does the Zend Framework mission have a CLA at all?

Ans: The CLA protects all customers which include people, small and medium groups, and large companies. By having a CLA in place, we mitigate the risk that agencies who claim highbrow property infringement may also demand royalties or fees from customers of Zend Framework, whether or not people or groups. This is particularly essential for corporations basing their commercial enterprise or merchandise on Zend Framework. The Zend Framework CLA enables to make certain that code and different IP in Zend Framework remains unfastened.

Q46. Should I sign an person CLA or a company CLA?

Ans: If you're contributing code as an person- and now not as a part of your activity at a agency- you should signal the person CLA. If you're contributing code as a part of your responsibilities as an employee at a organization, you must post a corporate CLA with the names of all co-people which you foresee contributing to the task.

Q47. Name a few Important issue in zend framework?

Ans: Gives the request & reponse methods by using the usage of its sub-lessons.

$request = new Zend_Controller_Request_Http()

$reaction = new Zend_Controller_Response_Http()

Uses of Zend_Date

Date related processing can be achieved using this component.

Uses of Zend_File_Transfer

it gives extensive assist for report uploads and downloads.

Uses of Zend_Db

It is used to doing database associated cause in our appication.

Uses of Zend_Paginator

Doing the pagination in our utility.

Uses of Zend_Auth

It is used to authenticate a person.

$auth = Zend_Auth::getInstance();

$results = $auth->authenticate($adapter);

if ($consequences->isValid())

 

Zend_Session_Namespace

This is a easy proxy magnificence to use API into the Zend_Session managed $_SESSION Superglobal.

Q48. ZF  factor library and framework?

 

Ans: Zend Framework affords all of the components required for maximum net packages in a unmarried distribution. But Zend Framework components are also loosely coupled, making it easy to use only a few components in a web software- even along different frameworks! Using this use-at-will structure, we're imposing capabilities usually discovered in extra monolithic frameworks. In truth, we are currently operating on a tooling thing for the 1.8 release on the way to make it simpler to construct applications using ZF components, yet will not sacrifice the use-at-will nature of existing ZF components.

 

Q49. What is autoloader in Zend framework?

 

Ans: Auto loader is function that load all the item on begin up.

 

Q50. What is using Bootstrap in zend framework?

 

Ans: Apart from index if we need to do any greater configuration regarding database and other matters this is done within bootstrap.




CFG