Loading

Quipoin Menu

Learn • Practice • Grow

angular / Introduction to Services
mcq
Direction: Choose the correct option

Q1.

What is a service in Angular?
A. A directive
B. A component without a template
C. A class that encapsulates business logic and data
D. A module
Direction: Choose the correct option

Q2.

How is a service typically defined?
A. As a constant
B. As a function
C. As a module
D. As a class with @Injectable decorator
Direction: Choose the correct option

Q3.

What is the purpose of the `@Injectable()` decorator?
A. Defines a provider
B. Marks a class as available for dependency injection
C. Injects dependencies
D. Creates a service
Direction: Choose the correct option

Q4.

Why use services in Angular?
A. To handle events
B. To create templates
C. To share data and logic across components
D. To define routes
Direction: Choose the correct option

Q5.

What is a singleton service?
A. A service without dependencies
B. A single instance shared across the application
C. A service that creates a new instance each time
D. A service with one method
Direction: Choose the correct option

Q6.

What is the difference between a service and a component?
A. Components are services
B. Services have templates
C. Services handle logic/data; components handle UI
D. They are the same
Direction: Choose the correct option

Q7.

Can services have dependencies on other services?
A. Only in root
B. Yes, using DI in constructor
C. No, services must be independent
D. Only in modules
Direction: Choose the correct option

Q8.

What is the role of services in component communication?
A. Services route data
B. Services style data
C. Services act as a shared data store for components
D. Services render data
Direction: Choose the correct option

Q9.

Where should HTTP calls be made in Angular?
A. In services
B. In components
C. In directives
D. In pipes
Direction: Choose the correct option

Q10.

What is the typical naming convention for service files?
A. feature.service.ts
B. feature-service.ts
C. featureService.ts
D. service.feature.ts