MCQs > IT & Programming > Symfony2 MCQs > Basic Symfony2 MCQs

Basic Symfony2 MCQ

1. What must a Symfony Controller return?

Answer

Correct Answer: Response object

Note: This Question is unanswered, help us to find answer for this one

2. Who develop Symfony2 framework ?

Answer

Correct Answer: SensioLabs

Note: This Question is unanswered, help us to find answer for this one

3. What is the correct syntax to secure a controller for users with ROLE_ADMIN

Answer

Correct Answer: @Security("has_role('ROLE_ADMIN')")

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Voters

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: app/config/config.yml

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: {% if a is sameas(b)) %}

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Configure server level defaults

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: PHP

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Use a CompilerPass to access the container definitions

Note: This Question is unanswered, help us to find answer for this one

10. How do you avoid running out of memory when executing bulk inserts with Doctrine? (Doctrine\ORM\EntityManager $em)

Answer

Correct Answer: Use $em->clear();

Note: This Question is unanswered, help us to find answer for this one

11. Which base class extend to symfony default test classes ?

Answer

Correct Answer: WebTestCase

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: twig:lint

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

14. Which parameter is not available in security.yml ?

Answer

Correct Answer: All of these are available

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: php app/console generate:bundle --namespace=RSmith/Bundle/NotificationBundle --bundle-name=RSmithNotificationBundle

Note: This Question is unanswered, help us to find answer for this one

16. 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?

Answer

Correct Answer: Custom route loader

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Creates metadata from existing database

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: app/autoload.php

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: _welcome: path: / defaults: { _controller: SmartererDemoBundle:Main:homepage }

Note: This Question is unanswered, help us to find answer for this one

20. What is the specific workflow of Functional Tests?

Answer

Correct Answer: 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

Note: This Question is unanswered, help us to find answer for this one

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

Answer

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

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: crawler

Note: This Question is unanswered, help us to find answer for this one

23. 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

Answer

Correct Answer: It shows the swiftmailer is NOT configured to deliver emails in the test environment

Note: This Question is unanswered, help us to find answer for this one

24. what is repository in Symfony ?

Answer

Correct Answer: a class that work with entity for processing data

Note: This Question is unanswered, help us to find answer for this one

25. 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

Answer

Correct Answer: The class name and the path to the file do not follow the same sequence

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Front Controller

Note: This Question is unanswered, help us to find answer for this one

27. _______ is a container for key/value pairs.

Answer

Correct Answer: ParameterBag

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: renderView

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: (all of these)

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: A map from a URL path to a controller

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: remove()

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: $this->get('name_service');

Note: This Question is unanswered, help us to find answer for this one

34. 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?

Answer

Correct Answer: isSecure()

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Use Composer or Download an Archive

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

38. What defines a URL to a page?

Answer

Correct Answer: route

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: controller

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Locally in the bundle in the Resources/config/services.yml

Note: This Question is unanswered, help us to find answer for this one

41. is it possible to define a form like a service ?

Answer

Correct Answer: TRUE

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

44. What is the purpose of the _controller parameter in routing?

Answer

Correct Answer: It tells Symfony which controller should be executed when a URL matches a specific route

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Bundle

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: AppKernel

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: It forces the secure route to always use HTTPS

Note: This Question is unanswered, help us to find answer for this one

48. What tag is used for template inheritance?

Answer

Correct Answer: {% extends %}

Note: This Question is unanswered, help us to find answer for this one

49. What are the three parts of the logical controller name?

Answer

Correct Answer: bundle:controller:action

Note: This Question is unanswered, help us to find answer for this one

50. What are the 3 environments a Symfony2 project BEGINS with?

Answer

Correct Answer: test, dev, and prod

Note: This Question is unanswered, help us to find answer for this one

51. How do you disable CSRF protection?

Answer

Correct Answer: Set csrf_protection to false

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: composer

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: integer

Note: This Question is unanswered, help us to find answer for this one

54. Which of the following field types are supported in Doctrine?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Twig

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Request

Note: This Question is unanswered, help us to find answer for this one

57. Where is the AppKernel class stored?

Answer

Correct Answer: The app/ directory

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: autoloader

Note: This Question is unanswered, help us to find answer for this one

59. Which of the following directories contains any publicly accessible files?

Answer

Correct Answer: web/

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: // 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><b

Note: This Question is unanswered, help us to find answer for this one

61. Where is the routing configuration file located?

Answer

Correct Answer: app/config

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: HttpFoundation

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: forward()

Note: This Question is unanswered, help us to find answer for this one

64. Symfony2 is only supported on:

Answer

Correct Answer: PHP 5.3.3 and up

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: generateURL()

Note: This Question is unanswered, help us to find answer for this one

67. What Symfony2 environment is used to run unit tests?

Answer

Correct Answer: test

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Routing

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: Assetic

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

71. The Dependency Injection component allows you to

Answer

Correct Answer: Standardize and centralize the way objects are constructed in your application

Note: This Question is unanswered, help us to find answer for this one

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

Answer

Correct Answer: EqualTo

Note: This Question is unanswered, help us to find answer for this one