Skip to main content

Angular 4 Observables

Angular 4 Observables
The result of the Http.get method is an object, which is an example of an observable. Observables are part of a library called Reactive Extensions, produced by Microsoft, which is used by Angular to connect different parts of the appplication. [Essential Angular for ASP.NET Core MVC by Adam Freeman]

Below are Angular 4 Observables questions and answers for your practice.

1. You import Observable from rxjs/observable to be used within a component. Once you have it imported, you can create an observable object by using the following syntax, where 'vname' is an observable name:



2. Observables allow you to watch values for changes over time and also Observables can have multiple values over time.

A) True
B) False

3. We can subscribe to an observable using the . . . . . . . . The benefit of this is that Angular deals with your subscription during the lifecycle of a component. Angular will automatically subscribe and unsubscribe for you.

A) sync pipe
B) async var
C) async pipe
D) syn var

4. To use observables, Angular uses a third-party library called . . . . . . .

A) ng2-bootstrap
B) angular-cli
C) numeral
D) Reactive Extensions (RxJS)

5. Promises are more advanced than Observables.

A) True
B) False

6. Calls of the next actually deliver the data to it’s subscribers. During observable execution there can be an infinite calls to the observer.next(), however when . . . . . . . is called, the execution stops and no more data will be delivered to the subscribers.

A) observer.error()
B) observer.start()
C) observer.end()
D) observer.complete()

7. We subscribe to the observable ourselves using the actual . . . . . . method. The downside is that you have to manage the subscription yourself.

A) subscribe()
B) subs()
C) subscribed()
D) None of above

8. Observables help you manage . . . . . . . . data.

A) synchronous
B) asynchronous
C) Both asynchronous & synchronous
D) None of above

9. When you have a finite sequence, usually you don’t need to unsubscribe, for example when using the . . . . . . . .

A) finally()
B) date observable
C) HTTP service
D) timer observable

10. When you subscribe to an observer, each call of subscribe() will trigger it’s own independent setup for that given observable. Subscribe calls are shared among multiple subscribers to the same observable.

A) True
B) False

Answers

Comments

Popular posts from this blog

Conjunction Worksheet

Practice English Grammar Conjunctions with the below Conjunction worksheet. Apart from this Conjunction worksheet, you can also go through other Conjunction exercises: Conjunction exercise 1 , Conjunction exercise 2 . Co-ordinating Conjunctions A conjunction placed between words, phrases, clauses, or sentences of equal rank, e.g. and, but, or. [ Via ] Correlative Conjunctions They get their name from the fact that they work together (co-) and relate one sentence element to another. Correlative conjunctions include pairs like "both/and," "whether/or," "either/or," "neither/nor," "not/but" and "not only/but also". [ Via ] For example He'd rather run to school than walking. Identify Co-ordinating Conjunctions: 1. Many women and children came to see the movie. 2. I wrote to him, but she did not respond. 3. Her condition became worse, so she was taken to nearby hospital. 4. We should hire a cab, otherwise we will n...

50 Top DHCP Multiple Choice Questions and Answers

Below are the list of top 50 DHCP multiple choice questions and answers for freshers beginners and experienced DHCP Multiple Choice Questions and Answers 1. What is the purpose of the DHCP server? A � to provide storage for email B � to translate URLs to IP addresses C � to translate IPv4 addresses to MAC addresses D � to provide an IP configuration information to hosts Answer: D 2. How is the message sent from a PC2 when is first powers on and attempts to contact the DHCP Server? A � Layer 3 unicast B � Layer 3 broadcast C � Layer 3 multicast D � Without any Layer 3 encapsulation Answer: B 3. What is the default behavior of R1 when PC1 requests service from DHCP server? A � Drop the request B � Broadcast the request to R2 and R3 C � Forward the request to R2 D � Broadcast the request to R2, R3 and ISP Answer: A 4. Refer to the exhibit. Which rule does the DHCP server use when there is an IP address conflict? A. The address is removed from the pool until the conflict is resolved. B. Th...

PHP Constructors Multiple Choice Questions

PHP Constructors Multiple Choice Questions 1) PHP recognises constructors by the name . . . . . A) _construct B) __construct C) __constructor D) _constructor 2) In . . . . . constructors, it is important to remember that you have to call the parent constructor explicitly. A) Singleton B) secure C) public D) subclass 3) Constructor and destructor methods have no . . . . . . and are called automatically - they cannot be called explicitly and consequently their declarations need no access specifier. A) parameters B) destructor C) return value D) aproval 4) Unlike constructors, you cannot pass information to a destructor, because you are never sure when its going to be run. A) True B) False 5) You can invoke class constructors that don’t have any relation to the instantiated object by simply prefacing _constructor with the class name like A) classname::__construct() B) classname:__construct() C) classname=>__construct() D) classname->__construct() 6) . . . . . . is...