Home »
MCQs
CodeIgniter Multiple-Choice Questions (MCQs)
CodeIgniter is an open-source software rapid development web framework. CodeIgniter is used to build dynamic web pages with PHP.
CodeIgniter MCQs: This section contains multiple-choice questions and answers on the various topics of CodeIgniter. Practice these MCQs to test and enhance your skills on CodeIgniter.
List of CodeIgniter MCQs
1. CodeIgniter is a ____.
- Enterprise architecture framework
- Database Framework
- Testing framework
- Application development framework
Answer: D) Application development framework
Explanation:
CodeIgniter is an application development framework.
Discuss this Question
2. CodeIgniter uses which programming language?
- PHP
- JavaScript
- Java
- Python
Answer: A) PHP
Explanation:
CodeIgniter is a tool kit that uses PHP language.
Discuss this Question
3. CodeIgniter is licensed under which of the following?
- Apache
- MIT
- Microsoft
- Google
Answer: B) MIT
Explanation:
CodeIgniter is licensed under the MIT license.
Discuss this Question
4. CodeIgniter uses which of the following approach?
- MVC
- Master-slave
- Client-server
- Layered
Answer: A) MVC
Explanation:
CodeIgniter uses the Model-View-Controller approach.
Discuss this Question
5. Your data structures are represented by the ____.
- View
- Controller
- Model
Answer: C) Model
Explanation:
Your data structures are represented by the Model.
Discuss this Question
6. The ____ acts as a bridge between the Model and the View.
- Processor
- Controller
- Director
- Repository
Answer: B) Controller
Explanation:
The Controller acts as a bridge between the Model and the View.
Discuss this Question
7. The View is the information that is displayed to the user.
- View
- Controller
- Model
Answer: A) View
Explanation:
The View is the information that is displayed to the user.
Discuss this Question
8. The class name must start with ____ letter.
- Lowercase
- Uppercase
- Any case
Answer: B) Uppercase
Explanation:
The class name must start with an uppercase letter.
Discuss this Question
9. Views can be called directly?
- True
- False
Answer: B) False
Explanation:
Views might be basic or complicated web pages that can be called by the controller. The webpage may have a header, footer, sidebar, and so on. The view cannot be called directly.
Discuss this Question
10. Which kind of relationship is there between a URL string and its corresponding controller class/method?
- Many-to-one
- One-to-many
- Many-to-many
- One-to-one
Answer: D) One-to-one
Explanation:
A URL string and its related controller class/method usually have a one-to-one relationship.
Discuss this Question
11. How many reserved routes are there in CodeIgniter?
- 4
- 3
- 5
- 7
Answer: B) 3
Explanation:
With CodeIgniter, there are three reserved routes:
- $route['default_controller']
- $route['404_override']
- $route['translate_uri_dashes']
Discuss this Question
12. If the URI includes no data, ____ route indicates which controller class should be loaded.
- $route['default_controller']
- $route['404_override']
- $route['translate_uri_dashes']
Answer: A) $route['default_controller']
Explanation:
If the URI includes no data, $route['default_controller'] route indicates which controller class should be loaded.
Discuss this Question
13. If the specified controller cannot be found, ____ route specifies which controller class should be loaded.
- $route['default_controller']
- $route['404_override']
- $route['translate_uri_dashes']
Answer: B) $route['404_override']
Explanation:
If the specified controller cannot be found, $route['404_override'] route specifies which controller class should be loaded.
Discuss this Question
14. Which of the following can be used to customize routes?
- Wildcards
- Regular expressions
- Both
- None
Answer: C) Both
Explanation:
Wildcards and regular expressions can be used to customize routes.
Discuss this Question
15. CodeIgniter reads its routing rules from ____?
- Top-to-Bottom
- Bottom-to-top
- Both
- None
Answer: A) Top-to-Bottom
Explanation:
CodeIgniter reads its routing rules from top to bottom.
Discuss this Question
16. In the URL given below what does the first segment indicates?
includehelp.com/class/function/id/
- The first section denotes the controller class to be called.
- The first section denotes the class function or method to be invoked.
- The first section represents the ID as well as any variables supplied to the controller.
Answer: A) The first section denotes the controller class to be called.
Explanation:
The first section of the URL denotes the controller class to be called.
Discuss this Question
17. In the URL given below what does the second segment indicates?
includehelp.com/class/function/id/
- The second section denotes the controller class to be called.
- The second section denotes the class function or method to be invoked.
- The second section represents the ID as well as any variables supplied to the controller.
Answer: B) The second section denotes the class function or method to be invoked.
Explanation:
The second section denotes the class function or method to be invoked.
Discuss this Question
18. In how many ways you can connect to the database?
- 5
- 4
- 2
- 3
Answer: C) 2
Explanation:
We can connect to the database in the following two ways –
- Automatic connecting
- Manual connecting
Discuss this Question
19. Which of the following method is used to put a record into the database?
- Add()
- Put()
- Create()
- Insert()
Answer: D) Insert()
Explanation:
The insert() method is used to put a record into the database.
Discuss this Question
20. Prefixing method names with an ____ will prevent them from being called.
- Double underscore
- Underscore
- @ at
Answer: B) Underscore
Explanation:
Prefixing method names with an underscore will prevent them from being called.
Discuss this Question
21. The data to be updated will be set using the ____ method.
- Update()
- Changed()
- Setup()
- Set()
Answer: D) Set()
Explanation:
The data to be updated will be set using the set() method.
Discuss this Question
22. The ____ method is used to delete a record from the database.
- Erase()
- Del
- Delete()
- Remove()
Answer: C) Delete()
Explanation:
The delete() method is used to delete a record from the database.
Discuss this Question
23. The ____ method is used to select a record from the database.
- Get()
- Hold()
- Retrieve()
Answer: A) Get()
Explanation:
The get method is used to select a record from the database.
Discuss this Question
24. Helpers are written in an Object-Oriented format.
- True
- False
Answer: B) False
Explanation:
Helpers are not written in an Object-Oriented way. These are basic procedural functions.
Discuss this Question
25. CodeIgniter does load Helper Files by default?
- True
- False
Answer: B) False
Explanation:
Helper Files are not loaded by default in CodeIgniter. Therefore the first step in utilizing a Helper is to load it. After loaded, it is available in your controller and views globally.
Discuss this Question
26. How many wildcard types you can use in CodeIgniter?
- 5
- 4
- 3
- 2
Answer: D) 2
Explanation:
You can use two wildcard types:
Discuss this Question
27. Wildcards are aliases for regular expressions?
- True
- False
Answer: A) True
Explanation:
Wildcards are aliases for regular expressions.
Discuss this Question
28. An ____ in CodeIgniter is an error handler class.
- Blocker
- Inhibitor
- Receptor
Answer: B) Inhibitor
Explanation:
An inhibitor in CodeIgniter is an error handler class.
Discuss this Question
29. A ____ is a sort of library that contains a parent class and numerous child classes.
- Router
- Engine
- Driver
Answer: C) Driver
Explanation:
A driver is a sort of library that contains a parent class and numerous child classes.
Discuss this Question
30. How many types of helper files are there?
- 5
- 4
- 2
- 3
Answer: D) 3
Explanation:
There are three types of helper files:
- URL helpers
- Text helpers
- Cookies helpers
Discuss this Question
31. In the following tag; $this->output->cache($n)
What does $n represent?
- $n is the amount of time you want the page to be cached between refreshes.
- $n is the number of pages you want to cache.
Answer: A) $n is the amount of time you want the page to be cached between refreshes.
Explanation:
$n is the amount of time you want the page to be cached between refreshes.
Discuss this Question
32. CSRF stands for ____?
- Cross-section request form
- Cross-site request form
- Cross-site request forgery
- Cross section request forgery
Answer: C) Cross-site request forgery
Explanation:
CSRF stands for Cross-site request forgery.
Discuss this Question
33. If you need to erase the cache manually, use the ____ method.
- Remove_cache()
- Del_Cache()
- Delete cache()
Answer: C) Delete cache()
Explanation:
If you need to erase the cache manually, use the delete_cache() method.
Discuss this Question
34. The ____ Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages.
- Sensor
- Profiler
- Analyzer
Answer: B) Profiler
Explanation:
The Profiler Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages.
Discuss this Question
35. CodeIgniter's ____ class makes it simple to support several languages for internationalization?
- Language
- Speech
- Dialect
Answer: A) Language
Explanation:
CodeIgniter's language class makes it simple to support several languages for internationalization.
Discuss this Question
36. Cookie handling is handled by a helper named "____" in CodeIgniter.
- Cookie
- Cookie helper
- Data helper
- Cookie and session
Answer: B) Cookie helper
Explanation:
Cookie handling is handled by a helper named "Cookie Helper" in CodeIgniter.
Discuss this Question
37. Which of the following function is used to erase the cookie?
- Remove_cookie()
- Erase_cookie()
- Del_cookie()
- Delete_cookie()
Answer: D) Delete_cookie()
Explanation:
To erase the cookie, use the delete_cookie() method.
Discuss this Question
38. The cookie is obtained using the ____ method.
- get_cookie()
- retrieve_cookie()
- obtain()
Answer: A) get_cookie()
Explanation:
The cookie is obtained using the get_cookie() method.
Discuss this Question
39. In CodeIgniter, among library and helper which of them follows an object-oriented approach?
- Helper
- Library
Answer: B) Library
Explanation:
Among library and helper, the library follows an object-oriented approach.
Discuss this Question
40. Which of the following folder will contain the base class of your application?
- Hooks
- Helpers
- Config
- Core
Answer: D) Core
Explanation:
The core folder will contain the base class of your application.
Discuss this Question
41. CodeIgniter processes all transactions in ____ Mode by default.
- Test
- Strict
- Hard
Answer: B) Strict
Explanation:
CodeIgniter processes all transactions in Strict Mode by default.
Discuss this Question
42. Which of the following should be used while running manual transactions?
- $this->db->trans_begin()
- $this->db->trans_start().
Answer: A) $this->db->trans_begin()
Explanation:
You should use $this->db->trans_begin() when running manual transactions, NOT $this->db->trans_start().
Discuss this Question
43. Which of the following returns an array with the names of all the tables in the database to which you are presently connected?
- $this->db->tables();
- $this->db->list_tables();
- $this->db->array_tables();
Answer: B) $this->db->list_tables();
Explanation:
$this->db->list_tables(); returns an array with the names of all the tables in the database to which you are presently connected.
Discuss this Question
44. Which of the following returns an array of objects containing field information?
- $this->db->data()
- $this->db->table_data()
- $this->db->field_data()OOP
Answer: C) $this->db->field_data()OOP
Explanation:
$this->db->field_data()OOP, returns an array of objects containing field information.
Discuss this Question
45. Which class allows you to cache queries as text files to minimize database load?
- Database Caching Class
- Caching Class
- Database record Caching Class
Answer: A) Database Caching Class
Explanation:
The Database Caching Class allows you to cache queries as text files to minimize database load.
Discuss this Question
46. Which of the following removes cache files connected with a certain page?
- $this->db->cache_remove()
- $this->db->cache_erase()
- $this->db->cache_del()
- $this->db->cache_delete()
Answer: D) $this->db->cache_delete()
Explanation:
$this->db->cache_delete() removes cache files connected with a certain page.
Discuss this Question
47. Which of the following clears all existing cache files?
- $this->db->cache_remove_all()
- $this->db->cache_delete_all()
- $this->db->cache_erase_all()
Answer: B) $this->db->cache_delete_all()
Explanation:
$this->db->cache_delete_all(), clears all existing cache files.
Discuss this Question
48. Is CodeIgniter open-source?
- Yes
- No
Answer: A) Yes
Explanation:
CodeIgniter is an open-source web framework for quick software development.
Discuss this Question
49. How many different sorts of messages can CodeIgniter log?
- 2
- 3
- 4
- 5
Answer: B) 3
Explanation:
Three message types are logged in CodeIgniter:
- Error Messages
- Debug Messages
- Informational Messages
Discuss this Question
50. Which of the following permits you to create the database?
- $this->dbforge->create(‘db_name’)
- $this->dbforge->create_newdatabase(‘db_name’)
- $this->dbforge->create_database(‘db_name’)
Answer: C) $this->dbforge->create_database(‘db_name’)
Explanation:
$this->dbforge->create_database(‘db_name’), Permits you to create the database.
Discuss this Question