Our experts have gathered these CakePHP MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of CakePHP by answering these 20 multiple-choice questions.
Get started now by scrolling down!

1: Which CakePHP entities can the Bake console create?

A.   All of these

B.   Controller

C.   View

D.   Model

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

A.   Yes, create a component

B.   Yes, in the routes

C.   Yes, in the model

D.   No, good luck

E.   Yes, as a controller function

3: Which of the following is an example of a model definition in CakePHP?

A.   None of these

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

C.   CakePlugin::loadAll(); // Loads all plugins at once CakePlugin::load('ContactManager'); //Loads a single plugin

D.   class IngredientsController extends AppController { public function index() {

4: 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.

A.   $this->Form->input("fieldname.$i.Modelname");

B.   $this->Form->input("$i.Modelname.$i.fieldname");

C.   $this->Form->input("Modelname.$i.fieldname");

D.   $this->Form->input("$i.fieldname");

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

A.   True

B.   False

6: What kind of functionality does the Security Component provide?

A.   CSRF protection

B.   Form tampering protection

C.   All of these

D.   Restricting which HTTP methods the application accepts

E.   Requiring that SSL be used

7: Which file is processed first?

A.   index.php

B.   bootstrap.php

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

A.   how deep CakePHP should go to fetch associated model data via find(), and read() methods

B.   how many records to fetch by data via find(), and read() methods

C.   how many time the find(), and read() methods are called

9: What should be done before deploying a CakePHP application?

A.   Set document root to app/webroot

B.   Make sure data is sanitized and validated

C.   Disable debug messages in core.php

D.   Disable exception stack traces

E.   All of them

10: What is the AppController class?

A.   It sets the initial configuration for plugins and caching.

B.   It builds and manages paths to various components of the application.

C.   It is responsible for converting the POST parameters into a request object.

D.   None of these.

E.   It is the parent class to all of the application’s controllers.

11: What is a .ctp file?

A.   Common Timing Protocol

B.   Twig Template

C.   PHP Container File

D.   CakePHP Template

E.   misnamed

12: How is the AppController class defined?

A.   None of these

B.   public function beforeFilter() { parent::beforeFilter(); }

C.   class AppController extends Controller { }

D.   $data = array( 'color' => 'pink', 'type' => 'sugar'

13: The Bake console can be used to create:

A.   none of above

B.   models only

C.   models and views only

D.   models, views and controllers

E.   models and controllers only

14: True or False? CakePHP favors convention over configuration.

A.   False

B.   True

15: What does MVC stand for?

A.   Module-vector-core

B.   Maximum-velocity-counter

C.   Modular-view-controlling

D.   Model-view-controller

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

A.   True

B.   False

17: What is the default action for a controller?

A.   index() function

B.   _index() function

C.   control() function

D.   None of these

E.   main() function

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

A.   index

B.   view

C.   default

D.   add

19: Which data retrieval function will return one result only?

A.   find('list', $options)

B.   find('one', $options)

C.   find('first', $options)

D.   find('threaded', $options)

E.   find('all', $options)

20: Which function is executed before every action in the controller.

A.   firstFilter

B.   beforeFilter

C.   All of above

D.   afterFilter

A.   <?php echo $this->element('element_name'); ?>

B.   <?php include('element_name'); ?>

C.   <?php echo $this->set('element_name'); ?>

D.   <?php echo $this->include('element_name'); ?>

22: 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.

A.   grunt

B.   rake

C.   cake

D.   composer

E.   bake

23: Which data retrieval function call is most suitable to build input select boxes?

A.   find('select')

B.   find('first')

C.   find('list')

D.   find('all')

E.   field('list')