Introduction
This article will discuss the most common Codeigniter interview questions to help you prepare. These questions are among the most asked Codeigniter interview questions.
Codeigniter is a framework used for developing web development on PHP. So, most Codeigniter interview questions are about working, functions, features, database handling, and routing in Codeigniter.
Let's continue with some of the top Codeigniter interview questions.
CodeIgniter Interview Questions for Freshers
1.What is Codeigniter?
Codeigniter is a powerful Model-View-Controller(MVC) based framework on PHP used to develop web applications. It is an open-source framework, so it doesn't require licenses or permissions. It provides an easy toolkit for the developers, making it more beginner-friendly than other PHP frameworks.
2. What are the salient features of Codeigniter?
Following are the salient features of Codeigniter:
- Codeigniter is an open-source framework and free to use.
- Framework with a small footprint. It makes the development, deployment, and update easier.
- Based on MVC(Model-View-Controller).
- Clear and short documentation.
- Strong Security
- Build super-fast web applications.
- Extendable. Several libraries and helpers can be added.
3. What are Hooks in Codeigniter? List some of them.
Hooks in Codeigniter is a feature to change or alter the inner functionalities and working of the framework without compromising the core files. The hooks are defined in the application/config/hooks.php file.
Some of the hooks in Codeigniter are:
- pre_system
- pre_controller
- post_system
- post_controller
- cache_override
- display_override
4. What is routing in Codeigniter?
Routing is a technique provided by Codeigniter by which you can define your URLs according to your requirements instead of using the default URLs. So, when a URL is typed by the user that matches the URL you defined, it automatically directs to the controller or associated classes.
There are specific rules and protocols to be followed while defining the URLs; they are defined inside the application/config/routes.php file.
5. What command is used to connect models to the database manually?
The following command is used to connect models to the database in Codeigniter manually:
$this->load->database();
6. What are the components of the default URL pattern in Codeigniter?
The default URL pattern in Codeigniter has four components to be defined in their specific order.
An example of a default URL in Codeigniter is:
http://ServerName/ControllerClassName/ControllerFunctionName/parameters.
The four components of the default URL pattern are:
- ServerName
- ControllerClassName
- ControllerFunctionName
- FuntionParameters
7. What is an inhibitor in Codeigniter?
An inhibitor is a Codeigniter specialist class that primarily serves to handle errors. It is mainly composed of functions like set_error_handler, set_exception_handler, and register_shutdown_function, which are helpful in handling parsing errors, exceptions, and fatal errors.
8. What are helpers? And what are their types in Codeigniter?
In Codeigniter, a helper is a group of functions that execute a specific task. These functions can be loaded to your application to aid you in performing a specific task without actually writing the code yourself in the program.
There are following three types of helpers in Codeigniter:
- URL Helpers
- Text Helpers
- Cookies Helpers
9. Differentiate between a helper and a library in Codeigniter?
A library is a class that holds various functions that perform tasks in a specific domain. It is necessary to create an instance of the class to use the various functionalities of the library. It is written in the object-oriented programming paradigm.
A helper is a group of functions that perform specific tasks. All helper functions are independent of each other. They don't need to be written in the OOP paradigm. They can be invoked just like any other PHP function.
10. List some advantages of Codeigniter.
- Greate for handling errors and bug fixes.
- It provides customizability.
- Easy to use
- User-friendly interface
- Community support
- Fast Development
- Better search engine optimization
- Security
- Built-in libraries
11. What are some databases supported by Codeigniter Framework?
Codeigniter Framework supports MySQL (5.1+), CUBRID, ODBC, Oracle, PostgreSQL, and Interbase/Firebird.