## Question 1
Suppose we have a cache with a capacity of 4. It has the keys shown below. The keys are shown sorted by age - oldest at the top, newest at the bottom. What is the new state of the cache, if we set a new pair with the following inputs?
key = 15
value = 100
### Options
1.
Incorrect
----------------------------
2.
Incorrect
----------------------------
3.
Correct
We will simply add the new pair at the end of the dictionary.
----------------------------
4.
Incorrect
----------------------------
---------------------------------------------
## Question 2
What is the output if we want to get a value where key = 13?
### Options
1. 17
Incorrect
----------------------------
2. -1
Correct
There's no such key available in the dictionary, so we will return $-1$.
----------------------------
3. 31
Incorrect
----------------------------
4. 25
Incorrect
----------------------------
---------------------------------------------
## Question 3
Suppose we have a cache with a capacity of 4. It has the keys shown below. The keys are shown sorted by age - oldest at the top, newest at the bottom. What is the new state of the cache, if we set a new pair with the following input?
key = 18
value = 70
### Options
1.
Incorrect
----------------------------
2.
Incorrect
----------------------------
3.
Incorrect
----------------------------
4.
Correct
We have a cache containing size 4, so we will first evict the least recently used pair, that is, {17, 25} then we will add the new pair at the end of the dictionary.
----------------------------
---------------------------------------------