Here are MCQ CodeIgniter interview questions and answers for freshers as well as experienced candidates to get their dream job.
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
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
Which configuration file is used to autoload resources?
(a) database file
(b) config file
(c) routes file
(d) autoload file
Ans: D) autoload file
Which one is the business logic in codeigniter?
(a) model
(b) view
(c) controller
(d) helper
Ans: C) controller
Which of the following in MVC can connect to database?
(a) model
(b) view
(c) controller
(d) helper
Ans: A) model And C) controller
In CI, the closing tag of PHP is optional.
(a) true
(b) false
Ans: A) True
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
Which variable name is incorrect?
(a) $Text
(b) $f
(c) $user id
(d) $text
(e) $some-test-here
Ans: A,B,C,E
The keywords true, false, null should always be in lowercase letter in codeigniter.
(a) true
(b) fasle
Ans: B) false
What kind of link is this:
(a) URI
(b) QueryString
(c) ftp link
Ans: A) URI
The above URl is built on segments.
(a) true
(b) false
Ans: A) true
Which one will be treated as parameter in that URI?
(a) index.php
(b) somethingvone
(c) somethingvtwo
(d) somethingvthree
Ans: D) somethingvthree
Which one will be treated as method in that URI?
(a) index.php
(b) somethingvone
(c) somethingvtwo
(d) somethingvthree
Ans: C) somethingvtwo
Which one will be treated as controller in that URI?
(a) index.php
(b) somethingvone
(c) somethingvtwo
(d) somethingvthree
Ans: B) somethingvone
Which one will control all the segments?
(a) index.php
(b) somethingvone
(c) somethingvtwo
(d) somethingvthree
Ans: A) index.php
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.
Libraries are created so that they can be reused whenever needed.
(a) true
(b) false
Ans: A) True
Benchmark can be added to model, view and controllers
(a) true
(b) false
Ans: A) true
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()
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
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()
How many parameters are set_rules function ?
(a) 4
(b) 3
(c) 2
(d) 5
Ans: B) 3
Top 60 CodeIgniter Interview Questions and Answers
Which is extremely useful and even though also optional ?
(a) Model
(b) View
(c) Controller
(d) Non of above
Ans: A) Model
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
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’)
What work in almost exactly the same way as Helpers ?
(a) Helper
(b) Plugin
(c) Library
(d) All of above
Ans: B) Plugin
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
Which key word is used callback function in codeigniter?
(a) _callback
(b) callback_
(c) _callback_
(d) Non of above
Ans: B) callback_
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
CI session contains the following:
(a) Session_ID
(b) users IP address
(c) user manager
(d) first activity timestamp
Ans: A,B,C
_______ 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
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
Which statement is true about the Controller in codeigniter?
(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
Which statement is true about the Modules in codeigniter?
(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
Helper file is simply a collection of functions in a particular category.
(a) True
(b) Flase
Ans: A) True
How to load a helper file using the following function in codeigniter?
(a) $load->helper(‘name’);
(b) $Loding->load->helper(‘name’);
(c) $this->load->helper(‘name’);
Ans: C) $this->load->helper(‘name’);
Which of the following line of code use to a send email in codeigniter?
(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();
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();
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’);
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
_________ 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()
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’);
Base URL can be changed from which configuration file in codeigniter:
(a) database
(b) config
(c) routes
(d) autoload
Ans: B) config
Default controller can be set from which configuration file in codeigniter:
(a) database
(b) config
(c) routes
(d) autoload
Ans: C) routes
Which one is the business logic in codeigniter?
(a) model
(b) view
(c) controller
(d) helper
Ans: A) model
Which of the following in MVC can connect to database?
(a) model
(b) view
(c) controller
(d) helper
Ans: A) model
In CI, the closing tag of PHP is optional.
A true
(b) false
Ans: A) true
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()
What correct line of coded loading a view in codeigniter?
(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’)
Which variable name is incorrect?
(a) $Text
(b) $f
(c) $user id
(d) $A-myVariable
Ans: A) D) And C) are incorrect
How to initialized upload class in our controller in codeigniter?
(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’);
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()
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’);
Which rules returns FALSE if the form element is empty?
(a) required
(b) compulsory
(c) Empty
Ans: A) required
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
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
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);
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
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
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’);


Welcome to HindiTutorials, your go-to platform for learning and mastering concepts in Hindi! Our mission is to make education accessible and simple for everyone by providing high-quality tutorials on programming, technology, and various other topics.