Zend Framework Interview Questions

Zend framework is one of the best PHP frameworks. This page contains Zend framework interview questions for both freshers and experienced candidate.



Table of Contents

Define the zend framework and what are the features of Zend?

  • Zend framework is an open-source and follows the MVC pattern.
  • It is used to develop modern web applications.
  • It provides any PHP stack and Zend Server to run Zend framework applications.
  • It also provides clean and stable code complete with intellectual property rights and makes programming easier.
  • It is fast, easy to learn and user-friendly framework.
  • It supports strong cryptography tools and password hashing techniques.

The silent features of Zend framework are given below:

  • Zend provides RESTful API development support.
  • Flexible URI Routing.
  • Session management.
  • Simple cloud API.
  • Supports multi databases including PostgreSQL, SQLite etc.
  • Pure object-oriented web application framework.
  • Advanced MVC implementation.
  • Code reusable and easier to maintain.
  • Data encryption.

Define MVC architecture in Zend?

In Zend,MVC stands for model-view-controller, which can separate the application logic from the presentation.
MVC components is as follows:
Model

  • It represents the structure of the application.
  • Model classes contain methods which help to insert, update and retrieve business data in the database(such as MySQL, PostgreSQL, etc.).

View



  • It is the presentation layer of MVC applications.
  • Using the controller, it receives the model data and displays it.

Controller

  • It is the main component of MVC architecture.
  • It processes all the request and serves as an intermediary between the Model and View.

What is the component Zend framework provides?

Zend framework provides three types of components, which are given below:
1: Event Manager

It provides the ability to create event-based programming.
It also helps to create, inject and manage new events.
2: Service Manager:



It provides the ability to consume any services from anywhere with a little effort.
3: Module manager :

It provides the ability to convert a collection of PHP classes with identical functionality into a single unit.
It can be used to maintained and configured as a single unit.

In zend framework, what is the structure of the application module?

Zend framework provides a powerful and flexible module system to set up the application accurately.
The application module which is myapp, provides error, bootstrapping and routing configuration to all the application.
The structure of the application module is given below:
├── module
│ └── Application
│ ├── config
│ │ └── module.config.php
│ ├── src
│ │ ├── Controller
│ │ │ └── IndexController.php
│ │ └── Module.php
│ ├── test
│ │ └── Controller
│ │ └── IndexControllerTest.php
│ └── view
│ ├── application
│ │ └── index
│ │ └── index.phtml
│ ├── error
│ │ ├── 404.phtml
│ │ └── index.phtml
│ └── layout
│ └── layout.phtml



In Zend Framework, define Autoloader?

In the zend framework, the autoloader is a method which loads all the objects on startup.

For the zend framework, what services are available from Zend Technologies?

Zend Technologies gives a complete set of services for Zend Framework, which including:
1: Consulting
2: Training
3: Support
4: Certification

In Zend Framework, how Do You Set Module Name, Controller Name, And Action Name?

In zend,Module name is set by $request->setModuleName(‘front’);
Controller name is set by $request->setControllerName(‘address’);
Action name is set by $request->setActionName(‘addresslist’);



In Zend framework,Checking Whether Form Posted Or Not?

Ans: In Zend framework, write the below code to check

In Zend framework, how to fetch last Inserted Id, Fetch All Record And Fetch A Single Record?

In Zend framework, using the below code to fetch last Inserted Id, Fetch All Record And Fetch A Single Record

 

In the Zend framework, what is the basic difference between Zend_registry and Zend_session?

The main difference between Zend_registry and Zend_session is the ‘scope’ in that they are valid:
a:  Zend_Registry : request scope
b:  Zend_Session : session scope
Zend_Registry:



  1. It is used to store objects/values for the ongoing request.
  2. In short, everything which you offend to Registry in index.php can be accessed from other controllers/actions.
  3. Using the Zend_Registry object config parameters and DB parameters are normally prepared for global use.

Zend_Session:

  1. It literally uses PHP sessions.
  2. Using Zend_Session data stored, which can be accessed in different/all pages.
  3. 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.

In the zend framework, when do we need to disable Layout?

In zend framework, we need to disable layout at the time of calling AJAX to obtain.

 

In the zend framework, define a filter?

In the zend framework, the Zend_Filter component provides a set of frequently required data filters.
It also provides a smooth filter chaining mechanism by which multiple filters may be applied to a single definition in a user-defined order.

 



Other Filters are given bellow:
Alnum – Zend_Filter_Alnum->It is a filter that returns single alphabetic characters and digits. All other characters are suppressed.
Alpha – Zend_Filter_Alpha->It is a filter that returns the string $value, removing all but alphabetic characters.
This filter has an option to also grant white space characters.

Describe plugins in Zend framework?

1. Front controller events trigger the plugins.
2: Events bookend each major process of front controller.
3: Allowing automating actions which can apply globally in zend framework.
Creating plugins:
a: Extend Zend_Controller_Plugin_Abstract
b: Extend one or more of the event methods.

In zend, how to include css from controller and view?

From within a view file: $this->headLink()->appendStylesheet(‘filename.css’);
From within a controller: $this->view->headLink()->appendStylesheet(‘filename.css’);
And then elsewhere in your layout you need to echo out your headLink object:



Using select query how to protect the site from sql injection in zend framework?

You have to quote the strings,

 

In zend framework, how to customize the appearance of forms generated by zend_form.

Here decorators play a vital role. In zend_form all forms and form elements use decorators to render there output.

Q: In zend framework, how to call two different Views from same Action?

 



Now you can have this statement to call other view in index.phtml file.
$this->action(‘action name’,’controller name’,’module name’,array(‘parameter name’=>’parameter value’));

In zend framework,which version of Php does it require?

PHP 5.2.4 and up version is required for Zend Framework. Few Zend Framework components may work with earlier versions of PHP, but these components are tested and supported only on 5.2.4 and up.

In zend framework how do U define the Library Path?

In zend framework, we have to create directory ‘library’ and place ‘Zend’ directory in it.
The directory structure will look like this
wwwroot
application
lib
Zend
public
index.php



In index.php file you should add the library:

 

In zend framework, how to include Js from Controller and View in Zend?

From within a view file:

$this->headScript()->appendFile(‘filename.js’);
From within a controller: $this->view->headScript()->appendFile(‘filename.js’);
And then elsewhere in your layout, you need to echo out your headScript object:
headScript();



Explain zend engine in PHP?

  • 1: Zend engine is an open source and is like a virtual machine.
  • 2: It is known for automating the web using php.
  • 3: For increasing the php’s popularity,zends reliability performance and extensibility play a vital role.
  • 4: Zend engine is freely available under BSD style license.
  • 5: Zend gets his name after its developers Zeev and Aandi.

In zend framework, how can you get a module name in Bootstrap File?

In zend framework, to get a module name through the following code:

Define routing in zend framework and how it works?

In zend framework, routing is the process of taking a URI endpoint and break down it into parameters to complete that module, controller, and action of which controller should receive the request.
Zend_Controller_Router_Rewrite is the standard framework router.
When the request is fast received and before the first controller is addressed.
Using pure PHP structures Zend_Controller_Router_Rewrite is creating to allow for mod_rewrite-like functionality.
It is also designed to work with a single Apache mod_rewrite rule.

24.Q:In zend framework,how to check post method?

 



In zend framework, how to get all post and get data?

In zend framework, to get the post and get data using the below code:

 

Q: In Zend Framework, how to use update statement?

 

In Zend Framework, how we can do multiple column ordering?

 



What is the full form of CLA in Zend Framework?

In zend framework, CLA stands for Contributor License Agreement.

Which Class extend the Zend Controller in Zend framework?

In zend framework, Zend class extends Zend_Controller_Action class.

 

How to get variable’s value from get?

 



Advertisements