1.  Base URL can be changed from which configuration file:

(a) database file            

(b) config file                  

(c) routes file                  

(d) autoload file

Ans: B) config file


2. default controller can be set from which configuration file:

(a) database file           

(b) config file                 

(c) routes file                 

(d) autoload file

Ans: C) routes file


3. Which configuration file is used to autoload resources?

(a) database file            

(b) config file                 

(c) routes file                 

(d) autoload file

Ans: D) autoload file


4. Which one is the business logic in codeigniter?

(a) model                  

(b) view                                

(c) controller            

(d) helper

Ans: C) controller


5. Which of the following in MVC can connect to database?

(a) model                  

(b) view                                

(c) controller            

(d) helper

Ans: A) model And C) controller


6.  In CI, the closing tag of PHP is optional.

(a) true                                  

(b) false

Ans: A) True


7. Which are false?

(a) All codeigniter class name should start with uppercase and rest of the name should be in lowercase.

(b) You can remap function calls by using a function in your controller called _remap()

(c) view file cannot call other view files

(d) You can pass data to a view file by using the third parameter of the load->view function.

Ans: C) And D) Are False Statements


8. Which variable name is incorrect?

(a) $Text                    

(b) $f              

(c) $user id                

(d) $text                      

(e) $some-test-here

Ans: A,B,C,E


9. The keywords true, false, null should always be in lowercase letter in codeigniter.

(a) true                      

(b) fasle

Ans: B) false


10. What kind of link is this:

(a) URI            

(b) QueryString                    

(c) ftp link

Ans: A) URI


11. The above URl is built on segments.            

(a) true                      

(b) false

Ans: A) true


12. Which one will be treated as parameter in that URI?

(a) index.php            

(b) somethingvone

(c) somethingvtwo

(d) somethingvthree

Ans: D) somethingvthree


13. Which one will be treated as method in that URI?

(a) index.php            

(b) somethingvone

(c) somethingvtwo

(d) somethingvthree

Ans: C) somethingvtwo


14. Which one will be treated as controller in that URI?

(a) index.php            

(b) somethingvone

(c) somethingvtwo

(d) somethingvthree

Ans: B) somethingvone


15. Which one will control all the segments?

(a) index.php            

(b) somethingvone

(c) somethingvtwo

(d) somethingvthree

Ans: A) index.php


16. Which are true:

(a) helper can only be loaded in controller and model. View cannot load helper

(b) we cannot load multiple helper  by passing an array of values to the first parameter.

(c) Plugins are stored within system/application/plugins/ folder.

(d) all codeigniter core libraries have the prefix CI_

Ans: C) Plugins are stored within system/application/plugins/ folder.


17. Libraries are created so that they can be reused whenever needed.

(a) true                      

(b) false

Ans: A) True


18. Benchmark can be added to model, view and controllers

(a) true                      

(b) false

Ans: A) true


19.   You can display the amount of memory used by the system by calling:

(a) $this->benchmark->memory_use()

(b) $this->memory_use()

(c)  $this->benchmark->memory_usage()

(d)  $this->memory_usage()

Ans: C) $this->benchmark->memory_usage()


20. Which one is not true

(a) we can set automatic filtering on by setting $config[‘global_xss_filtering’] to TRUE

(b) We can check image for safety in optional second parameter to the xss clean function

(c) The email class also serves as a wrapper class in CI

(d) email can only be sent from controller

Ans: D) email can only be sent from controller


21. Which function is use to set the value of form input box ?

(a)    setvalue()

(b)    set()

(c)    set_value()

(d)    Non of above

Ans: C)  set_value()


22. How many parameters are set_rules function ?

(a)    4

(b)    3

(c)    2

(d)    5

Ans: B) 3


23.Which is  extremely useful and even though also optional ?

(a)    Model

(b)    View

(c)    Controller

(d)    Non of above

Ans: A) Model


24. Which refers to the system of numbering pages-a list of numbered links ?

(a)    Rotating

(b)    Pagination

(c)    Cropping

(d)    All of above

Ans: B) Pagination


25. What correct line of coded loading a view ?

(a)    $this->load->view(‘view_name’)

(b)    $this->view(‘view_name’)

(c)    $this->load(‘view_name’)

(d)    $this->load->view_name(‘view’)

Ans: A) $this->load->view(‘view_name’)


26. What work in almost exactly the same way as Helpers ?

(a)    Helper

(b)    Plugin

(c)    Library

(d)    All of above

Ans: B) Plugin


27.Which class is used to calculate the time between two points in your application ?

(a)    Profiling class

(b)    Security class

(c)    Benchmarking class

(d)    Non of above

Ans: C) Benchmarking class


28.Which key word is used callback function ?

(a)    _callback

(b)    callback_

(c)    _callback_

(d)    Non of above

Ans: B) callback_


29. Which of the following is/are fasle:

(a) The third parameter in load->view function used for output buffering

(b) The default batch size for bcc is 500

(c) we can store data in session by calling set_userdata() method

(d) to validate form we use the form library in CI.

Ans: B)  And D) are false


30. CI session contains the following:

(a) Session_ID

(b) users IP address

(c) user manager

(d) first activity timestamp

Ans: A,B,C


31. _______ is an Application Development Framework - a toolkit - for people who build web sites using PHP.

(a)      Joomla

(b)      Zend

(c)      CodeIgniter

(d)      Wordpress

Ans:  C) CodeIgniter


32.   Which statement is true about the View?

(a)      A View is simply a class file that is named in a way that can be associated with a URI

(b)     A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc

(C)      A view is simply a PHP Code, add a different type of function

Ans: B) A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc


33.  Which statement is true about the Controller?

(a)     A Controller is simply a class file that is named in a way that can be associated with a URI

(b)     A Controller is simply a web page, or a page fragment, like a header, footer, sidebar, etc

(c)    Models are PHP classes that are designed to work with information in your database

Ans: A) A Controller is simply a class file that is named in a way that can be associated with a URI


34.    Which statement is true about the Modules?

(a)      A Models is simply a class file that is named in a way that can be associated with a URI

(b)      A Models is simply a web page, or a page fragment, like a header, footer, sidebar, etc

(c)      Models are PHP classes that are designed to work with information in your database

Ans:   C) Models are PHP classes that are designed to work with information in your database


35.  Helper file is simply a collection of functions in a particular category.

(a)    True

(b)    Flase

Ans:  A) True


36. How to load a helper file using the following function?

(a) $load->helper('name');

(b) $Loding->load->helper('name');

(c) $this->load->helper('name');

Ans: C) $this->load->helper('name');


37. Which of the following line of code use to a send email?

(a) library('email');

    Mail details code here

    $this->email->send();

(b) $this->load->library('email');

    Mail details code here

    $this->email->send();

(c) $this->load->email;    

    Mail details code here….

    $this->email->send();

Ans: B) $this->load->library('email');

             Mail details code here

             $this->email->send();


38. Which of the following code loads and initializes the database class based on your configuration settings?

(a) $this->load->DataFile();

(b) $this->load->DatabaseName();

(c) $this-> database();

(d) $this->load->database();

Ans: D) $this->load->database();


39. Which of the following code is example of query?

(a) $this->db-> ('SELECT name, title, email FROM my_table');

(b) $this->db->query('SELECT name, title, email FROM my_table');

(c) $query = $this->db->query('SELECT name, title, email FROM my_table');

Ans: C) $query = $this->db->query('SELECT name, title, email FROM my_table');


40. Which class allows information to be retrieved, inserted, and updated in your database with minimal scripting?

(a) Active Record Class

(b) Helper class

(c) Database Class

(d) URI class

Ans: A) Active Record Class


41. _________ Runs the selection query and returns the result. Can be used by itself to retrieve all records from a table.

(a) $this->db->getAll()

(b) $this->db->get()

(c) $this->db->getQuery()

Ans: B) $this->db->get()


42. How to get the average age from a Employee table?

(a) $this->db->select_avg('age');

(b) $this->db->avg('age');

(c) $this-> select_avg('age');

Ans: A) $this->db->select_avg('age');


43. Base URL can be changed from which configuration file:

(a) database 

(b) config 

(c) routes 

(d) autoload

Ans: B) config 


44. default controller can be set from which configuration file:

(a) database 

(b) config 

(c) routes 

(d) autoload

Ans: C) routes 


45. Which one is the business logic in codeigniter?

(a) model 

(b) view 

(c) controller 

 (d) helper

Ans: A) model 


46. Which of the following in MVC can connect to database?

(a) model 

(b) view 

(c) controller 

(d) helper

Ans: A) model 


47. In CI, the closing tag of PHP is optional.

A true 

(b) false

Ans: A) true


48. Which function is use to set the value of form input box ?

(a) setvalue() 

(b) set()

(c) set_value() 

(d) Non of above

Ans: C) set_value() 


49. What correct line of coded loading a view ?

(a) $this->load->view(‘view_name’)

(b) $this->view(‘view_name’)

(c) $this->load(‘view_name’)

(d) $this->load->view_name(‘view’)

Ans: A) $this->load->view(‘view_name’)


50.Which variable name is incorrect?

(a) $Text

(b) $f 

(c) $user id 

(d) $A-myVariable

Ans: A)  D) And C) are incorrect


51. How to initialized upload class in our controller?

(a) $this->load->helper('upload');

(b) $this->load->Uploading('upload');

(c) $this->load->'upload';

(d) $this->load->library('upload');

Ans: D) $this->load->library('upload');


52. Which function gives you to view file friendly syntax to get browser cookies?

(a) get_cookie()

(b) list_cookie()

(c) dis_cookie()

(d) set_cookie()

Ans: A) get_cookie()


53. How to creates an opening form tag with a base URL built from your config preferences?

(a) echo form_fopen('email/send');

(b) echo form('email/send');

(c) echo form_open('email/send');

(d) echo open('email/send');

Ans: C) echo form_open('email/send');


54. Which rules returns FALSE if the form element is empty?

(a) required

(b) compulsory

(c) Empty

Ans: A) required


55. Which rules returns FALSE if the form element contains anything other than alpha-numeric characters.?

(a) alpha

(b) numeric

(c) alpha_numeric

Ans: C) alpha_numeric


56. Which rules returns FALSE if the form element does not contain a valid email address.?

(a) email

(b) valid_email

(c) alpha_numeric

Ans: B) valid_email


57. How to update data using Active Record Pattern?

(a) $this->db->updated('mytable', $object);

(b) $this->db->ActiveRecord('mytable', $object);

(c) $this->db->update('mytable', $object);

(d) $this->db->updateData('mytable', $object);

Ans: C) $this->db->update('mytable', $object);


58. CodeIgniter is fairly restrictive regarding which characters it allows in your URI strings in order to help minimize the possibility that malicious data can be passed to your application.

(a) Alpha-numeric text

(b) Tilde: ~

(c) Period: .

(d) Hypen -

Ans: A,B,C


59. The _________ class permits you maintain a user's "state" and track their activity while they browse your site.

(a) loader

(b) Session

(c) Cookie

(d) Header

Ans: B) Session


60. How to initializing the Session?

(a) $this->load->session();

(b) $this->library('session');

(c) $this->load->Session['session'];

(d) $this->load->library('session');

Ans: D) $this->load->library('session');

Top 60 CodeIgniter Interview Questions and Answers | MadeCodingEasy