Nothing Special   »   [go: up one dir, main page]

Week 11 Graded PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Week 11 Graded Questions

Q1: Which of the following statements(s) is/are true regarding flask_caching?

A. The cache decorator includes the function parameters in the cache key.
B. The memoize decorator includes the function parameters in the cache key.
C. Both the cache and memoize decorators work the same way for functions not having any
parameters.
D. All of the above

Answer: B and C

Solution: Reference to read: Flask-Caching — Flask-Caching 1.0.0 documentation

Q2: Which of the following statement(s) is/are correct regarding caching?

A. Caching can be done at browser level.


B. Caching cannot be done at server (proxy) level.
C. Hard refreshing a web page clears the browser cache for that specific web page.
D. All of the above

Answer: A and C

Solution: Caching can be done at various levels, like browser level, proxy server level, database
level etc. A hard refresh clears the browser’s cache, and forces the browser to load or get the
most recent version of the web page from the server.

Q3: Which of the following statement(s) is true?

A. A cached resource stored at a proxy server serves its copy to multiple users.
B. Hard refreshing a web page can still result in a cached response being served from a
proxy server.
C. Caching at browser level provides the least latency, if compared with proxy level.
D. All of the above

Answer: D
Solution: A resource being cached on the proxy server is meant to be served to multiple users,
without hitting the origin or the database server. A hard refresh forces the browser to get the
most recent version of the web page, but it can still be a cached version available at the proxy
server.
The cached resources that are available on the client’s browser provides the least latency, as
the browser need not even make a network call to fetch the resource.

Q4: Which of the following criterions should be directly considered while measuring the
performance of an application?

A. The number of requests an application can handle for a given time interval with as much
as little latency.
B. How does the application scale over load.
C. The application should be written in Python based flask or Django framework.
D. All of the above

Answer: A and B

Solution: It is not at all mandatory for an application to be written in flask or Django to provide a
good performance.

Q5: Which of the following tools can be used to measure or analyze the performance of
a web application?

A. GTmetrix
B. Postman
C. Lighthouse
D. All of the above

Answer: A and C

Solution: Both Lighthouse and GTmetrix are the tools that can be used for performance
measurement of a website or a web application, whereas, Postman is a web client, majorly used
for testing the APIs.
Q6: Which of the following is the correct statement?

A. Cookie size can impact the website performance.


B. Cookie size does not affect the website performance.
C. A request to static.example.com will include cookies set for example.com (assuming
domain attribute is specified with “example.com”).
D. A request to static.example.com will not include cookies set for example.com (assuming
domain attribute is specified with “example.com”).

Answer: A and C

Solution: A cookie set with the domain will be sent to the server with each request. So,
unnecessary cookie will create unnecessary traffic. And cookie with large size may slow down
the website because of the requirements of higher bandwidth.

Q7: Suppose you have a web page which includes a paragraph with some content,
images and a stylesheet. You want to update the content of the paragraph with
JavaScript. Which of the event, among load and DOMContentLoaded, you should wait
to fire before updating the content for better performance?

A. load
B. DOMContentLoaded
C. Both of them will result in same performance.
D. DOM is not required to be loaded fully before updating the content.

Answer: B

Solution: The load event is fired when every thing including images and stylesheets are fully
loaded, but DOMContentLaded is fired as soon as the HTML is loaded without waiting for
stylesheet and images to load. In order to change the content of paragraph only DOM is
required so, DOMContentLoaded will result in better performance.

Q8: Suppose you want to embed an image of 100*100 px in your webpage. Which of
the following statement is correct?

A. Using an image with dimension 200*200 px and scaling it using HTML will perform better
than using a 100*100 px image directly.
B. Using an image with dimension 200*200 px and scaling it using HTML will perform worse
than using a 100*100 px image directly.
C. Scaling using HTML does not impact the performance.
D. None of the above

Answer: B

Solution: Using the exact size image as required gives the better performance, as the resize of
the image or scaling may affect the performance of a web page by some margin.

Q9: Which of the following is/are correct regarding the E-Tag and If-Match?

A. E-Tag is a response header to validate the current version of resource.


B. E-Tag is a string of ASCII characters placed between double quotes.
C. For get and head requests, If-Match request header is sent to get the resource only if
E-Tag value matches.
D. For get and head request, If-Match request header is sent to get the resource only if
E-Tag value does not match.

Answer: A, B and C

Solution: E-Tag is an HTTP response header, which acts as an identifier for a particular version
of the resource. A new E-Tag must be generated if the resource at a specified URL changes.
You can read more about it here: ETag - HTTP | MDN (mozilla.org)

Q10: Which of the following is/are true regarding CDN?

A. CDN is an acronym for content delivery network.


B. It is the network of servers to provide fast delivery of web content.
C. It reduces the distance between client and the resource, which results in faster delivery
of content.
D. None of the above

Answer: A, B and C

Solution: CDN (Content Delivery Network) is mainly used to deliver the static content with a high
speed. The content is served from the nearest CDN server to the user to provide high
performance.

You might also like