Challenge - 5 Problems
Signal Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What is the output of this Angular signal example?
Consider this Angular standalone component using signals. What will be displayed in the browser?
Angular
import { Component, signal } from '@angular/core'; @Component({ selector: 'app-counter', standalone: true, template: `<p>Count: {{ count() }}</p>` }) export class CounterComponent { count = signal(5); }
Attempts:
2 left
💡 Hint
Remember that signals hold a value and you read it by calling the signal as a function.
✗ Incorrect
The signal is initialized with 5, and reading it with count() returns 5, so the template shows 'Count: 5'.
❓ state_output
intermediate2:00remaining
What is the value of the signal after this code runs?
Given this Angular code snippet, what is the final value of the signal 'name'?
Angular
import { signal } from '@angular/core'; const name = signal('Alice'); name.set('Bob'); name.update(current => current + ' Smith');
Attempts:
2 left
💡 Hint
The update function receives the current value and returns the new value.
✗ Incorrect
First, the signal is set to 'Bob'. Then update appends ' Smith' to the current value 'Bob', resulting in 'Bob Smith'.
📝 Syntax
advanced2:00remaining
Which option correctly creates a signal and reads its value?
Choose the code snippet that correctly creates a signal with initial value 10 and reads its value into a variable 'currentValue'.
Attempts:
2 left
💡 Hint
Signals are functions to read their value, not objects with a 'value' property.
✗ Incorrect
Option A correctly calls signal(10) to create and then calls count() to read the value. Others have syntax errors or wrong usage.
🔧 Debug
advanced2:00remaining
What error does this Angular signal code produce?
Analyze this code snippet. What error will Angular throw when running this?
Angular
import { signal } from '@angular/core'; const count = signal(0); console.log(count.value);
Attempts:
2 left
💡 Hint
Signals are functions, not objects with a 'value' property.
✗ Incorrect
No error occurs. Signals do not have a 'value' property, so count.value is undefined, and console.log outputs 'undefined'.
🧠 Conceptual
expert3:00remaining
How does Angular's signal system improve component reactivity?
Which statement best explains how Angular signals improve reactivity compared to traditional state management?
Attempts:
2 left
💡 Hint
Think about how signals track what uses their value and update selectively.
✗ Incorrect
Angular signals track which parts of the UI use their value and update only those parts automatically, improving efficiency.