0 votes
in Cache Technique by

Read Top 50 Cache Technique Interview Questions and Answers on :

  • caching coding questions
  • cache memory questions
  • cache memory interview questions
  • cache mapping techniques
  • gate questions on cache memory
  • direct mapped cache
  • types of cache memory

1 Answer

0 votes
by

cache Interview Questions

Question#(1)A cache is a ______________.

a) Data storage format

b) Small and Fast memory

c) Copy of data

d) Data Backup

Ans:b) Small and Fast memory

Source: medium.com

Question#(2)In which type of cache, application directly interacts with database for data that is not available in the cache?

a) Local Cache

b) Cache-aside

c) Write Through Cache

d) Read Through Cache

Ans: Answer is b) Cache-aside

Source: www.eximiaco.tech

Question#(3)A cache has 1024 blocks and each block can contain 1024 bits of data. What is the size of the cache?

a) 0.25 MB

b) 0.125 MB

c) 1 MB

d) 0.5MB

Ans:b) 0.125 MB

Question#Question#(4)Which of the following in a cache address, specifies the exact location in the cache line where the requested data exists?

a) Block Number

b) Block Offset

c) Block Index

d) Tag

Ans:b) Block Offset

Question#(5)A byte addressable direct-mapped cache with 1024 blocks/lines, and with each block are having 8 32-bit words. How many bits are required for block offset, assuming a 32-bit address?

a) 10

b) 15

c) 3

d) 5

Ans:d) 5

Question#(6)In which type of cache, application treats cache as the main data store and reads data from it and writes data to it? a)  Read Through/Write Through Cache b)  Cache-aside

a) I

b) None of the options mentioned

c) II

d) I & II

Ans: a) I

Source: medium.com

Question#(7)Which type of caching can be used to cache the contest registration page in a website, to reduce the time taken to serve the page for the users?

a) Web Cache

b) Data Cache

c) Browser Cache

d) Application Cache

Ans:d) Application Cache

Source: www.eximiaco.tech

Question#(8)Which type of cache reference locality aims at designing cache to store the entire block near the Recently Referenced Data? a)  Temporal Locality b)  Spatial Locality

(1)I

(2)I & II

(3)None of the options mentioned

(4)II

Ans:(4)II

Question#(9)A web page displays 10 items per page and has pagination enabled. What would be the recommended way to enable efficient paging?

a) Perform in-memory paging

b) Use Temporal Cache

c) Use Spatial Cache

d) Hit the database every time user moves to next page

Ans:c) Use Spatial Cache

Question#(10)Which type of cache reference locality aims at designing cache to store "Recently Referenced Data" assuming that the same data will be requested frequently?

(1)Temporal Locality

(2)Either of the options mentioned

(3)Spatial Locality

(4)None of the options mentioned

Ans:(1)Temporal Locality

Question#(11)When a computer processor does not gets a data item that it requires in cache, then the problem is known as _________.

a) Write Miss

b) Cache Read

c) Cache Hit

d) Cache Miss

Ans:c) Cache Hit

Source: www.eximiaco.tech

Question#(12)Which type of cache is recommended to store user preferences for an application with several 100's of concurrent users?

a) Near Cache

b) On Demand Cache

c) Data Cache

d) Primed Cache

Ans:b) On Demand Cache

Question#(13)Which of the following is used to determine, if a piece of data in cache needs to be written back to cache?

a) Valid Bit = 0

b) Dirty Bit = 1

c) Valid Bit = 1

d) Dirty Bit = 0

Ans:b) Dirty Bit = 1

Question#(14)Cache Performance or Average Memory Access time (AMAT) depends on which of the following?

a) All options mentioned

b) Time taken to get data from cache

c) Frequency of Cache Miss

d) Time taken to get data from main memory

Ans:a) All options mentioned

Question#(15)Caching Technique where cache is populated the first time a certain piece of data is requested is called _________.

a) Local Population

b) Lazy Loading

c) Cache aside

d) Upfront Loading

Ans:b) Lazy Loading

Source: medium.com

Question#(16)Which of the following is true about the cache?

a) Line size < Block size

b) None of the options mentioned

c) Line size == Block size

d) Line size > Block size

Ans:c) Line size == Block size

Question#(17)Which Cache would be the best place to cache DNS data?

a) Application

b) Browser

c) Proxy

d) Data

Ans:c) Proxy

Question#(18)For a cache look up to be a Hit, which of the following must be true?

a) Tag==Block Number and Valid Bit = 0

b) Tag==Block Number and Valid Bit = 1

c) Tag==Block Offset and Valid Bit = 0

d) Tag==Block Offset and Valid Bit = 1

Ans:b) Tag==Block Number and Valid Bit = 1

Source: www.eximiaco.tech

Question#(19)While using a Write Back cache, which of the following policies needs to be abided?

a) No Write Allocate

b) Write Allocate

c) Write Around

d) Write Through

Ans:ii)Write Allocate

Question#(20)Line size in a cache is recommended to be a power of 2.

a) True

b) False

Ans:a) True

Question#(21)Cache Performance or Average Memory Access time (AMAT) depends on which of the following?

a) Time taken to get data from cache

b) Time taken to get data from main memory

c) All options mentioned

d) Frequency of Cache Miss

Ans:c) All options mentioned

Question#(22)Which Caching Topology is recommended for a read intensive distributed application?

a) Local Cache

b) Near Cache

c) Partitioned

d) Replicated

Ans:d) Replicated

Question#Primary objective of Cache Coherence is to ensure __________.

(1)Data Consistency across all local caches

(2)Improving the Cache Resilience

(3)Improving Cache Performance

Ans: Answer of above question is (1)Data Consistency across all local caches

Question#Which of the following types of data exhibits Spatial Locality?

(1)Counter

(2)All options mentioned

(3)Look Up Table

(4)Array

Ans: answer of above question is (4)Array

Question#Which of the following Cache Eviction techniques consider Locality?

(1)Least Recently Used

(2)Time Based

(3)Random

(4)First in First Out

Ans: Answer is (1)Least Recently Used

Question#Which of the following is true about a well designed cache?

(1)Hit Rate == Miss Rate

(2)Hit Rate < Miss Rate

(3)Hit Time > Miss Time

(4)Hit Rate > Miss Rate

Ans: Answer of above question is (4)Hit Rate > Miss Rate

Question#Which Caching Topology is recommended for a read intensive distributed application?

(1)Local Cache

(2)Near Cache

(3)Partitioned

(4)Replicated

Ans: Answer is (4)Replicated

Question#What is Caching and why we use cache

In computing, a cache is a high-speed data storage layer which stores a subset of data, typically transient in nature, so that future requests for that data are served up faster than is possible by accessing the data’s primary storage location. Caching allows you to efficiently reuse previously retrieved or computed data.

Cache is usefull to save data and storing it for later use. Cache is a smaller and faster memory which stores copies of the frequently used data which is later use as a input for other thing. Here we stroe object like HTML pages, images, files, web objects, etc are stored in cache to improve the efficiency and overall performance of the application. A cache is typically stored in memory or on disk. A memory cache is normally faster to read from than a disk cache. But, does not survive system restarts.

Below are the reason why we use cache

(1)Reduce Latency

(2)Increase Capacity

(3)Improve App Availability

Source: medium.com

Question#Name some Cache Writing Strategies

There are two common strategies to write data in a cache:

Pre-caching data, for small pieces of data, usually during the application initialization, before any request.

On-demand, checking first if the requested data is in the cache (if the data is found, it is called a cache hit), using it, improving the performance of the application. Whenever the requested data has not been written to the cache (cache miss), the application will need to retrieve it from the slower source, then writing the results in the cache, thus saving time on subsequent requests for the same data.

Question#What is Cache Invalidation?

HTTP caching is a solution for improving the performance of your web application. For lower load on the application and fastest response time, you want to cache content for a long period (TTL). But at the same time, you want your clients to see fresh (validate the freshness) content as soon as there is an update.

Cache invalidation gives you the best of both worlds: you can have very long TTLs, so when content changes little, it can be served from the cache because no requests to your application are required. At the same time, when data does change, that change is reflected without delay in the web representations.

Question#Name some Cache Invalidation methods

Purge - Removes content from cache immediately. When the client requests the data again, it is fetched from the application and stored in the cache. This method removes all variants of the cached content.

Refresh - Fetches requested content from the application, even if cached content is available. The content previously stored in the cache is replaced with a new version from the application. This method affects only one variant of the cached content.

Ban - A reference to the cached content is added to a blacklist (or ban list). Client requests are then checked against this blacklist, and if a request matches, new content is fetched from the application, returned to the client, and added to the cache. This method, unlike purge, does not immediately remove cached content from the cache. Instead, the cached content is updated after a client requests that specific information.

Related questions

0 votes
asked Feb 14, 2022 in Birst by rajeshsharma
0 votes
asked Jun 26, 2022 in Azure Virtual Network by sharadyadav1986
...