wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz sur MVC, PHP et GIT .

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What is the main responsibility of the Model in MVC?

a)

Manage the display of data to the user

b)

Contain business logic and data access

c)

Coordinate interactions between View and Model

d)

Handle HTTP requests and routing

2.

Which of these elements represents a common MVC anti-pattern?

a)

Use of a View Helper

b)

Template Inheritance

c)

Fat Controller

d)

Repository Pattern

3.

Which pattern is typically used as a single entry point in MVC web?

a)

Singleton Pattern

b)

Factory Pattern

c)

Front Controller Pattern

d)

Observer Pattern

4.

True or False: In a web MVC architecture, the View can directly query the database.

a)

True

b)

False

5.

What is the main difference between traditional MVC (Desktop) and MVC Web?

a)

MVC Web does not have a Model

b)

MVC Web uses the Front Controller pattern

c)

Traditional MVC does not have a Controller

d)

There is no difference

6.

What is the main role of a 'View Helper'?

a)

Manage the database connection

b)

Execute complex queries

c)

Assist the View with presentation tasks

d)

Validate user data

7.

Which of these elements is NOT part of the typical lifecycle of an MVC request?

a)

Routing to the appropriate controller

b)

Direct querying of the database by the View

c)

Processing by the Model

d)

Rendering by the View

8.

Which architecture is often considered an evolution of MVC?

a)

MVVM (Model-View-ViewModel)

b)

MVP (Model-View-Presenter)

c)

ADR (Action-Domain-Responder)

d)

All of these answers

9.

Which PSR standardizes the autoloading of classes in PHP?

a)

PSR-0

b)

PSR-1

c)

PSR-2

d)

PSR-4

10.

How are data typically passed from a controller to a view in PHP MVC?

a)

Global variables

b)

PHP sessions

c)

Associative array passed to the template system

d)

Shared database

11.

What is the main advantage of the Repository Pattern in an MVC architecture?

a)

Improve database performance

b)

Separate data access logic from business logic

c)

Reduce the number of files

d)

Simplify routing

12.

True or False: Dependency injection violates the separation of concerns principle.

a)

True

b)

False

13.

Which design pattern is often used to create complex Vue objects?

a)

Singleton Pattern

b)

Factory Pattern

c)

Observer Pattern

d)

Decorator Pattern

14.

Which method is recommended to secure routes against injections?

a)

Disable JavaScript

b)

Validation and sanitization of parameters

c)

Use only static routes

d)

Ignore 404 errors

15.

What is the main role of a Data Transfer Object (DTO)?

a)

Manage database transactions

b)

Transport data between layers without business logic

c)

Create user interfaces

d)

Validate user input

16.

Which of these elements is a good practice for error management in MVC?

a)

Display SQL errors directly to the user

b)

Use exceptions and a centralized error handler

c)

Hide all errors with @

d)

Log only critical errors

17.

Which SOLID principle is violated when a controller handles authentication, validation, and business logic at the same time?

a)

Open/Closed Principle

b)

Liskov Substitution Principle

c)

Interface Segregation Principle

d)

Single Responsibility Principle

18.

How is the Dependency Inversion Principle applied in an MVC controller?

a)

By inheriting from multiple classes

b)

By depending on abstractions rather than concrete implementations

c)

By avoiding any dependency

d)

By using singletons

19.

True or False: The Interface Segregation Principle encourages the creation of large and generic interfaces.

a)

True

b)

False

20.

Which of these scenarios illustrates a violation of the Liskov Substitution Principle?

a)

A Repository that extends a base class but does not support all its methods

b)

A controller that uses dependency injection

c)

A View that inherits from a base template

d)

A Model that implements an interface

21.

How does the Interface Segregation Principle improve testability?

a)

By making classes more complex

b)

By making it easier to mock specific dependencies

c)

By reducing the number of interfaces

d)

By forcing the use of inheritance

22.

What advantage does respecting the SOLID principles bring to an MVC project?

a)

Code more difficult to maintain

b)

Decrease in testability

c)

Increase in coupling between components

d)

Better scalability and maintainability

23.

Which Git workflow is recommended for collaborative development on features?

a)

Feature Branch Workflow

b)

Trunk-Based Development only

c)

No branching

d)

Only one developer at a time

24.

Which type of commit best describes "Ajout de la validation dans le contrôleur UserController"?

a)

feat: add validation to UserController

b)

fix: stuff

c)

chore: update

d)

test: changes

25.

True or False: Sensitive configuration files (such as .env) should be committed to Git.

a)

True

b)

False

26.

Which element should be included in a Pull Request template for an MVC project?

a)

List of architectural changes

b)

Photos of the developer

c)

Personal criticisms

d)

No description

27.

What is the best practice for database migrations in a collaborative workflow?

a)

Each developer creates their own tables

b)

Migrations are versioned and applied in order

c)

No migration system

d)

Direct modification of the production database

28.

How to manage PHP dependencies in a versioned project?

a)

Commit the vendor/ folder

b)

Use composer.json and .lock without committing vendor/

c)

Do not use a dependency manager

d)

Manually copy the files

29.

What is the advantage of using Conventional Commits?

a)

Automatic generation of CHANGELOG

b)

Make messages more vague

c)

Avoid responsibility

d)

Nothing, it's just a trend

30.

Which approach is recommended for code review in an MVC project?

a)

Review only the controller

b)

Ignore the tests

c)

Checklist covering all layers (Model, View, Controller)

d)

Approve without looking