Loading

Quipoin Menu

Learn • Practice • Grow

angular / ngClass and ngStyle
mcq
Direction: Choose the correct option

Q1.

What does `[ngClass]` directive do?
A. Creates new CSS classes
B. Changes class definitions
C. Dynamically adds or removes CSS classes
D. Styles inline
Direction: Choose the correct option

Q3.

What does `[ngStyle]` directive do?
A. Creates style sheets
B. Styles the component
C. Dynamically sets inline styles
D. Links to CSS files
Direction: Choose the correct option

Q8.

What is the difference between `ngClass` and `class` attribute?
A. They are the same
B. `ngClass` dynamically adds/removes; `class` is static
C. `ngClass` is static
D. `class` is dynamic
Direction: Choose the correct option

Q9.

What happens if you use both `[class]` and `[ngClass]` on same element?
A. Only `[ngClass]` works
B. Only `[class]` works
C. Error occurs
D. They merge, but be cautious of conflicts
Direction: Choose the correct option

Q10.

How do you conditionally apply multiple styles with `ngStyle`?
A. Use multiple `[style]` bindings
B. Pass an object with style names as keys and conditional values
C. Use CSS classes
D. Use `style` attribute