PHP CodeIgniter MCQ Questions & Answers
CodeIgniter MCQs : This section focuses on "CodeIgniter" PHP Framework. These Multiple Choice Questions (MCQ) should be practiced to improve the PHP CodeIgniter skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Which of the following is true about CodeIgniter?
A. CodeIgniter is an application development framework
B. CodeIgniter can be used to develop websites, using PHP.
C. CodeIgniter is an Open Source framework
D. All of the above
View Answer
Ans : D
Explanation: CodeIgniter is an application development framework, which can be used to develop websites, using PHP. It is an Open Source framework. It has a very rich set of functionality, which will increase the speed of website development work.
2. The ________ will render the page with available data and pass it on for Caching.
A. View
B. Security
C. Routing
D. Models
View Answer
Ans : A
Explanation: The View will render the page with available data and pass it on for Caching.
3. CodeIgniter directory structure is divided into?
A. 2 folders
B. 3 folders
C. 4 folders
D. 5 folders
View Answer
Ans : B
Explanation: CodeIgniter directory structure is divided into 3 folders : Application, System, User_guide.
4. Which folder will contain base class of your application?
A. Helpers
B. Models
C. Core
D. Logs
View Answer
Ans : C
Explanation: Core : This folder will contain base class of your application.
5. The __________ serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
A. Model
B. View
C. Controller
D. All of the above
View Answer
Ans : C
Explanation: The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
6. A controller is a simple class file. As the name suggests, it controls the whole application by?
A. URC
B. URA
C. URL
D. URI
View Answer
Ans : D
Explanation: A controller is a simple class file. As the name suggests, it controls the whole application by URI.
7. Model classes are stored in __________ directory.
A. application/models
B. helpers/models
C. app/models
D. system/models
View Answer
Ans : A
Explanation: Model classes are stored in application/models directory
8. The _________ file contains functions that assist in working with arrays.
A. CAPTCHA Helper
B. Array Helper
C. Cookie Helper
D. Date Helper
View Answer
Ans : B
Explanation: The Array Helper file contains functions that assist in working with arrays.
9. In Routing, which segment represents the controller class that should be invoked?
A. First
B. Second
C. Third
D. Fourth
View Answer
Ans : A
Explanation: The first segment represents the controller class that should be invoked.
The second segment represents the class function, or method, that should be called.
The third, and any additional segments, represent the ID and any variables that will be passed to the controller.
10. Which wildcards will match a segment containing only numbers?
A. (:float)
B. (:any)
C. (:int)
D. (:num)
View Answer
Ans : D
Explanation: (:num) − It will match a segment containing only numbers.
11. Which of the following will specify location of your database here e.g. localhost or IP address?
A. database
B. username
C. hostname
D. dbdriver
View Answer
Ans : C
Explanation: hostname : Specify location of your database here e.g. localhost or IP address
12. Which function will decide which record to update?
A. Groupby()
B. Where()
C. Set()
D. Orderby()
View Answer
Ans : B
Explanation: The where() function will decide which record to update.
where($key[, $value = NULL[, $escape = NULL]])
13. Which function is used to select a record?
A. put()
B. select()
C. set()
D. get()
View Answer
Ans : D
Explanation: GET() function is used to select a record
14. Which of the following is correct syntax for Closing a Connection?
A. $this->db->close();
B. $this->close();
C. db->close();
D. $this->db->close;
View Answer
Ans : A
Explanation: Database connection can be closed manually, by executing the following code : $this->db->close();
15. The set() function will set the data to be updated.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: To update a record in the database, the update() function is used along with set() and where() functions. The set() function will set the data to be updated.
16. Which class is always active, enabling the time difference between any two marked points to be calculated?
A. Caching Class
B. Calendaring Class
C. Shopping Cart Class
D. Benchmarking Class
View Answer
Ans : D
Explanation: Benchmarking class is always active, enabling the time difference between any two marked points to be calculated.
17. Which class provides two-way data encryption functionality?
A. Config Class
B. Encryption Class
C. Email Class
D. Form Validation
View Answer
Ans : B
Explanation: Encryption Class : This class provides two-way data encryption functionality.
18. Language Class : This class pre-processes the input data for security reason.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : B
Explanation: Input Class : This class pre-processes the input data for security reason.
19. Which function displays errors in HTML format at the top of the screen?
A. show_error()
B. show_404()
C. log_message()
D. $level
View Answer
Ans : A
Explanation: show_error() function displays errors in HTML format at the top of the screen.
20. Which function displays error if you are trying to access a page which does not exist?
A. $log_error
B. log_message()
C. show_404()
D. $page
View Answer
Ans : C
Explanation: show_404() function displays error if you are trying to access a page which does not exist.
Discussion