Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions C++ Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions F# Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions

Top 16 Yii PHP Framework Interview Questions for 2022

1) What is Yii Framework?

Yii is an open source, web application framework based on MVC. It is written in PHP and used to design PHP applications. This application was started on January and completed in December 2008.

2) Why does Yii Framework run so fast?

Yii Framework run so fast because it uses sluggish loading technique which does’t include class file until the class is initially used.

3) What are the features of Yii Framework?

There are various features of Yii Framework:
  • It uses MVC design pattern
  • Web Service available for Apps like android
  • Internationalization and localization translation for multilingual.
  • It provides Caching for speed up the application
  • It manages Error handling and logging for tracking
  • It provides cross-site scripting (XSS), cross-site request forgery (CSRF) protection
  • It provides PHP unit and Selenium for testing.
  • It provides automatic code generation that helps to fast development etc.

4) How can we define a form model?

We can define a form model in Yii1.1 by using following code:
class MyLoginForm extends CFormModel  

{  

    public $username;  

    public $password;  

    public $rememberMe=false;  

}

5) What are the components available in Yii Framework?

There are following components available in Yii Framework:
  • db: It is used for database connection.
  • AssetManager: It manage the publishing of private assets files
  • authManager: It manages role-based access control
  • cache: It manages caching functionality
  • clientScript: It manages javascript and CSS
  • coreMessages: It provides translated core messages
  • errorHandler: It manages errors handling.
  • ThemeManager: It manages themes
  • urlManager: It provides URL parsing and creation functionality
  • statePersister: It provides mechanism for persisting global state
  • session: It manages session
  • securityManager: It manages Security

6) Which file loaded firstly while run a Yii application?

In Yii Framework, index.php file loaded first to display home page of the application.

7) How can we install or setup Yii Framework in our local system?

We can install or setup Yii Framework by using following given steps:
  • Download the Yii setup from its official website or github.
  • Extract the code into our server root directory.
  • Open command line terminal and type the following command.
  1. php path-to-yii-folder/framework/yiic webapp [webapp-name]
  • After execution of above command, it will ask for the confirmation of creating a new application, on selecting yes, it will create an application.

8) What is the Yii application life cycle?

Yii application life cycle includes the following steps:
  • Pre-initialize the application with Capplication::preinit()
  • Set up the class autoloader and error handling
  • Register core application components
  • Load application configuration
  • Initialize the application with Capplication::init()
  • Register application behaviors
  • Load static application components
  • Raise an onBeginRequest event
  • Process the user request
  • Collect information about the request
  • Create a controller
  • Run the controller
  • Raise an onEndRequest event

9) What are the database related functions in Yii?

In Yii, databse releted functions are:
  • Queryfind
  • findAll
  • findByPk
  • findBy

10) How can we connect to the database in Yii?

In Yii, we can connect database by using following code: We can configure database related settings in the main.php file reside into the config folder.

11) What is a YiiBase in Yii Framework?

In Yii Framework, YiiBase is a helper class that provides functionalities of common framework. We should not use YiiBase directly, if we want to access helper class, we have to use its child class where we can customize the methods of YiiBase.

12) What is "gii" and how it works in Yii Framework?

In Yii Framework, gii is a module that provides Web-based code generation capabilities to the developer. We need to change the main configuration file of our application.
return array(  

    'modules'=>array(  

        'gii'=>array(  

            'class'=>'system.gii.GiiModule',  

            'password'=>[*choose a password*]  

        )  

    )  

)

13) How can we access application components in Yii Project?

We can access an application component by using following code:
Yii::app()->ComponentID
Where, ComponentID refers to the ID of the component.

14) How can we get current controller id in Yii ?

We can get current controller in Yii Framework by using given code:
$controllerid = Yii::app()->controller->id;

15) How can we set default controller in our Yii Project ?

We can set default controller in our Yii Project by using given code:
[       

  'name'=>'Yii Framework',  

  'defaultController'=>'site',  

]

16) What is the difference between "render" and "renderpartial" in Yii Framework?

In Yii Framework, render() is commonly used to render a view that corresponds to what a user sees as a "page" in your application. renderPartial() is used to render a web page without layout.



ADVERTISEMENT
ADVERTISEMENT