MCQs > IT & Programming > CakePHP MCQs > Basic CakePHP MCQs

Basic CakePHP MCQ

1. Which data retrieval function call is most suitable to build input select boxes?

Answer

Correct Answer: find('list')

Note: This Question is unanswered, help us to find answer for this one

2. What is the name of the CLI console that comes with CakePHP and helps you get your project up and running fast by generating models, views, and controllers from templates.

Answer

Correct Answer: bake

Note: This Question is unanswered, help us to find answer for this one

3. How will you include an element (header/footer etc.) within a layout?

Answer

Correct Answer: <?php echo $this->element('element_name'); ?>

Note: This Question is unanswered, help us to find answer for this one

4. Which function is executed before every action in the controller.

Answer

Correct Answer: beforeFilter

Note: This Question is unanswered, help us to find answer for this one

5. Which data retrieval function will return one result only?

Answer

Correct Answer: find('first', $options)

Note: This Question is unanswered, help us to find answer for this one

6. By default, what controller action will be invoked if the action is not specified in the URL?

Answer

Correct Answer: index

Note: This Question is unanswered, help us to find answer for this one

7. What is the default action for a controller?

Answer

Correct Answer: index() function

Note: This Question is unanswered, help us to find answer for this one

8. True or False? CakePHP is based on the MVC design pattern.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

9. What does MVC stand for?

Answer

Correct Answer: Model-view-controller

Note: This Question is unanswered, help us to find answer for this one

10. True or False? CakePHP favors convention over configuration.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

11. The Bake console can be used to create:

Answer

Correct Answer: models, views and controllers

Note: This Question is unanswered, help us to find answer for this one

12. How is the AppController class defined?

Answer

Correct Answer: class AppController extends Controller { }

Note: This Question is unanswered, help us to find answer for this one

13. What is a .ctp file?

Answer

Correct Answer: CakePHP Template

Note: This Question is unanswered, help us to find answer for this one

14. What is the AppController class?

Answer

Correct Answer: It is the parent class to all of the application’s controllers.

Note: This Question is unanswered, help us to find answer for this one

15. What should be done before deploying a CakePHP application?

Answer

Correct Answer: All of them

Note: This Question is unanswered, help us to find answer for this one

16. In cakePHP 2.x , the recursive property defines:

Answer

Correct Answer: how deep CakePHP should go to fetch associated model data via find(), and read() methods

Note: This Question is unanswered, help us to find answer for this one

17. Which file is processed first?

Answer

Correct Answer: index.php

Note: This Question is unanswered, help us to find answer for this one

18. What kind of functionality does the Security Component provide?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

19. True or False? CakePHP will dynamically create a model object for you if it cannot find a corresponding file in /app/Model.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

20. You want to generate three instances of a model form within the context of a view. What syntax is most correct to use with FormHelper::input() ? $i represents an incremented variable.

Answer

Correct Answer: $this->Form->input("Modelname.$i.fieldname");

Note: This Question is unanswered, help us to find answer for this one

21. Which of the following is an example of a model definition in CakePHP?

Answer

Correct Answer: App::uses('AppModel', 'Model'); class Ingredient extends AppModel { public $name = 'Ingredient'; }

Note: This Question is unanswered, help us to find answer for this one

22. Is it possible to define custom data retrieval methods and if so, where would you define them?

Answer

Correct Answer: Yes, in the model

Note: This Question is unanswered, help us to find answer for this one

23. Which CakePHP entities can the Bake console create?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one