Top 20 CakePHP Interview Questions and Answers

4

Here there are many questions and answers about How CakePHP Framework works? and basic questions related to CakePHP framework functionality.

Q-1 What is CakePHP ?
Ans. CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. There is number of in built component like Ajax, RequestHandler, Session etc

Q-2 What are are drawbacks of cakephp.
Ans. The learning curve, and it loads full application before it starts your task. Its not recommended for small projects because of its resource heavy structure.

CakePHP Interview Questions and Answers

Q-3 What is MVC (model, view, and controller) in cakephp?
Ans. Model–view–controller (MVC) is an architectural pattern used in software engineering.
Model: Databases function exist in the model
View: Design parts written here
Controller: Business Login

Q-4 What is the name of Cakephp database configuration file name and its location?
Ans. Default file name is database.php.default.
Its located in “/app/config/database.php.defaut”

Q-5 What are component, helper and why are they used?
Ans. A component is an independent piece of code written for specific task that can be used(Eg Email, Ajax, RequestHandler and Session).
A helper is used for helping cakephp in rendering the data to be shown to user with views(Eg Form, HTML etc).

Q-6 What are commonly used components of cakephp?
Ans.
Security
Sessions
ACL(Access control lists)
Auth(Authentication)
Emails
Cookies
RequestHandling
MVC architecture
Built-in validations
Caching
scaffolding

Q-7 What is default function and default controller of cakephp which is called automatically?
Ans. Default controller is indexController.php and Default function is index.

Q-8 How cakephp URL looks in address bar?
Ans. http://example.com/controller/action/param1/param2/param3

Q-9 Why cakephp have two vendor folder?
Ans. There is two vendor folder, one folder in root and another is in “app” folder

Q-10 List some database related functions in cakephp.
Ans. find, findAll , findAllBy , findBy , findNeighbours and query.

Q-11 List some of the features in Cakephp
Ans. Following are some feature of Cakephp.
MVC architecture
Built-in validations
Caching
scaffolding

Q-12 can you remember what is the directory structure when you download cakephp?
Ans. app/
o config/
o controllers/
o models/
o plugins/
o tmp/
o vendors/
o views/
o webroot/
* cake/
o config/
o docs/
o libs/
* vendors/

Q-13 List some of the features in Cake php.
Ans.
1. Compatible with versions 4 and 5 of PHP
2. MVC architecture
3. Built-in validations
4. Caching
5. scaffolding

Q-14 What is the naming convention in cakephp?
Ans. Table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController, controller filenames are plural and underscored with *controller* appended: controller_names_controller.php,

Q-15 How can we use ajax in cakephp?
Ans. By calling ajax helper and then using it in controller for rendering.

Q-16 What is a component,helper and why are they used, is there other way we can do same thing, what is better.
Ans. A component is an independent piece of code written for specific task that can be used by calling in controllers (example : email component), helper is used for helping cakephp in rendering the data to be shown to user with views, these only adds to modularity in code otherwise same coding can be implemented in conrollers.

Q-17 If you have to validate a registration module for a user, what all can be possible ways , which one is the best?
Ans. can be done on submission in controller, or using javascript/ajax while user is still filling the data. second option is better.

Q-18 How can you include a javascript menu throughout the site. Give steps.
Ans. By adding the javascript files in webroot and call them in default views if needed everywhere or just in the related veiws.

Q-19 What is a Component in cakephp?
Ans. Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers.

Q-20 What are commonly used components of cakephp?
Ans.
1. Security
2. Sessions
3. Access control lists
4. Emails
5. Cookies
6. Authentication
7. Request handling

Share.

About Author

Hi, this is Hariom Balhara. I am an Online Marketing Expert with 8 years of extensive and rich experience of Marketing through Social Networking Platforms. I have been involved in this business since 2006. Earlier, I used to do it as a freelancer and of late I have set up a medium scale venture in partnership. The name of this venture is Online SEO Web Service.