option
Cuestiones
ayuda
daypo
buscar.php

Controllers

COMENTARIOS ESTADÍSTICAS RÉCORDS
REALIZAR TEST
Título del Test:
Controllers

Descripción:
Information about Controllers

Fecha de Creación: 2025/11/07

Categoría: Ocio

Número Preguntas: 41

Valoración:(0)
COMPARTE EL TEST
Nuevo ComentarioNuevo Comentario
Comentarios
NO HAY REGISTROS
Temario:

What is the main role of a controller in backend development?. To store data permanently in the database. To handle client requests and return appropriate responses. To design the frontend interface.

In the MVC (Model–View–Controller) architecture, what does the controller primarily manage?. The database connection logic. The visual presentation of data. The flow of data between the model and the view.

A controller should directly contain business logic. True. False.

Which of the following best describes a controller in backend frameworks like Express.js or Spring Boot?. A component that defines endpoints and how requests are handled. A background service that runs periodic jobs. A database schema definition file.

Which statement is NOT true about controllers?. They handle HTTP requests. They directly manage database transactions. They return responses to clients.

In a RESTful API, what is the main purpose of a controller?. To define endpoints for CRUD operations on resources. To design the user interface. To execute scheduled background tasks.

The controller acts as the central component that connects routes, middleware, and services in a backend application. True. False.

Which of the following best describes the internal structure of a controller?. Routes, request handlers, validation, and response methods. Database tables, foreign keys, and indexes. HTML templates and CSS files.

In most frameworks, each controller is usually responsible for a specific resource or module (e.g., UserController, ProductController). True. False.

Which of the following elements should not usually be found inside a controller?. Route definitions. Business logic computations. Input validation and response formatting.

In Express.js, which of the following correctly represents a controller structure?. A function that handles a request and sends a response. A class that compiles frontend assets. A middleware for error handling only.

The “components” of a controller usually include decorators, handler functions, and dependency injections (in frameworks like NestJS). True. False.

Which of the following best represents the correct hierarchy or structure inside a backend project?. Route → Controller → Service → Repository. Controller → Router → Service → View. Service → Controller → Database → Router.

What is the main benefit of separating controllers by their structure and components?. It reduces the number of HTTP requests. It increases modularity, readability, and maintainability. It makes the application slower but more secure.

Which of the following correctly represents the typical flow of a request in a backend system?. Client → Database → Controller → Service → Response. Client → Router → Middleware → Controller → Service → Response. Router → Controller → Client → Middleware → Response.

A controller is the first component to receive a client request in a backend application. True. False.

In the request flow, what is the controller’s main task?. To directly query and modify the database. To interpret incoming requests and coordinate responses. To compile and serve frontend assets.

During a request lifecycle, where does input validation usually occur?. Before reaching the controller (middleware) or inside the controller. Only inside the service layer. After the response is sent to the client.

Once the controller gets data from the service, it’s responsible for formatting and sending the final response to the client. True. False.

Which of the following steps happens immediately before the controller is executed?. Service layer executes business logic. Router maps the incoming request to the correct controller function. Response is sent to the client.

What happens after the controller finishes processing a request?. The controller shuts down the server. The controller sends the response back to the client. The middleware restarts the request cycle.

Which of the following best describes the main responsibility of a controller?. To handle the communication between the client and the backend logic. To execute database queries directly. To render frontend views and CSS files.

Controllers should validate incoming data before sending it to the service layer. True. False.

Which of the following tasks should a controller not perform?. Call a service method to handle business logic. Manage complex database queries and transactions directly. Format responses before sending them to the client.

In the request–response cycle, what is one of the controller’s key responsibilities?. Listening for incoming requests and determining which logic to execute. Monitoring the database for changes. Compiling source code into machine code.

One of the controller’s core responsibilities is to handle exceptions and send proper error messages to the client. True. False.

What is the benefit of keeping controllers focused on their core responsibilities?. It improves code readability, testability, and separation of concerns. It makes controllers more complex but faster. It reduces the number of endpoints an API can handle.

Which of the following correctly represents a controller’s order of operations?. Validate input → Call service → Handle result → Send response. Call service → Validate input → Send response → Log data. Send response → Validate input → Call service.

Which of the following components is directly responsible for sending requests to the controller?. Service layer. Router. Repository.

The controller communicates directly with the database to retrieve data. True. False.

Which of the following best describes the relationship between controllers and services?. The service calls the controller to display the UI. The controller delegates business logic to the service. The controller defines the data schema for the service.

In a backend flow, what comes after the controller receives a request?. The middleware processes the response. The controller passes data to the service layer for processing. The router sends another request.

Middlewares can execute both before and after a controller handles a request. True. False.

Which of the following correctly shows how these components interact in order?. Client → Middleware → Router → Controller → Service → Repository → Database → Response. Client → Repository → Service → Controller → Router → Database → Response. Client → Router → Controller → Middleware → Database → Response.

Which of the following is a common type of controller in backend frameworks?. Entity Controller. RESTful Controller. CSS Controller.

A controller that handles multiple unrelated responsibilities is a good design choice. True. False.

Which of the following types of controllers is typically used for view rendering (e.g., returning HTML templates)?. REST Controller. MVC Controller. Service Controller.

When should you use a RESTful controller?. When exposing an API that manages resources like users or products. When designing static HTML web pages. When writing frontend JavaScript logic.

You should avoid using a controller for simple scripts or one-off command-line tasks. True. False.

Which type of controller is ideal for handling complex API operations that involve multiple services or integrations?. Aggregation Controller. Authentication Controller. Static Controller.

When is it inappropriate to use a controller?. When handling user login requests. When performing scheduled background tasks (cron jobs). When managing product-related endpoints.

Denunciar Test