-
What is CodeIgniter?
- A) A content management system (CMS)
- B) A PHP framework
- C) A JavaScript library
- D) An operating system
Answer: B) A PHP framework
-
Which architectural pattern does CodeIgniter follow?
- A) MVP (Model-View-Presenter)
- B) MVVM (Model-View-ViewModel)
- C) MVC (Model-View-Controller)
- D) MVPVM (Model-View-Presenter-ViewModel)
Answer: C) MVC (Model-View-Controller)
-
What is the purpose of a controller in CodeIgniter?
- A) To handle database interactions
- B) To manage user authentication
- C) To handle HTTP requests and route them to appropriate methods
- D) To display the user interface
Answer: C) To handle HTTP requests and route them to appropriate methods
-
Which directory contains the main configuration files in a CodeIgniter project?
- A) application
- B) system
- C) public
- D) config
Answer: D) config
-
What is the purpose of the
autoload.php
file in CodeIgniter?- A) To load core system files
- B) To autoload helper functions, libraries, and models
- C) To configure database settings
- D) To define custom routes
Answer: B) To autoload helper functions, libraries, and models
-
Which of the following methods is used to load a view file in a controller?
- A)
$this->load->view()
- B)
$this->render->view()
- C)
$this->render_view()
- D)
$this->load->template()
Answer: A)
$this->load->view()
- A)
-
How can you pass data from a controller to a view in CodeIgniter?
- A) By setting global variables in the controller
- B) By using sessions
- C) By passing an array to the
load->view()
method - D) By directly accessing the model from the view
Answer: C) By passing an array to the
load->view()
method -
Which method is used to perform database queries using CodeIgniter's Query Builder?
- A)
$this->db->query()
- B)
$this->db->get()
- C)
$this->db->execute()
- D)
$this->db->select()
Answer: B)
$this->db->get()
- A)
-
How can you enable CSRF protection in CodeIgniter?
- A) By setting the
csrf_protection
configuration option toTRUE
- B) By using a middleware library
- C) By adding a hidden field with a CSRF token to each form
- D) CSRF protection is enabled by default in CodeIgniter
Answer: A) By setting the
csrf_protection
configuration option toTRUE
- A) By setting the
-
Which of the following is NOT a valid CodeIgniter URL pattern?
- A)
http://example.com/index.php/controller/method/parameter
- B)
http://example.com/controller/method/parameter
- C)
http://example.com/index.php/controller/parameter
- D)
http://example.com/index.php/method/parameter
Answer: D)
http://example.com/index.php/method/parameter
- A)
Comments