Elance Smyfony2 Test Answers



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

EqualTo
All of these are supported
NotEqualTo
UniqueEntity

 

 

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

TRUE
False

 

 

Which base class extend to symfony default test classes ?

DefaultTestCase
UnitTestCase
FunctionalTestCase
BaseTestCase
WebTestCase

 

 

_______ is a container for key/value pairs.

ParameterCase
ParameterGroup
ParameterBag
ParameterBatch

 

 

Symfony2 is only supported on:

PHP 5.1.2 and up
PHP 5.3.3 and up
PHP 4.3.3 and up
PHP 4.1.2 and up

 

 

What tag is used for template inheritance?

{% extends %}
{% child %}
{% parent %}
{% inherit %}

 

 

is it possible to define a form like a service ?

FALSE
TRUE

 

 

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

Translation
HttpFoundation
Routing
ClassLoader

 

 

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

Use Composer or Download an Archive
Download an Archive or use Installer
None of these
Use Composer or Installer

 

 

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?

isSafe()
isSecure()
forward()
indexAction()

 

 

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

True
FALSE

 

 

What defines a URL to a page?

path
route
model
controller

 

 

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

True
False

 

 

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

view
route
model
controller

 

 

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

TRUE
False

 

 

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

False
True

 

 

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

False
True

 

 

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

$serviceTest = getInstance('name_service');
$serviceTest = get('name_service')
$this->serviceContainer.get('name_service');
$this->get('name_service');
$this->getInstance('name_service');

 

 

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

Locally in the bundle in the Resources/config/services.yml
Locally in the bundle in the Sources/config/server.yml
None of these
Locally in the bundle in the Sources/config/services.yml

 

 

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

A simple object-oriented representation of the HTTP request message
A container for key/value pairs
A map from a URL path to a controller
A map from a controller to a URL path

 

 

What Symfony2 environment is used to run unit tests?

prod
dev
work
test

 

 

What is the purpose of the _controller parameter in routing?

It tells Symfony how to access another controller internally
It tells Symfony which container is used for key/value pairs
It tells Symfony which controller should be executed when a URL does not match a specific route
It tells Symfony which controller should be executed when a URL matches a specific route

 

 

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

send()
forward()
progress()
sent()

 

 

What are the three parts of the logical controller name?

controller:action:model
action:bundle:route
view:controller:model
bundle:controller:action

 

 

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

It forces the secure route to avoid using HTTPS
It forces the route to always use path /secure
It forces the secure route to always use HTTPS
It forces the route to never use path /secure

 

 

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

URLgenerator()
createURL()
generateURL()
URLcreate()

 

 

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

Application
Action
Asset
Bundle

 

 

What are the 3 environments a Symfony2 project BEGINS with?

app, test, and web
test, dev, and prod
app, test, and prod
test, src, and prod

 

 

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

tinyint
superint
boolean
integer

 

 

Where is the routing configuration file located?

app/Resources
app/src
app/config
app/console

 

 

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

None of these
{# app/Resources/views/layout.html.twig #} <!DOCTYPE html> <html> <head> <title>{% block title %}Default title{% endblock %}</title> </head> <body> {% block body %}{% endblock %} </body> </html>
// app/AppKernel.php public function registerBundles() { $bundles = array( ..., new Smarterer\HelloBundle\SmartererHelloBundle(), ); // ... return $bundles; }
// 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><body>Hello '.$name.'!</body></html>'); } }

 

 

How do you disable CSRF protection?

Set csrf_protection to false
Set csrf_protection to true

 

 

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

HttpFoundation
ClassLoader
Routing
Translation

 

 

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

class AppSrc
AppPhp
AppBundle
AppKernel

 

 

Where is the AppKernel class stored?

The app/ directory
The application/ directory
The class/ directory
The kernal/ directory

 

 

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

instantloader
autoupload
autoloader
instantupload

 

 

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

Bower
NuGet
Bundler
composer
Symfony2 DI

 

 

Which of the following directories contains any publicly accessible files?

src/
vendor/
app/
web/

 

 

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

Send
Call
Request
Inbound

 

 

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

Twig
Tree
Bark
Branch

 

 

Which of the following field types are supported in Doctrine?

All of these
Dates and Times
Strings
Numbers

 

 

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

remove()
trash()
flush()
delete()

 

 

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

Resources/config/
(all of these)
Tests/
Controller/

 

 

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

renderControl
renderView
renderTemplate
renderPage

 

 

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

False
True

 

 

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

Assets
Assetic
Doctrine
Crawlers

 

 

The Dependency Injection component allows you to

Parse the URL and determine which controller should be executed
Defining the Controller as a Service
Convert a Request to a Response
Standardize and centralize the way objects are constructed in your application

 

 

what is repository in Symfony ?

the main directory of entities
a class which extends EngineRepository
a class that work with entity for processing data
a class that work with all the repositories in a bundle
a symfony file for saving test classes

 

 

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

Back Controller
Front Controller
Controller
All of these

 

 

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

The class name and the path to the file do not follow the same sequence
All of these
The class name and the path to the file follow the same sequence
Class Name is used in place of Class ID

 

 

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

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

 

 

Which of the following shows the correct representation of the Twig function?

function renderResources() ( return this->container->get('templating') ->render("RSmithNotificationBundle:Notification:resources.html.twig"); )
public function renderResources() { return $this->container->get('templating') ->render("RSmithNotificationBundle:Notification:resources.html.twig"); }
renderResources() { return $this->container->get('templating') ->render("RSmithNotificationBundle:Notification:resources.html.twig"); }
None of these

 

 

In regard to testing, each time you make a request with the client a ______ instance is returned.

form
crawler
category
task

 

 

What does the command "app/console doctrine:mapping:import" do?

Raises an error, the command does not exist
Creates metadata from existing database
Creates getters and setters for entity properties
Creates entities from existing database

 

 

what is the first file that Symfony framework runs at startup for loading libraries ?

app/autoload.php
vendor/autoloader/config.php
vendor/autoloader.php
app/config/autoload.php
app/config/autoloader.php

 

 

What is the specific workflow of Functional Tests?

1. Make a request 2. Test the response 3. Click on a link or submit a form 4. Test the response 5. Rinse and repeat
1. Test the response 2. Make a request 3. Click on a link or submit a form 4. Make a request 5. Rinse and repeat
1. Make a request 2. Test the response
1. Test the response 2. Click on a link or submit a form 3. Repeat

 

 

Which of the following is the correct way to create a basic route configuration?

_start: path: / defaults: ( _controller: SmartererDemoBundle:Main:homepage )
_begin: path: / defaults: { _controller: SmartererDemoBundle:Main:homepage }
_welcome: path: / defaults: { _controller: SmartererDemoBundle:Main:homepage }

 

 

If you wanted to add routes to an application without including them in the Yaml file, which of the following would you need to use?

Custom route indicator
Custom route controller
Custom route loader
Custom route addition

 

 

Which of the following is correct when creating a bundle using the command line generator?

php app/console generate:bundle --namespace=RSmith/Bundle/NotificationBundle --bundle-name=RSmithNotificationBundle
namespace=RSmith/Bundle/NotificationBundle --bundle-name=RSmithNotificationBundle
php app/console create:batch --namespace=RSmith/Bundle/NotificationBatch --batch-name=RSmithNotificationBatch
php app/console generate:bundle --namespace=RSmith/Bundle/NotificationBundle

 

 

Which parameter is not available in security.yml ?

All of these are available
firewalls
providers
encoders
access_denied_url

 

 

Which of following console commands checks for syntax errors in Twig templates?

twig:error
twig:check
twig:lint

 

 

True of false: A controller is required when creating a static page.

False
True

 

 

Which configuration format is powerful but less readable than standard configuration formats?

HAML
YAML
XML
PHP

 

 

How can you dynamically configure Services declared in the Service Container ?

Use EventListeners to access the Service and change its configurations
Use a CompilerPass to access the container definitions
Implement the configurations in the Service constructor

 

 

What is the way around configuring the default charset and collation inside Doctrine?

Configure the path where your database file should be stored
You can configure these defaults inside of Doctrine
Configure server level defaults

 

 

Which of the following Twig codes is valid to check if a variable has the same value and the same type as another ?

{% if a is sameas(b)) %}
{% if a === b %}
{% if a == b %}
{% if a sameas b %}

 

 

In which of the following can the configuration of services in symfony be found?

app/config.yml
Resources/config/config.yml
app/config/services.yml
app/config/config.yml
app/services.yml

 

 

Which of the following is an authorization layer of the security component?

Firewalls
Voters
Routing
HTTP Authentication