Tuesday, 15 July 2014

Zend Framework Interview Questions and Answers

Question: What is a framework?
In software development, a framework is a defined structure in which we can developed a new project. Its better to developed in framework than in core technology Because when we get a easy setup and many inbuilt functionalities.

Question: What are the features of framework?
Feature of Framework An abstract design Set of common functionality inbuilt Fast & Reliable Already tested by 1000 of developers We can check the reviews & rating of framework before use

Question: How to get post/get variables?
$request->getParams(); //All Get Variables
$request->getPost();//all Post variables
$request->getParam('id','0'); //get Id variables

Question: What is Bootstrapping?
Many PHP applications funnel server requests into a single PHP source file (only php files) that sets up the environment and configuration for the application, manages sessions, manage translate and caching, and invokes the dispatcher for their MVC framework. They can do more, but their main job is to take care of the consistent needs of every page of a web application.

Question: What is Zend Engine?
Zend Engine is used internally by PHP as a complier and runtime engine. PHP Scripts are loaded into memory and compiled into Zend opcodes. this opcodes render the html files.

Question: How Zend Routing Works?
Zend_Controller_Router_Rewrite is the standard router for zend framework. Basically Routing is the process of taking a URI endpoint and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request. This values of the module, controller, action and other parameters are packaged into a Zend_Controller_Request_Http object which is then processed by Zend_Controller_Dispatcher_Standard. Routing occurs once, when the request is initially received and before the first controller is dispatched.

Question: What are Plugins in zend framework?
Plugins are triggered by front controller events,bookend each major process of the front controller and allow automating actions that apply globally.
routeStartup – before the current route is evaluated
routeShutdown – after the completion of routing
dispatchLoopStartup – before the dispatch loop is entered
preDispatch – before the current action is dispatched
postDispatch – after the current action is dispatched
dispatchLoopShutdown – after the dispatch loop is completed

Question: How to disable Layout?

Question: How to disable view files?

Question: How to call two different views from same action?

Question: How to include css from controller and view in zend framework.
From View
From Controller

Question: What is FrontController?
It is based on Front Controller Design pattern. Zend also use singleton pattern.
routeStartup: This function is called before Zend_Controller_Front calls on the router to evaluate the request.
routeShutdown: This function is called after the router finishes routing the request.
dispatchLoopStartup: This is called before Zend_Controller_Front enters its dispatch loop.
preDispatch: called before an action is dispatched by the dispatcher.
postDispatch: is called after an action is dispatched by the dispatcher.