Loading

Quipoin Menu

Learn • Practice • Grow

angular / Reactive Forms
mcq
Direction: Choose the correct option

Q1.

How do you create a form control in reactive forms?
A. `new FormControl('initialValue')`
B. `FormControl.create('value')`
C. `ngModel`
D. `[formControl]`
Direction: Choose the correct option

Q2.

Which directive links a `FormGroup` to a form in the template?
A. `ngForm`
B. `formGroupName`
C. `[formControl]`
D. `[formGroup]='myForm'`
Direction: Choose the correct option

Q3.

How do you link an input to a form control in reactive forms?
A. `ngModel`
B. `formControl`
C. `[formControl]='firstName'`
D. `formControlName='firstName'`
Direction: Choose the correct option

Q4.

What is `FormBuilder` used for?
A. To build forms in HTML
B. To submit forms
C. To simplify creating form controls and groups
D. To validate forms
Direction: Choose the correct option

Q5.

How do you add a form array (dynamic controls) in reactive forms?
A. Using multiple `FormGroup`s
B. Using `ngFor` with controls
C. Using `FormList`
D. Using `FormArray` class
Direction: Choose the correct option

Q6.

What is the difference between `formControl` and `formControlName`?
A. They are the same
B. `formControl` binds to a standalone control; `formControlName` binds within a FormGroup
C. `formControlName` is for models
D. `formControl` is for templates
Direction: Choose the correct option

Q7.

How do you set a value to a form control programmatically?
A. `control.update(value)`
B. `control.value = value`
C. `control.setValue(value)`
D. `control.patchValue(value)`
Direction: Choose the correct option

Q8.

What does `patchValue` do on a FormGroup?
A. Patches the group
B. Sets partial values
C. Updates a subset of controls with provided values
D. Updates all controls
Direction: Choose the correct option

Q9.

How do you listen to status changes in reactive form?
A. `control.onStatusChange`
B. `control.status`
C. `control.statusChanges` observable
D. `control.valueChanges`
Direction: Choose the correct option

Q10.

What is the purpose of `hasError` method?
A. Validates errors
B. Checks if any error exists
C. Checks if a specific error exists on the control
D. Checks for errors