Pipes transform displayed values within a template. A pipe takes in data as input and transforms it to the desired output. [via]
Practice your Angular 4 Pipes skills by answering below Angular 4 Pipes multiple choice questions with answers.
1) Just like filters in AngularJS, pipes are intended to encapsulate all the data transformation logic.
A) True
B) False
2) Using SlicePipe, answer the below question:
var = "abcdefghijk"; {{var | slice:3:-3}}A) defghi
B) defgh
C) kjih
D) abc
3) The Angular pipes differ in functionality from simple case changing to date and internationalization, but most importantly, you can't write your own pipes.
A) True
B) False
4) The number pipe is location-sensitive, which means that the same format argument will produce differently formatted results based on the . . . . . . .
A) user's format setting
B) user's currency setting
C) user's locale setting
D) all of above
5) One common thing between all the pipes is that all return exactly the same result each time we apply them to the same value and pass them the same set of arguments. Such pipes that hold the referential transparency property are called . . . . pipes.
A) pure
B) impure
C) reference
D) none of above
6) Which of the following is not built-in pipe in Angular
A) DatePipe
B) CurrencyPipe
C) DataPipe
D) PercentPipe
7) The . . . . . decorator allows us to define the pipe name that is globally available for use in any template in the across application.
A) @pipeName
B) @pipeDeco
C) $Pipe
D) @Pipe
8) The . . . . . . . filter waits for a promise and returns the most recent value received. It then updates the view.
A) sync
B) async
C) promise
D) custom
9) The pure decorator property is used to tell Angular when to call the pipe’s transform method. The default value for the pure property is . . . . . .
A) False
B) True
10) If you chain multiple pipes together, they are executed . . . . .
A) in parallel
B) LIFO order
C) in the order in which you specify them
D) none of above
Answers
1) a, 2) b, 3) b, 4) c, 5) a, 6) c, 7) d, 8) b, 9) b, 10) c
No comments:
Post a Comment