CodeIgniter Interview Questions & Answers

3 avg. rating (60% score) - 2 votes

CodeIgniter Interview Questions & Answers

Are you in search of CodeIgniter Jobs? Then you are at the right place. We provide you with the complete CodeIgniter interview Question and Answers on our page. CodeIgniter is an open-source software rapid development web framework, for use in building dynamic web sites with PHP. CodeIgniter is loosely based on the popular model–view–controller (MVC) development pattern. There are numerous leading companies that offer various job positions in CodeIgniter like PHP Developer with CodeIgniter Frame work, Senior PHP Developer, Backend Developer CodeIgniter and many more. To clear any interview, you must prepare well for interview, so we provide a complete and tricky Interview questions on our page. To know more about interview question and answers and for various positions in Coded Ui visit our website Wisdomjobs.com.

CodeIgniter Interview Questions

CodeIgniter Interview Questions
    1. Question 1. What Is Codeigniter?

      Answer :

      Codeigniter is an open source framework for web application on PHP. It is loosely based on MVC pattern and it is similar to CakePHP.

    2. Question 2. What Are The Most Prominent Features Of Codeigniter?

      Answer :

      A list of most prominent features of CodeIgniter:

      • It is an open source framework and free to use.
      • It is extremely light weighted.
      • It is based on Model View Controller (MVC) pattern.
      • It has full featured database classes and support for several platforms.
      • It is extensible. You can easily extend system by using your own libraries, helpers etc.
      • Excellent documentation.

    3. Question 3. Explain Codeigniter Architecture?

      Answer :

      From technical point of view, CodeIgniter is dynamically instantiation (light-weighted), loosely coupled (components rely very less on each other) and has component singularity (each class and functions are narrowly focused towards their purpose).

    4. Question 4. How Can You Add Or Load A Model In Codeigniter?

      Answer :

      To load models in controller functions, use the following function:

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

    5. Question 5. How Can You Connect Models To A Database Manually?

      Answer :

      To connect database manually use following syntax,

      $this->load->database(); 

    6. Question 6. Explain Views In Codeigniter?

      Answer :

      View folder contains all the markup files like header, footer, sidebar, etc. They can be reused by embedding them anywhere in controller file. They can't called directly, they have to be loaded in the controller's file.

    7. Question 7. How Can You Load A View In Codeigniter?

      Answer :

      View can't be accessed directly. It is always loaded in the controller file.

      Following function is used to load a view page:

      $this->load->view('page_name');  

    8. Question 8. Explain Controller In Codeigniter?

      Answer :

      A controller is the intermediary between models and views to process HTTP request and generates a web page. It is the center of every request on your web application.

    9. Question 9. What Is Basic Codeigniter Url Structure?

      Answer :

      Instead of using 'query-string' approach, it uses a segment based approach.

      Its structure is as follows,

      abc.com/class/function/ID  

      class represents controller class that needs to be invoked.

      function is the method that is called.

      ID is any additional segment that is passed to controllers.

    10. Question 10. What Is The Default Method Name In Codeigniter?

      Answer :

      By default controller always calls index method. If you want to call a different method, then write it in the controller?s file and specify its name while calling the function.

    11. Question 11. Explain Remapping Method Calls In Codeigniter?

      Answer :

      Second segment of URI determines which method is being called. If you want to override it, you can use _remap() method. The _remap method always get called even if URI is different. It overrides the URI

    12. Question 12. What Is Helper In Codeigniter? How Can You Load A Helper File?

      Answer :

      Helpers are the group of functions in a particular category that assist you to perform specific functions.

      In CodeIgniter, there are many helpers like:

      URL Helpers: helping in creating links.

      Text Helpers: perform various text formatting routines.

      Cookies Helpers: set and read cookies.

      To load helper file, use the following command:

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

    13. Question 13. Explain Codeigniter Library. How Will You Load It?

      Answer :

      CodeIgniter provides a rich set of libraries. It is an essential part of CodeIgniter as it increases the developing speed of an application. It is located in the system/library.

      It can be loaded as follows,

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

    14. Question 14. How Can You Create A Library In Codeigniter?

      Answer :

      There are three methods to create a library:

      • Creating an entire new library
      • Extending native libraries
      • Replacing native libraries

    15. Question 15. What Is Stable Version Of Codeigniter?

      Answer :

      Version: 3.0.5,
      Date January 13, 2016

    16. Question 16. In Which Language Codeigniter Is Written?

      Answer :

      PHP

    17. Question 17. What Are The Features Of Codeigniter? Open Source Framework?

      Answer :

      1. Light Weight
      2. CodeIgniter is Extensible
      3. Full Featured database classes

    18. Question 18. How To Access Config Variable In Codeigniter?

      Answer :

      $this->config->item(‘variable name’);

    19. Question 19. How To Unset Session In Codeigniter?

      Answer :

      $this->session->unsetuserdata(‘somename’);;

    20. Question 20. Explain Codeigniter File Structure?

      Answer :

      following are the folder structure :-

      application:

      • cache
      • Config
      • Controllers
      • core
      • errors
      • helpers
      • hooks
      • language
      • libraries
      • logs
      • models
      • thirdparty
      • views

      system:

      • core
      • database
      • fonts
      • helpers
      • language
      • libraries

    21. Question 21. Explain Application Flow Chart In Codeigniter?

      Answer :

      The following graphic illustrates how data flows throughout the system:

      CodeIgniter application flow:

      1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
      2. The Router examines the HTTP request to determine what should be done with it.
      3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
      4. Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
      5. The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request.
      6. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.

    22. Question 22. Explain Mvc In Codeigniter?

      Answer :

      CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.

      The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.

      The View is the information that is being presented to a user.

      A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of “page”.

      The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.

    23. Question 23. Can You Extend Native Libraries In Codeigniter?

      Answer :

      Yes, we can add some extended functionality to a native library by adding one or two methods.

    24. Question 24. How Can You Extend Class In Codeigniter?

      Answer :

      You have to build a file name application/core/MY_Input.php and declare your class with Class MY_Input extends CI_Input {}to extend the native input class in CodeIgniter.

    25. Question 25. How You Will Work With Error Handling In Codeigniter?

      Answer :

      CodeIgniter lets you build error reporting into your applications using the functions described below. In addition, it has an error logging class that permits error and debugging messages to be saved as text files.

      show_error(‘message’ [, int $statuscode= 500 ] )

      This function will display the error message supplied to it using template application/errors/errorgeneral.php.

      show_404(‘page’ [, ‘logerror’])

      This function will display the 404 error message supplied to it using template application/errors/error404.php.

      log_message(‘level’, ‘message’)

      This function lets you write messages to your log files. You must supply one of three “levels” in the first parameter, indicating what type of message it is (debug, error, info), with the message itself in the second parameter.

    26. Question 26. How Do You Use Aliases With Autoloading Models In Codeigniter?

      Answer :

      We can auto load model like this:

      $autoload[‘model’] = array(array(‘usersmodel’, ‘users’), array(‘newsmodel’, ‘news’), ‘categorymodel’);

    27. Question 27. How To Get Random Records In Mysql Using Codeigniter?

      Answer :

      We can use this:

      $this->db->order_by(‘id’,’RANDOM’);

    28. Question 28. What Are The Security Parameter For Xss In Codeigniter?

      Answer :

      Codeigniter has got a cross-site scripting hack prevention filter. This filter either runs automatically or you can run it as per item basis, to filter all POST and COOKIE data that come across. The XSS filter will target the commonly used methods to trigger JavaScript or other types of code that attempt to hijack cookies or other malicious activity. If it detects any suspicious thing or anything disallowed is encountered, it will convert the data to character entities.

    29. Question 29. Who Developed Codeigniter?

      Answer :

      Codeigniter was developed by ellislab Inc.

    30. Question 30. Why Codeigniter Is Called As Loosely Based Mvc Framework?

      Answer :

      Reason behind this is we does not need to follow strict mvc pattern while creating application.We can also able to build with model only view and controllers are enough to built a application.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

CodeIgniter Tutorial