0% found this document useful (0 votes)
415 views

Reponse Test PHP

1. Validation constraints in Symfony can apply to class variables, classes, and methods but not loops or local variables. 2. Given the composer.json requiring Symfony 2.8, composer install would install the last available version starting with 2.8. 3. Symfony's ORM uses DQL as its query language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
415 views

Reponse Test PHP

1. Validation constraints in Symfony can apply to class variables, classes, and methods but not loops or local variables. 2. Given the composer.json requiring Symfony 2.8, composer install would install the last available version starting with 2.8. 3. Symfony's ORM uses DQL as its query language.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

1- What type of element can validation constraint apply to ?

(php/symphony)
a. Class variable
b. While loop
c. Class
d. File
e. Local variable
f. Method

2- In your project, you have the following composer.json (php/symphony)

{
...
"require" : {
"symfony/symfony": "2.8"
}
...
}
With the following informations given, what version of Symfony could be installed if you run
the following command : $ composer install
a. The last available version starting with 3.X.X
b. It depends on composer.lock
c. The last available version starting with 2.X.X
d. The most recent symfony version avaialable
e. The last available version starting with 2.8.X

3- What is the name of the language used in Symfony’s tightly integrated ORM
component (php/symfony)
a. JQL
b. MQL
c. DQL
d. HQL

4- What is a flashbag in Symfony (php/symfony)


a. It is a session data that stores snapshots with information on passed events.
This can be used during development for debugging purposes.
b. It is a cookie with user information. It can be used to return the user to a
previous state.
c. It is a cookie with data that expires 5 minutes after creation.
d. It is a session data that expires after it is retrieved

5- Given a website with url https://example.com, default language set to de (German)


and the following code : (php/symfony)

// src/Controller/CompanyController.php
namespace App\Controller
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/home")
*/
class StaticPagesController
{
/**
* @Route({
* "de": "/kontakt"
* "en": "/contact"
* }, name="contact_us"
*/
public function contact(){
// ...
}
}
What would be the url for the english language version of the « contact us » page ?
a. https://example.com/de/home/kontakt
b. https://example.com/en/home/contact
c. https://example.com/de/home/contact
d. https://example.com/home/en/contact
e. https://example.com/home/contact
f. https://example.com/home/en/kontakt

6- In Symfony there are two different types of DataTransformers. What are they
(php/symfony)
a. Action and view Transformers
Action Transformers are used to sepcify different actions to call, based on the
form data.
View Transformers are used to map the data that is shown in the form to
normalized data.
b. Model and View Transformers
Model Transformers are used to map data from the form to an object ande
vice-versa.
View Transformers are used to map the data that is shown in the form to
normalized data.
c. Action and Model Transformers
Action Transformers are used to specify different actions to call, based on the
form data.
Model Transformers are used to map data from the form to an object and the
reverse.

7- Among the following options, which one is true on similarities between Event
Subscriber and an Event Listener (php/symfony)
a. They need to be defined in a specific directory (EventListener or
EventSubcriber) to be handled by Symfony.
b. They both can decide which events they will handle.
c. They only apply to the events they will handle.
d. They both need to be explicitly configured in-service configuration

8- What syntax should we use to execute statements in Twig (php/symfony)


a. {# #}
b. {{ }}
c. {% %}
d. { }
9- Which of these are valid form helper functions in twig templates ? (php/symfony)
a. form_row()
b. form_start()
c. form_show()
d. form_display()

10- What does the front controller app.php do by default ? (php/symfony)


a. Load classes
b. Initialize the application
c. Build the cache
d. Check the host to prevent invalid access
e. Load debug library
f. Handle HTTP requests
g. Render the view

11- Could configuration parameters contain array values ? (php/symfony)


a. Yes
b. No

12- How could we retrieve a POST parameter named ‘foo’ from the Request Object
$request ? (php/symfony)
a. $request->get(‘foo’) ;
b. $request->request->get(‘foo’);
c. $request->post(‘foo’)
d. $request->parameter(‘foo’)
e. $request->query->get(‘foo’)
f. $request->post->get(‘foo’)

13- How can you check if you can use a variable named ‘book’ from a twig template ?
(php/symfony)
a. {% if book exists %}
b. {% if book is present %}
c. {% if book is available %}
d. {% if book is defined %}

14- What is the proper way to include another template in your page ? (php/symfony)
a. {{ include(‘blog/custom.html.twig’, { ‘id’ : id }) }}
b. {{ import(‘blog/custom.html.twig’, { ‘id’ : id }) }}
c. {{ require(‘blog/custom.html.twig’, { ‘id’ : id }) }}
d. {{ add_view(‘blog/custom.html.twig’, { ‘id’ : id }) }}

15- Given the following code : (php/symfony)


What code should we add in order to save the product in order to save the product to
the database ?
a. $entityManager->save($product);
b. $entityManager->persist($product);
c. $entityManager->persist($product);
$entityManager->flush();
d. $entityManager->flush($product);

16- Which of the following examples shows how to load a service in a controller ?
(more than one answer expected) (php/symfony)
a. $this->getFromContainer(‘service.to.load’);
b. $this->get(‘service.to.load’)
c. $this->getContainer()->get(‘service.to.load’)
d. Passed as a parameter to the action, e.g :
public function getBooksAction(BooksService $booksService) {}

17- Given the following templates : (php/symfony)


base.html.twig

page.html.twig
What will be the title of the page when we load the page.html.twig template ?
a. John’s Shop
b. John’s Shop – Products for cats
c. Good products for your cat
d. Products for cats

18- Which of the following contains the logic needed for your application to render the
content of a page ? (php/symfony)
a. Router
b. Bundle
c. Entity
d. Controller

19- If you want to send a batch of emails after a certain response is returned to the
user, which kernel event would be most suitable for that ? (php/symfony)
a. kernel.terminate
b. kernel.reponse
c. kernel.controller
d. kernel.request

20- Is it possible to have multiple voters for a single action ? (php/symfony)


a. Yes, but we should change the default access decision strategy in our
configuration file.
b. Yes, we just need to define the voters and assign them to the action
c. No
d. Yes, but the voters should implement a specific interface

21- Is the user authenticated in all of the security firewalls after a successful login ?
(php/symfony)
a. Yes, if firewalls have the same value as the context option
b. Yes, if option shared is set to true
c. Yes, it happens automatically
d. No, it is not possible, firewalls are independent from each other
22- Consider the following entity : (php/symfony)

When would the setCreatedAtValue() method be invoked ?


a. Never: the lifecycle callbacks should be enabled with
@ORM\HasLifecycleCallbacks()
b. Never: the @ORM\PrePersist annotation does not exist
c. After the entity is persisted in the database
d. Before the entity is persisted in the database

23- Given the following code: (php/symfony)

class AddBookCommand extends Command


{
public function __construct( $requireTitle = true)
{
parent::__construct();

$this->requireTitle = $requireTitle ;
}

protected function configure(){


$this->setName('book:add')
->setDescription('adds a new book')
->addArgument('title',
$this->requireTitle ? InputArgument::OPTIONAL : InputArgument::REQUIRED, 'Book title');

protected function execute(InputInterface $input, OutputInterface $output){


$output->writeln('adding a new book');
$output->writeln('book added');
}

What will be the outcome of calling php bin/console book:add Titanic ? (php/symfony)
a. The console will output:
Adding new book..
Book added!
b. Exception: the title should be passed as –title=Titanic
c. Exception: missing method initialize()
d. Exception : the command will fail to execute, requireTitle propery is undefined

24- What does the function prints ? (php/symfony)

a. Foo Hello
b. PHP Fatal error: Too few arguments to function Bar::myPrint()
c. Foo Hello World
d. Bar Hello World
e. PHP Fatal error : Cannot redeclare Foo:myPrint()

25- In the file app/config/security.yml (php/symfony)


What keywords should replace WWW, XXX, YYY, ZZZ ?
a. request_matcher
b. providers YYY
c. firewalls ZZZ
d. encoders WWW
e. role_hierarchy XXX
f. access_control

26- What is the computational complexity of the following algorithm ? (complexité


algorithmique)

$animals = [
'cat' => [
15, 7, 8, 27, 11
],
'dog' => [
22, 3, 35
]
];

foreach ($animals as $key => $animal) {


sort($animals[$key]) ;
}

foreach ($animals as $key => $animal) {


echo sprintf("Nb animals of type %s : %d\n", $key, count($animal));
}

a. O(n^2)
b. O(n log(n))
c. O(n)
d. O(n^2 log(n))

27- In the code below, what type is the object retruned by the helloAction method ?
(php/symfony)
a. Symfony\Component\HttpFoundation\Response
b. Symfony\Component\HttpFoundation\Request
c. Symfony\Component\BrowseKit\Response
d. Symfony\Component\BrowseKit\Request
e. Symfony\Component\HttpFoundation\Response

28- What is displayed by this program ? (text field) (php/symfony)

Response: empty

29- Type the result displayed by this piece of code (text field) (php/symfony)

Response : 0

A rédiger : Si l’on souhaite faire une incrémentation il vaut mieux le faire au terme
d’une boucle
30- What Exception is raised in the class below ? (php/symfony)

a. Symfony\Component\Security\Core\Exception\InvalidArgumentException
b. \InvalidArgumentException
c. Symfony\Component\Security\Core\Exception\WrongArgumentException
d. AppBundle\Exception\InvalidArgumentException
e. AppBundle\Controller\InvalidArgumentException

31- Among these two solutions, which one do you prefer ? (Design patterns/SOLID)
a. Solution #2
b. Solution #1

32- What is the value of $cpt at the end of this algorithm ? (php/symfony)

a. 1
b. 2
c. 5
d. 3
e. 4
f. 0
g. 6

33- Which of the following options are key principles of a good unit test ? (php/tests
unitaires)
a. Self-Validating
b. Repeatable
c. User Oriented
d. Cover 100% of the code
e. Isolated
f. Easy to write

34- What group of HTTP codes handle the redirections ? (php)


a. 4XX
b. 3XX
c. 2XX
d. 5XX
e. 1XX

35- Which of the following options are not valid HTTP methods ? (php)
a. Update
b. REMOVE
c. DELETE
d. PATCH
e. GET
f. POST

36- Which of the following rituals exist in SCRUM methodology ? (scrum)


a. daily standup meeting
b. sprint devops
c. sprint backlog
d. continuous delivery
e. sprint demonstration
f. sprint retrospective

37- You have made some code changes to the file index.html locally. (git/versioning)
Which command will you execute if you want to see which code changes will be
added when you stage the file for a commit ?
a. git diff index.html
b. git status index.html
c. git show index.html
d. git show –diff index.html

38- What does the git commit command do ? (git versioning)


a. Commits all changes to the remote repository skipping the staging area
b. Commits all changes to the staging area
c. Commits the staged snapshot to the remote repository
d. Commits the staged snapshot to the local repository

39- When git clone <remote – repository> is executed, which files will be added to the
local working directory ? (git/versioning)
a. The latest version of the remote repository files on the most recently created
branch
b. The files of the first commit made to the remote repository on the master
branch
c. No files will be fetched, only an empty repository will be created
d. The latest version of the remote repository files on the master branch

40- What does the command git status do ? (multiple answers) (git/versioning)
a. It shows you code changes between two commits
b. It helps you check the state of your repository before committing changes so
that you don’t accidentally do a wrong commit
c. It lets you list the project history, filter it, and search for specific changes
d. It lets you see which changes have or have not been staged and which files
aren’t being tracked by Git.

41- Giving the following git status output: (git/versioning)

Which files will be stashed afeter running the command git stash ?
a. Only bower.json
b. myScript.js, bower.json and styles.css
c. myScript.js and bower.json
d. bower.json and styles.css
e. Only myScript.js
42- What step in the Git Flow allows your peers to review your code ? (git/versioning)
a. Peer checkup
b. Merge request
c. Pull rbase
d. pull request
e. Git change
f. Bug fix

43- From the above database schema, select what best describes the column
“customer_id” of the PURCHASE_ORDER table. (MySQL)

a. Index
b. Primary key
c. Blog
d. Foreign key

44- Modify the query list the number of customers per city. Only list the cities where the
number of customers within the city is two or more. (MySQL)
Only output the CITY and CUSTOMER COUNT columns in that order

Response :

SELECT COUNT(customer_id) FROM CUSTOMER WHERE COUNT(customer_id) >= 2


ORDER BY CUSTOMER.city ;

45- In the above database schema, what would best describe the ORDER_PRODUCT
table ? (multiple answers allowed) (MySQL)
a. There should be only one row per distinct “order_id” in this table.
b. The table may contain multiple different “order_id” for a given “product_id”
c. The table is a junction table
d. It allows a many-to-many relationship between PURCHASE_ORDER and
PRODUCT.

46- Based on the following HTML code : (HTML/CSS)

Which CSS selector(s) should you use to select the element whose id is equal to
“container” ? Check all possible answers.
a. @container
b. #container
c. .container
d. [id=”container”]
e. Container

47- Which of the following position property have the effect of “ The element is
positioned relative to its first positioned (not static) ancestor element”? (CSS)
a. static
b. absolute
c. fixed
d. relative
48- In CSS, padding is used to set : (CSS)
a. outer alignment
b. inner margins
c. outer margins
d. inner alignment

49- Which HTML attribute can be used to show a tooltip text when the mouse moves
over an element ? (HTML)
a. title
b. style
c. id
d. label
e. class
f. alt

50- In HTML, what should you add to a form field in order to disable it ? (HTML)
a. A disabled attribute
b. A readonly attribute
c. A readonly class
d. A disabled class
e. None of the above

51- In HTML5, how can I correct this element, so my non-standard attribute custom is
valid according to the W3C standard ? (HTML)
<div custom=”12”></div>
a. Non-standard attributes are forbidden
b. <div attributes=”custom:12”></div>
c. <div=”custom:1”></div>
d. <div data-custom=”12”></div>
e. Don’t change anything

52- The JavaScript language is : (Javascript)


a. Interpreted
b. Compiled
c. Transpiled

53- In JavaScript, what event is triggered when a <button> or <textarea> element loses
focus ? (Javascript)
a. onClick
b. onfocus
c. onfocuslost
d. ondblclick
e. onblur

54- Write the body of the helloProperties(obj) function. (Javascript)


This function takes an object obj such as this one :
{
john: 12,
brian: true,
doe: 'hi',
fred: false
}

And returns an array containing all of its properties, prefixed with “Hello-“, like
this:
[‘Hello-john’, ‘Hello-brian’,’Hello-doe’,’Hello-fred’]
obj is always a defined JavaScript object.

Reponse:
Var obj = function(name)
{
If(name == ‘john’)
{
Obj.name = 12;
}
Else if(name == ‘brian’)
{
Obj.brian= true;
}
Else if(name == ‘doe’)
{
Obj.doe = ‘hi;
}
Else if(name == ‘fred’)
{
Obj.fred = false;
}

Return map(‘Hello’.concat(‘ ‘, name));


}

55- Which of the following packages can be used to do e2e testing for AngularJS?
(JavaScript/testing)
a. karma
b. protractor
c. istambul
d. plumber
e. kanibal

56- What type of forms can we create with Angular ? (Angular)


a. Directive Forms
b. Active Forms
c. ReactiveForms
d. ComponentForms
e. Template Driven Forms
57- Given the following code, what will happen when this component is created ?
(Angular)

a. There will be no errors and the console will show “constructor ngOnInit
ngAfterViewInit”
b. There will be no errors but the ngAfterViewInit will not be executed and so
the ngAfterViewInit message will not be printed in the console
c. The code will compile but fall into error at runtime
d. The code will not compile because the afterViewInit interface is not declared

You might also like