Pages

Tuesday, April 18, 2017

CakePHP Interview Questions and Answers

1. What is a CakePHP?
PHP is a free, open source, the fast development framework for PHP. This is a basic structure for programmers to create web applications. CakePHP aims to be able to work without the flexibility in a consolidated and quick manner. Php HP takes boredom away from web development.

2. A cake was introduced in PHP?
Cape PHP started in April 2005. In a Php, a Polish programmer from the Rapid Application Framework, Michel Tatorovinsz wrote a small version, it released the cake, version 1.0, which was published in May 2006.

3. What is CakePHP MVC?
MVC (Model View Controller) is an architectural sample used in software engineering.
·         Model: Database function model is available
·         View: The parts of the design are written here
·         Controller: Business logic goes here
CakePHP MVC Architecture

4. How to install CakePHP?
Step1: Visit cakephp.org and download the latest version of CakePHP.
Step2: CakePHP comes in a .zip file, so unzip it
Step3: Extract files on the local host in the desired folder
Step4: Open the browser and run the URL Local Host / CakePHP
Step 5: Just follow the instructions on the page to follow.

5. What is the controller?
A controller is used for managing logic for a part of your application. In most cases, the controllers are used for logic for a model. Controllers can include any type of method that is commonly known as a function. Controller methods are used to show actions. An action is a controller's single method.

6. List of some of CakePHP features
·         Compatible with PHP version 4 and 5
·         MVC architecture
·         Built-in validation
·         Caching
·         Scaffolding
·         Access Control List and Authentication
·         CSRF Protection by Security Component

7. Are the ingredients usually used in CakePHP?
·         Security
·         Sessions
·         Access Control List
·         Email
·         Biscuits
·         Authentication
·         Request handling
·         Scaffolding

8. What is a helper?
The CakePHP Helper app is associated with the present level. Helpers are mainly presentational arguments that are available for sharing among many views, elements or layouts.
What are commonly used helpers of CakePHP?
·         FormHelper
·         HtmlHelper
·         JsHelper
·         CacheHelper
·         NumberHelper
·         Paginator
·         RSS
·         SessionHelper
·         TextHelper
·         TimeHelper

9. What is a behavior?
CakePHP practices are associated with models. Evolution is used to model behavior and modification to model the work as something else.

10. What is the difference between Component, Helper, and Behavior?
The component is a Controller extension, Helpers are View extensions, and Behavior is a Model Extension.

11. What is the different part of the view layer in Cake PHP?
Ans:
·         Views: Views are the part of the unique action to the page.
·         Elements: smaller, reusable bits of view code. Elements are usually rendered inside views.
·         Layouts: Most views are rendered inside a layout.
·         Helpers: Helpers are View extensions,

12. What is the purpose of $this->set ()?
Function $this->set () is used to pass variables from the controller to the view

13. What is the name of CakePHP database configuration file name and its location?
Default file name is database.php.default. It’s located at /app/Config/database.php.default. To connect with database it should be renamed to database.php

14. What is the first file that gets loaded when you run an application using CakePHP? Can you change that file?
Bootstrap.php yes it can be changed. Either through index.php or through .htaccess

15. What are utilize of Security salt and Security cipher responding in PHP? How to change its default value?
The Security Salt is used for generating hashes. We can change the default Security Salt value in /app/Config/core.php. - The Security cipher seed is used for encrypting/decrypt strings. We can change the default Security cipher Seed value by editing /app/Config/core.php. Encrypt =especially to prevent unauthorized access. Decrypt =a text that has been decoded.

16. What is Scaffolding in CakePHP?
Scaffolding is a method that lets the developer define and create a basic application that can create, retrieve, update, and delete objects.

17. What is a Component in CakePHP?
Components are packages of logic that are shared between controllers. It is useful if a common logic or code is needed in different controllers.

18. What are commonly used components of CakePHP?
1. Sessions,
2. Access control lists
3. Emails,
4. Cookies,
5. Authentication,
6. Request handling
7. Scaffolding

19. What is a Helper?
Helpers are View extensions.Helpers in CakePHP are associated with Presentation layers of the application.

20. What are commonly used helpers of CakePHP?
1. FormHelper,
2. HtmlHelper,
3. JsHelper,
4. CacheHelper,
5. NumberHelper,
6. Paginator

21. What is a Behavior?
Behaviors in CakePHP are associated with models. Behavior is a Model Extension Behaviors are used to change the models behaves and enforcing model to act as something else.

22. What is the difference between Component, Helper, and Behavior?
Controller extension is Component, Helpers are View extensions, and Behavior is a Model Extension.

23. What is the use of $this->set (compact ());
Using $this->set (compact ()), we can pass multiple parameters to access into the view file.

24. List some database related functions in CakePHP
1. Find,
2. FindAll,
3. FindAllBy,
4. FindBy,
5. FindNeighbours and
6. Query.

25. What way can you set custom page title for the static page?
To set a custom page title, copy-paste following code anywhere in our static page (.ctp) file:
$this->set ("title_for_layout", "My page title");

26. How can we use Ajax in CakePHP?
By calling Ajax helper and then using it in the controller for rendering


No comments:

Post a Comment