Week 11 Graded PDF
Week 11 Graded PDF
Week 11 Graded PDF
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
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.
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?
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?
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)
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.