Symfony2 MCQs

Symfony2 MCQs

These Symfony2 multiple-choice questions and their answers will help you strengthen your grip on the subject of Symfony2. You can prepare for an upcoming exam or job interview with these 70+ Symfony2 MCQs.
So scroll down and start answering.

1: In regard to validating the data that is entered in forms, which of the following constraints is NOT supported by Symfony2?

A.   NotEqualTo

B.   EqualTo

C.   UniqueEntity

D.   All of these are supported

2: The Dependency Injection component allows you to

A.   Convert a Request to a Response

B.   Standardize and centralize the way objects are constructed in your application

C.   Defining the Controller as a Service

D.   Parse the URL and determine which controller should be executed

3: If you have the role IS_AUTHENTICATED_FULLY , then you also have the role IS_AUTHENTICATED_REMEMBERED

A.   False

B.   True

4: Which of the following allows you to manipulate assets however you like before serving them?

A.   Crawlers

B.   Assets

C.   Doctrine

D.   Assetic

5: Which of the following Components allows you to trace a specific URI to a description of how it should be handled?

A.   HttpFoundation

B.   Translation

C.   Routing

D.   ClassLoader

6: What Symfony2 environment is used to run unit tests?

A.   work

B.   prod

C.   test

D.   dev

7: Which of the following methods is used to generate a URL for a given route?

A.   generateURL()

B.   createURL()

C.   URLgenerator()

D.   URLcreate()

8: True or False? The HTTP response from a controller is limited to 404 errors, XML documents, and HTML pages.

A.   False

B.   TRUE

9: Symfony2 is only supported on:

A.   PHP 5.1.2 and up

B.   PHP 4.3.3 and up

C.   PHP 5.3.3 and up

D.   PHP 4.1.2 and up

10: Which of the following methods allows you to progress to another controller internally?

A.   forward()

B.   progress()

C.   send()

D.   sent()

11: Which of the following Components contain the Request and Response classes?

A.   Translation

B.   Routing

C.   ClassLoader

D.   HttpFoundation

12: Where is the routing configuration file located?

A.   app/src

B.   app/config

C.   app/console

D.   app/Resources

13: Select the sequence that shows an example of a simple controller.

A.   {# app/Resources/views/layout.html.twig #} <!DOCTYPE html> <html> <head> <title>{% block title %}Default title{% endblock %}</title> </head> <body> {% block body %}{% endblock %} </body> </html>

B.   None of these

C.   // app/AppKernel.php public function registerBundles() { $bundles = array( ..., new Smarterer\HelloBundle\SmartererHelloBundle(), ); // ... return $bundles; }

D.   // src/Smarterer/HelloBundle/Controller/HelloController.php namespace Smarterer\HelloBundle\Controller; use Symfony\Component\HttpFoundation\Response; class HelloController { public function indexAction($name) { return new Response('<html><b

14: Which of the following directories contains any publicly accessible files?

A.   src/

B.   web/

C.   vendor/

D.   app/

15: The __________ allows you to begin using PHP classes without including the file containing the class.

A.   instantloader

B.   autoupload

C.   autoloader

D.   instantupload

16: Where is the AppKernel class stored?

A.   The app/ directory

B.   The kernal/ directory

C.   The application/ directory

D.   The class/ directory

17: The ________ class is a simple object-oriented representation of the HTTP request message.

A.   Request

B.   Send

C.   Call

D.   Inbound

18: Which of the following lets you write templates more quickly as well as makes them easier to read?

A.   Bark

B.   Tree

C.   Twig

D.   Branch

19: Which of the following field types are supported in Doctrine?

A.   Numbers

B.   All of these

C.   Dates and Times

D.   Strings

20: Which of the following is a Doctrine field type for numbers?

A.   boolean

B.   superint

C.   integer

D.   tinyint

21: Which of the following package manager is used in Symfony2 to manage vendor and their dependency ?

A.   Bundler

B.   Bower

C.   composer

D.   NuGet

E.   Symfony2 DI

22: How do you disable CSRF protection?

A.   Set csrf_protection to true

B.   Set csrf_protection to false

23: What are the 3 environments a Symfony2 project BEGINS with?

A.   app, test, and web

B.   app, test, and prod

C.   test, dev, and prod

D.   test, src, and prod

24: What are the three parts of the logical controller name?

A.   view:controller:model

B.   action:bundle:route

C.   bundle:controller:action

D.   controller:action:model

25: What tag is used for template inheritance?

A.   {% child %}

B.   {% extends %}

C.   {% parent %}

D.   {% inherit %}

26: Choose the best description of the following configuration: secure: path: /secure defaults: { _controller: SmartererDemoBundle:Main:secure } schemes: [https]

A.   It forces the secure route to avoid using HTTPS

B.   It forces the route to never use path /secure

C.   It forces the route to always use path /secure

D.   It forces the secure route to always use HTTPS

27: What class is used by the front controller to bootstrap an application?

A.   AppKernel

B.   AppPhp

C.   AppBundle

D.   class AppSrc

28: A directory that contains a set of files that represents a particular feature is known as a/an:

A.   Action

B.   Asset

C.   Bundle

D.   Application

29: What is the purpose of the _controller parameter in routing?

A.   It tells Symfony which controller should be executed when a URL does not match a specific route

B.   It tells Symfony which controller should be executed when a URL matches a specific route

C.   It tells Symfony how to access another controller internally

D.   It tells Symfony which container is used for key/value pairs

30: Security is a two-step process, the first being Authentication?

A.   True

B.   FALSE

31: True or False? The directory that contains all of the pieces of code that run your application is called the src/ directory.

A.   False

B.   True

32: is it possible to define a form like a service ?

A.   FALSE

B.   TRUE

33: In order to use your controller from the service container you need to register it as a service. Where can this be done?

A.   Locally in the bundle in the Resources/config/services.yml

B.   Locally in the bundle in the Sources/config/services.yml

C.   Locally in the bundle in the Sources/config/server.yml

D.   None of these

34: What is a PHP function that takes incoming requests and transforms them into a response?

A.   route

B.   view

C.   model

D.   controller

35: What defines a URL to a page?

A.   controller

B.   model

C.   path

D.   route

36: True or False? To build a form in Symfony2 you must build a form object and then render it in a template.

A.   True

B.   False

37: True or False? The Symfony2 Framework can be altered to one's preferences or replaced entirely.

A.   True

B.   False

38: What are the 2 options you have to install a Symfony2 distribution?

A.   Download an Archive or use Installer

B.   None of these

C.   Use Composer or Installer

D.   Use Composer or Download an Archive

39: Which of the following methods checks the 3 different values in PHP that can show whether or not the user is connecting via a secured connection?

A.   isSecure()

B.   isSafe()

C.   forward()

D.   indexAction()

40: How would one use a service in a controller in Symfony?

A.   $this->serviceContainer.get('name_service');

B.   $serviceTest = get('name_service')

C.   $this->getInstance('name_service');

D.   $serviceTest = getInstance('name_service');

E.   $this->get('name_service');

41: To delete an object in Doctrine you must use the _________ method of the entity manager.

A.   trash()

B.   flush()

C.   delete()

D.   remove()

42: In regard to routing, which of the following best describes a route?

A.   A map from a controller to a URL path

B.   A container for key/value pairs

C.   A map from a URL path to a controller

D.   A simple object-oriented representation of the HTTP request message

43: Which of the following is a common element of a bundle?

A.   (all of these)

B.   Controller/

C.   Resources/config/

D.   Tests/

44: Which of the following methods is a shortcut to direct use of the templating service?

A.   renderTemplate

B.   renderView

C.   renderControl

D.   renderPage

45: Is a "front controller" the same as the "controllers"?

A.   TRUE

B.   False

46: _______ is a container for key/value pairs.

A.   ParameterCase

B.   ParameterBag

C.   ParameterBatch

D.   ParameterGroup

47: A __________ is a short PHP script that lives in the web directory of your project.

A.   Front Controller

B.   Back Controller

C.   All of these

D.   Controller

48: Choose the best reason why the following autoloading sequence will not run properly: Class Name: Smarterer\HelloBundle\Controller\HelloController Path: src/Smarterer/Controller/HelloController.php

A.   Class Name is used in place of Class ID

B.   The class name and the path to the file do not follow the same sequence

C.   All of these

D.   The class name and the path to the file follow the same sequence

49: what is repository in Symfony ?

A.   a class that work with all the repositories in a bundle

B.   a class which extends EngineRepository

C.   a symfony file for saving test classes

D.   a class that work with entity for processing data

E.   the main directory of entities

50: Choose the best description of the following sequence (where //LINE BREAK// indicates a new line in the sequence): # app/config/config_test.yml //LINE BREAK// # ... //LINE BREAK// swiftmailer: /linebrea //LINE BREAK// disable_delivery: true

A.   It shows the swiftmailer is configured to deliver emails in the live environment

B.   It shows the swiftmailer is configured to deliver emails in the test environment

C.   It shows the swiftmailer is NOT configured to deliver emails in the live environment

D.   It shows the swiftmailer is NOT configured to deliver emails in the test environment