0
0
Angularframework~20 mins

Built-in pipes (date, currency, uppercase) in Angular - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Angular Pipes Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the rendered output of this Angular template?
Given the component property today = new Date('2024-06-15T12:00:00Z'), what will be displayed by this template?

<p>{{ today | date:'fullDate' }}</p>
Angular
<p>{{ today | date:'fullDate' }}</p>
ASaturday, June 15, 2024
BJun 15, 2024
C15/06/2024
D2024-06-15
Attempts:
2 left
💡 Hint
The 'fullDate' format shows the day of the week, month name, day, and year.
📝 Syntax
intermediate
2:00remaining
Which option correctly formats a number as US dollars with 2 decimals using Angular currency pipe?
You want to display the number 1234.5 as $1,234.50 in your template. Which pipe usage is correct?
Angular
<p>{{ amount | currency:??? }}</p>
Acurrency:'USD':'symbol':'1.0-0'
Bcurrency:'USD':'code':'1.0-0'
Ccurrency:'USD':'symbol':'2.0-2'
Dcurrency:'USD':'symbol':'1.2-2'
Attempts:
2 left
💡 Hint
The format string '1.2-2' means minimum 1 digit before decimal, minimum 2 decimals, maximum 2 decimals.
component_behavior
advanced
2:00remaining
What is the output of this Angular template using uppercase pipe?
Given the component property name = 'Angular', what will this template render?

<h1>{{ name | uppercase }}</h1>
Angular
<h1>{{ name | uppercase }}</h1>
AANGULAR
Bangular
CAngular
DAnGuLaR
Attempts:
2 left
💡 Hint
The uppercase pipe converts all letters to capital letters.
🔧 Debug
advanced
2:00remaining
What happens in this Angular template with null input?
Consider this template snippet:

{{ price | currency:'USD':'symbol':'1.2-2' }}

Given price = null in the component, what occurs and why?
Angular
{{ price | currency:'USD':'symbol':'1.2-2' }}
ASyntax error due to wrong pipe usage
BNo error; renders an empty string because the pipe returns null for null input
CRuntime error: Cannot read property 'toString' of null
DDisplays 'null' as string without formatting
Attempts:
2 left
💡 Hint
Angular currency pipe returns null for null or undefined inputs, which renders as empty string in the template.
🧠 Conceptual
expert
2:00remaining
How does Angular's date pipe handle timezone differences in output?
Given date = new Date('2024-06-15T12:00:00Z') and template {{ date | date:'short' }}, which statement is true about the displayed time?
Angular
{{ date | date:'short' }}
AThe time is always shown in UTC
BThe time is shown in the server's timezone
CThe time is shown in the browser's local timezone
DThe time is shown in GMT regardless of user location
Attempts:
2 left
💡 Hint
Angular date pipe formats dates according to the client environment.