Loading

Quipoin Menu

Learn • Practice • Grow

angular / Components Overview
mcq
Direction: Choose the correct option

Q1.

What decorator is used to define a component?
A. @Component
B. @Directive
C. @Injectable
D. @NgModule
Direction: Choose the correct option

Q2.

What property in @Component defines the HTML selector?
A. selector
B. template
C. templateUrl
D. styleUrls
Direction: Choose the correct option

Q3.

How do you define an inline template for a component?
A. style: 'h1 {color: red;}'
B. template: '<h1>Hello</h1>'
C. inlineTemplate: true
D. templateUrl: './app.component.html'
Direction: Choose the correct option

Q4.

Where are component-specific styles defined?
A. component.css file only
B. styleUrls array or styles array
C. styles.scss
D. global.css
Direction: Choose the correct option

Q5.

What is the lifecycle of a component?
A. The template rendering process
B. The sequence of events from creation to destruction
C. The change detection cycle
D. The data binding flow
Direction: Choose the correct option

Q6.

What is the selector for the root component by default?
A. root
B. angular-app
C. app-root
D. my-app
Direction: Choose the correct option

Q7.

How do you use a component in a template?
A. By using its selector as an HTML tag
B. By importing it
C. By registering it
D. By calling it
Direction: Choose the correct option

Q8.

What is the relationship between a component and a directive?
A. Components are directives
B. Directives are components
C. They are unrelated
D. A component is a directive with a template
Direction: Choose the correct option

Q9.

Can a component have multiple selectors?
A. Yes, with multiple decorators
B. Yes, with array
C. Yes, with comma separation
D. No, only one selector
Direction: Choose the correct option

Q10.

What is the purpose of `changeDetection` property in @Component?
A. To change component detection
B. To configure how change detection works for the component
C. To enable/disable change detection
D. To detect changes in component