Reponse Test PHP
Reponse Test PHP
(php/symphony)
a. Class variable
b. While loop
c. Class
d. File
e. Local variable
f. Method
{
...
"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
// 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
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 }) }}
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) {}
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
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)
$this->requireTitle = $requireTitle ;
}
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
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()
$animals = [
'cat' => [
15, 7, 8, 27, 11
],
'dog' => [
22, 3, 35
]
];
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
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
35- Which of the following options are not valid HTTP methods ? (php)
a. Update
b. REMOVE
c. DELETE
d. PATCH
e. GET
f. POST
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
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.
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 :
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.
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
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
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;
}
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
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