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 ____.

  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.

Discuss this Question


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

Discuss this Question


3. 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.

Discuss this Question


4. 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.

Discuss this Question


5. 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.

Discuss this Question


6. 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.

Discuss this Question


7. 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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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']

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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)

Discuss this Question


27. Wildcards are aliases for regular expressions?

  1. True
  2. False

Answer: A) True

Explanation:

Wildcards are aliases for regular expressions.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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().

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?

  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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


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.

Discuss this Question


48. Is CodeIgniter open-source?

  1. Yes
  2. 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?

  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

Discuss this Question


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.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.