free-tech

QCM Symfony


1- Which repository do you use to start a new symfony project?

-->Symfony/website-skelton
-->Symfony/skelton
-->Symfony/framework-standard-edition-edition
-->Symfony/symfony

2-what is symfony flex?

--> a symfony component that helps to autowire service
--> a composer plugin that helps to install/remove bundles
--> a dctrine extension that create a bridge  between Mysql and Mongodb
--> a symfony package that helps easy to switch between different envioronnemts

3-Does symfony follow Semantic Versionning?

-->Yes, it follows Semantic Versioning starting with version 4.0
--> Yes
--> No

4-What should the action from controller to return?

-->Twig template
--> a view object 
--> a response object
--> any object

5-What is FlashBag?

-->An intergration of adobe Flash in Twig
-->A storage where messages can be added and retrieved
-->An object where request data is stored
-->An object where all from errors are stored

6- if no methods are specified for a specific route, what methods will be accepted?

--> Only Get methods
--> get and post methods
--> Only safe methods: Get, options and head
--> All methods

7- how to get the value of query request param with name=foo from the next  rquest  path : /page?foo=bar?

-->$request->query->get('foo')
-->$request->request->get('foo')
-->$request->get->get('foo')
-->$request->get('foo')

8- How to get the current route name  in a twig template?

-->request.get('_route')
-->request.route.name
-->this.get('route_name')
-->app.request.get('_route')

9-How to concat string in twig?

-->'string'+'otherstring'
-->'string'.'otherstring'
-->'string'~'otherstring'

10-Supposing you have a form with next config:
public function configureOptions(OptionResolver $resolver){
$resolver->setDefauls([
'data_class' => User::class]);
is it possible to add to the form the fields that do not exist in the user entity ?

-->No 
-->Yes, by using custom option with the true value
-->Yes, by using the mapped option with the false value
--> yes, without any specific config

11- what does the error_building form option do?

-->it hides errors for specific fields
-->it passes errors to the parent element
-->it groups similar errors
-->it activates multiples errors for a specific fileds

12- supposing u have an arry of numbers and u wnat to check that each number is between 20 and 100 , how can u do that?

-->@Assert\All({ @Assert\Range(min=20, max=100)})
-->@Assert\Collection(min=20, max=100)
-->@Assert\Range(min=20, max=100,each=true)
-->@Assert\Range(min=20, max=100,all=true)

13- How dependencies can be injected?

-->Contructor
-->Setter
-->Public Property
-->Constant
-->Protected Property

14- what the main benifit of the lazy services?

-->The create cleaner code.
-->They speed up the compilation of cache.
-->The delay the instantiation of he "heavy" objects

15-Given a default configuration if u cal the same service twice do u receive the instance of the same object.

-->yes
-->no , u receive different instances of different objects

16-what's happen if the autoconfigure option is activated in the services.yaml file?

--> services are autoaticaly injected
--> service are autoamtically tagged by the classe definition
--> an error will occur, because the autoconfigure option does not exist

17- what are secuirty encoders used for?

-->encoding user pwd via a speific algorithm
-->anonymizing any type of information
-->Encrypting request and response data
-->activating https protocol

18- in a functional tests extended from The WebTestCase class, how can you create a client that makes requests to the symfony application?

-->static::createClient()
-->$this->container->get('test_client')
-->$this->get('test_client')

19- does this code create a real http request? static:createClient()->request->('GET','hello-world')

-->Yes, if the selenium package is intalled
-->No, it just simulate the request
-->Yes, if it uses guzzle to perform a real http request

20- what is the format of the bin/consome file?
-->bin file
-->plan php file
-->phar file
-->twig file