300+ Top CodeIgniter MCQ Questions and Answers Quiz

CodeIgniter Multiple Choice Questions

1. Your data structures are represented by the ____.

  1. View
  2. Controller
  3. Model

Answer: C Model

Explanation: Your data structures are represented by the Model.

2. The ____ acts as a bridge between the Model and the View.

  1. Processor
  2. Controller
  3. Director
  4. Repository

Answer: B Controller

Explanation: The Controller acts as a bridge between the Model and the View.

3. The View is the information that is displayed to the user.

  1. View
  2. Controller
  3. Model

Answer: A View

Explanation: The View is the information that is displayed to the user.

4. CodeIgniter is a ____.

  1. Enterprise architecture framework
  2. Database Framework
  3. Testing framework
  4. Application development framework

Answer: D Application development framework

Explanation: CodeIgniter is an application development framework.

5. CodeIgniter uses which programming language?

  1. PHP
  2. JavaScript
  3. Java
  4. Python

Answer: A PHP

Explanation: CodeIgniter is a tool kit that uses PHP language.

6. CodeIgniter is licensed under which of the following?

  1. Apache
  2. MIT
  3. Microsoft
  4. Google

Answer: B MIT

Explanation: CodeIgniter is licensed under the MIT license.

7. CodeIgniter uses which of the following approach?

  1. MVC
  2. Master-slave
  3. Client-server
  4. Layered

Answer: A MVC

Explanation: CodeIgniter uses the Model-View-Controller approach.

8. The class name must start with ____ letter.

  1. Lowercase
  2. Uppercase
  3. Any case

Answer: B Uppercase

Explanation: The class name must start with an uppercase letter.

9. Views can be called directly?

  1. True
  2. 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.

10. Which kind of relationship is there between a URL string and its corresponding controller class/method?

  1. Many-to-one
  2. One-to-many
  3. Many-to-many
  4. 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.

CodeIgniter MCQs

11. How many reserved routes are there in CodeIgniter?

  1. 4
  2. 3
  3. 5
  4. 7

Answer: B 3

Explanation: With CodeIgniter, there are three reserved routes:

  • $route[‘default_controller’]
  • $route[‘404_override’]
  • $route[‘translate_uri_dashes’]

12. If the URI includes no data, ____ route indicates which controller class should be loaded.

  1. $route[‘default_controller’]
  2. $route[‘404_override’]
  3. $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.

13. If the specified controller cannot be found, ____ route specifies which controller class should be loaded.

  1. $route[‘default_controller’]
  2. $route[‘404_override’]
  3. $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.

14. Which of the following can be used to customize routes?

  1. Wildcards
  2. Regular expressions
  3. Both
  4. None

Answer: C Both

Explanation: Wildcards and regular expressions can be used to customize routes.

15. CodeIgniter reads its routing rules from ____?

  1. Top-to-Bottom
  2. Bottom-to-top
  3. Both
  4. None

Answer: A Top-to-Bottom

Explanation: CodeIgniter reads its routing rules from top to bottom.

16. In the URL given below what does the first segment indicates?

includehelp.com/class/function/id/
  1. The first section denotes the controller class to be called.
  2. The first section denotes the class function or method to be invoked.
  3. 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.

17. In the URL given below what does the second segment indicates?

includehelp.com/class/function/id/
  1. The second section denotes the controller class to be called.
  2. The second section denotes the class function or method to be invoked.
  3. 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.

18. In how many ways you can connect to the database?

  1. 5
  2. 4
  3. 2
  4. 3

Answer: C 2

Explanation: We can connect to the database in the following two ways –

  • Automatic connecting
  • Manual connecting

19. Which of the following method is used to put a record into the database?

  1. Add()
  2. Put()
  3. Create()
  4. Insert()

Answer: D Insert()

Explanation: The insert() method is used to put a record into the database.

20. Prefixing method names with an ____ will prevent them from being called.

  1. Double underscore
  2. Underscore
  3. @ at

Answer: B Underscore

Explanation: Prefixing method names with an underscore will prevent them from being called.

21. The data to be updated will be set using the ____ method.

  1. Update()
  2. Changed()
  3. Setup()
  4. Set()

Answer: D Set()

Explanation: The data to be updated will be set using the set() method.

22. The ____ method is used to delete a record from the database.

  1. Erase()
  2. Del
  3. Delete()
  4. Remove()

Answer: C Delete()

Explanation: The delete() method is used to delete a record from the database.

23. The ____ method is used to select a record from the database.

  1. Get()
  2. Hold()
  3. Retrieve()

Answer: A Get()

Explanation: The get method is used to select a record from the database.

24. Helpers are written in an Object-Oriented format.

  1. True
  2. False

Answer: B False

Explanation: Helpers are not written in an Object-Oriented way. These are basic procedural functions.

25. CodeIgniter does load Helper Files by default?

  1. True
  2. 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.

26. How many wildcard types you can use in CodeIgniter?

  1. 5
  2. 4
  3. 3
  4. 2

Answer: D 2

Explanation: You can use two wildcard types:

  • (:any)
  • (:num)

27. Wildcards are aliases for regular expressions?

  1. True
  2. False

Answer: A True

Explanation: Wildcards are aliases for regular expressions.

28. An ____ in CodeIgniter is an error handler class.

  1. Blocker
  2. Inhibitor
  3. Receptor

Answer: B Inhibitor

Explanation: An inhibitor in CodeIgniter is an error handler class.

29. A ____ is a sort of library that contains a parent class and numerous child classes.

  1. Router
  2. Engine
  3. Driver

Answer: C Driver

Explanation: A driver is a sort of library that contains a parent class and numerous child classes.

30. How many types of helper files are there?

  1. 5
  2. 4
  3. 2
  4. 3

Answer: D 3

Explanation: There are three types of helper files:

  • URL helpers
  • Text helpers
  • Cookies helpers

31. In the following tag; $this->output->cache($n)

What does $n represent?
  1. $n is the amount of time you want the page to be cached between refreshes.
  2. $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.

32. CSRF stands for ____?

  1. Cross-section request form
  2. Cross-site request form
  3. Cross-site request forgery
  4. Cross section request forgery

Answer: C Cross-site request forgery

Explanation: CSRF stands for Cross-site request forgery.

33. If you need to erase the cache manually, use the ____ method.

  1. Remove_cache()
  2. Del_Cache()
  3. Delete cache()

Answer: C Delete cache()

Explanation: If you need to erase the cache manually, use the delete_cache() method.

34. The ____ Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages.

  1. Sensor
  2. Profiler
  3. 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.

35. CodeIgniter’s ____ class makes it simple to support several languages for internationalization?

  1. Language
  2. Speech
  3. Dialect

Answer: A Language

Explanation: CodeIgniter’s language class makes it simple to support several languages for internationalization.

36. Cookie handling is handled by a helper named “____” in CodeIgniter.

  1. Cookie
  2. Cookie helper
  3. Data helper
  4. Cookie and session

Answer: B Cookie helper

Explanation: Cookie handling is handled by a helper named “Cookie Helper” in CodeIgniter.

37. Which of the following function is used to erase the cookie?

  1. Remove_cookie()
  2. Erase_cookie()
  3. Del_cookie()
  4. Delete_cookie()

Answer: D Delete_cookie()

Explanation: To erase the cookie, use the delete_cookie() method.

38. The cookie is obtained using the ____ method.

  1. get_cookie()
  2. retrieve_cookie()
  3. obtain()

Answer: A get_cookie()

Explanation: The cookie is obtained using the get_cookie() method.

39. In CodeIgniter, among library and helper which of them follows an object-oriented approach?

  1. Helper
  2. Library

Answer: B Library

Explanation: Among library and helper, the library follows an object-oriented approach.

40. Which of the following folder will contain the base class of your application?

  1. Hooks
  2. Helpers
  3. Config
  4. Core

Answer: D Core

Explanation: The core folder will contain the base class of your application.

41. CodeIgniter processes all transactions in ____ Mode by default.

  1. Test
  2. Strict
  3. Hard

Answer: B Strict

Explanation: CodeIgniter processes all transactions in Strict Mode by default.

42. Which of the following should be used while running manual transactions?

  1. $this->db->trans_begin()
  2. $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().

43. Which of the following returns an array with the names of all the tables in the database to which you are presently connected?

  1. $this->db->tables();
  2. $this->db->list_tables();
  3. $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.

44. Which of the following returns an array of objects containing field information?

  1. $this->db->data()
  2. $this->db->table_data()
  3. $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.

45. Which class allows you to cache queries as text files to minimize database load?

  1. Database Caching Class
  2. Caching Class
  3. 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.

46. Which of the following removes cache files connected with a certain page?

  1. $this->db->cache_remove()
  2. $this->db->cache_erase()
  3. $this->db->cache_del()
  4. $this->db->cache_delete()

Answer: D $this->db->cache_delete()

Explanation: $this->db->cache_delete() removes cache files connected with a certain page.

47. Which of the following clears all existing cache files?

  1. $this->db->cache_remove_all()
  2. $this->db->cache_delete_all()
  3. $this->db->cache_erase_all()

Answer: B $this->db->cache_delete_all()

Explanation: $this->db->cache_delete_all(), clears all existing cache files.

48. Is CodeIgniter open-source?

  1. Yes
  2. No

Answer: A Yes

Explanation: CodeIgniter is an open-source web framework for quick software development.

49. How many different sorts of messages can CodeIgniter log?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: B 3

Explanation: Three message types are logged in CodeIgniter:

  • Error Messages
  • Debug Messages
  • Informational Messages

50. Which of the following permits you to create the database?

  1. $this->dbforge->create(‘db_name’)
  2. $this->dbforge->create_newdatabase(‘db_name’)
  3. $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.

CodeIgniter objective questions with answers pdf download online certification exam test

Leave a Reply

Your email address will not be published. Required fields are marked *