CodeIgniter interview questions and answers for Fresher + experienced

CodeIgniter interview questions and answers for Fresher + experienced
If your are a core PHP developer and want’s to move on any PHP framework then CodeIgniter is best suit for you, Because it is quit simple for getting into MVC architecture, And help you to understand MVC pattern. So this post for those guys who just started learning CodeIgniter and looking to switch their job from core PHP developer to CodeIgniter Developer, This post not only help to fresher but experienced CodeIgniter Developer also get benefit during interview, Following are the some common CodeIgniter interview questions asked by interviewer during Interview, Which help you to crack Technical round of interview.
codeigniter-interview-question-answer

Question: What is CodeIgniter?

CodeIgniter is open source, web application framework for building websites using php which is loosely based on MVC pattern and which is most simple framework and easily learn. It is mostly known for it’s speed as compare to other frameworks in php.


Question: In Which language CodeIgniter is written?

In PHP

Question: Explain routing in CodeIgniter?

In CodeIgniter, the way PHP files served is different rather than accessing it directly from the browser. This process is called routing. Routing in CodeIgniter gives you freedom to customize the default URL pattern to use our own URL pattern according to the requirement.
So, whenever there is a request made and matches our URL pattern, it will automatically direct to the specified controller and function.

Question: What are the features of codeigniter?

* It is free to use as for open source framework.
* CodeIgniter is Fast. It is faster than any other framework in php.
* It is extremely light weighted.
* Excellent documentation
* CodeIgniter Uses MVC (Model View Controller) which allows great separation between logic and presentation.

Question: How to access config variable in codeigniter?

$this->config->item('variableName');



Question: Explain how you can enable CSRF (Cross Site Request Forgery) in CodeIgniter?

Go To: application/config/config.php and set

$config['csrf_protection'] = TRUE;

Question: What is Model in CodeIgniter?

Model’s responsibility is to handle all data logic and representation and load data in the views. It is stored in application/models folder.

Question: How to load a model in CodeIgniter?

$this->load->model('ModelName');

Question: How to unset session in Codeigniter?

$this->session->unsetuserdata('SessionVariableName');



Question: How do you get last inserted ID in Codeigniter?

$this->db->insert_id();

Question: Explain what is inhibitor in CodeIgniter?

For CodeIgniter, inhibitor is an error handler class, using the native PHP functions like set_exception_handler, set_error_handler, register_shutdown_function to handle parse errors, exceptions, and fatal errors.

Question: How to print SQL statement in codeigniter model?

 $this->db->last_query();

Question: How to load helpers in CodeIgniter?

 $this->load->helper('helperName');

Question: What are the different types of hook in Codeigniter?

* post_controller_constructor
* pre_controller
* pre_sytem
* post_sytem
* cache_override
* display_override
* post_controller

Question: How can you connect models to a database manually?

 $this->load->database();

Question: How you will use or add CodeIgniter libraries?

 $this->load->library('LibName');