Tuesday, 2 October 2018

Jasmine - Test Framework - Quiz - 3

Welcome back, let's move on post Part-2


1. Which of the following are possible states of Promise execution?
A.
Pending
B.
Resolve
C.
Reject
D.
Only B & C



2. Observable does not emits the following class of output, which can be processed asynchronously? 

A.
value
B.
error
C.
Completion status
D.
Reject



3. Resolve method in Promise used to resolve the promise in form of _________ resolution.
A.
error
B.
Successful



4. Name the method to process the value emitted by Observable.
A.
Subscribe
B.
Listener


5. Failed to load http://localhost:8080/api-endpointResponse to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.The response had _____ http status code.
A.
404
B.
403


6. ____ is a mechanism that uses additional HTTP headers to let a user agent gain permission to access selected resources from a server on a different origin (domain) than the site currently in use.
A.
Cross-Origin Resource Sharing 
B.
Access-Control-Allow-Origin


7.
getRx(): Promise<Rx[]> {
        return this.httpClient.get(this.rxUrl, {observe: 'response', headers:  new HttpHeaders().set('Authorization', 'Bearer ' + Cookie.get('access_token'))})
            .toPromise()
            .then(this.extractData)
            .catch(err => {
                return Promise.reject(err.error || 'Server error');
            });}
What is purpose of observe: response?
To instruct the server to return 
A.
full response including data 
B.
including header information comprising of special headers
C.
Or including status codes to indicate certain conditions.
D.
All of the above


8. Angular considers all data as untrusted data. Thus, by default, it sanitises all data. 

A.
true
B.
false

9. A security vulnerability in a web app, refers to an attacker sending a script to another user by means of injecting the malicious script into a trusted website.

A.
Cross-site scripting (XSS)
B.
Dependency Injection Back doors



10.___ should be set appropriately to avoid XSS attacks

A.
X-client-data
B.
Content security policy (CSP)




Looking for correct options?

Here are the answers:
1.A,B & C; 2.D; 3.B; 4.A; 5.B; 6.A; 7.D; 8.A; 9.A; 10.B;



Jasmine Design by Test : Book available at Amazon.in |  Flip kart |, e-book @Pothi.com

Thank you!


Satender Kumar Mall
Twitter: @satenderiiit

No comments:

Post a Comment