Symfony Basic Interview Questions

1).The end product of a controller in Symfony is always the same – what is it?

a).a Symfony2 Response object
b).a Symfony2 Presentation object
c).a Symfony2 Request object
d).a Symfony2 HTML object

Answer:a Symfony2 Response object

2).The controller in Symfony creates a new Response object, whose first argument is the

a).content that should be used in the request
b).content that should be used in the response
c).a PHP file that should be used in the request
d).3 arguments that should be used in the response

Answer:content that should be used in the response

3).In order to use the render() method in Symfony, your controller must extend the

a).Router Class b).Config Class c).Render Class d).Controller class

Answer:Controller class

4).A _____ defines the URL (e.g. /about) to your page and specifies a controller (which is a PHP function) that Symfony2 should execute
when the URL of an incoming request matches the route path.
a).path b).home path c).route d).controller path


5).A controller in Symfony is a
a).a YAML function b).a PHP function c).a XML Config file d).None

Answer:a PHP function

6). Which of the following returns Symfony2 Response object back to the user?
a).Bundle b).Kernel c).Controller d).Model


7).Which of the following in Symfony is a directory that houses everything related to a specific feature, including PHP classes, configuration, and
even stylesheets and Javascript files?.
a).Bundle b).Router c).Controller d).Model


8).In Symfony, to create a bundle called AcmeHelloBundle, which of the following command need to be run?
a).$ php app/console generate:bundle –namespace=Acme –format=yml
b).$ php app/console generate:bundle –namespace=”/HelloBundle –format=yml
c).$ php app/console generate:bundle –namespace=AcmeHelloBundle/HelloBundle –format=yml
d).$ php app/console generate:bundle –namespace=Acme/HelloBundle –format=yml

Answer:$ php app/console generate:bundle –namespace=Acme/HelloBundle –format=yml

9).The Request class symfony is a simple object-oriented representation of the
a).HTTP request message b).HTML request message c).PHP request message d).TCP request message

Answer:HTTP request message

10).In symfony, the code where you interpret the request and create a response is the
a).Request b).Controller c).Router d).Interpreter


11).In Symfony, the routing configuration can be written in

a).YAML b).PHP c).XML d).All of the above

Answer:.All of the above

12).Symfony2 packages called ____________, which are fully functional applications that include the Symfony2 core libraries, a selection of useful bundles,
a sensible directory structure and some default configuration.
a).distributions b).binaries c).core libs d).composer


13).By default, the routing configuration file in a Symfony2 application is located at


14).In Symfony, The routing consists of two basic pieces: the _____, which is the URL that this route will match, and
a defaults array, which specifies the ________ that should be executed.


15).The goal of each controller in Symfony is to return a
a).Response object b).Request Object c).PHP Object d).None

Answer: Response