Cache Interview Questions
- 0of 0 votes
AnswersHow would I store 100 million documents (~40 Gigabytes) in 32 Gigabytes of RAM? The documents are in JSON format. In other words how do couchbase, redis, and mongodb work in memory?
- donk August 26, 2019 in United States for Engineering| Report Duplicate | Flag | PURGE
Notfamous Technical Support Engineer Cache - 0of 0 votes
AnswersWe tend to use computer to solve practical problems that actually earns or save dollars. Here is something that happens across the stock exchanges : people buy and sell stocks.
- NoOne October 15, 2016 in India
We generally use automated intelligent systems to buy and sell stocks. That part is too much mathematics, and beyond scope of this interview. There is another part. Suppose the system issues a buy order : buy 1000 Microsoft stock. Now, there are more than 1 ( in fact 10 ) active exchanges from where we can buy MSFT. There is a slight price delta, which keeps changing over time. There is another problem. In each stock exchange, prices are stacked, that is :
1. For first 100 stocks prices are 55$.
2. Next 200 stocks, prices are 55.2$.
... etc, and you got the idea. Even this stacks are changing over time.
Thus, here is the problem to solve. Design and implement a system such that one can buy n stocks with minimal price.
Also, in the same spirit, the same system should be able to sell n stocks with maximum payoff possible.
This is a non trivial problem, for Quant systems.
There are always k no of exchanges to hit.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Algorithm Cache Computer Architecture & Low Level Computer Science Distributed Computing Large Scale Computing Math & Computation Software Design - 0of 0 votes
AnswersThe following is the design question I was asked.
- gopi.komanduri July 26, 2016 in India
Design a dash board.
Should be very realistic.
Should be scalabe .
Should have very less latency .
Can expect millions of updates per second.
Dash board should show :
for each day :
1. city name ,
2.total trips in that city for that day ,
3.total fare it could collect in that city on that day,
4. fare collected from old clients
5. fare collected from new clients (new client is the client who is having his first ride in Uber after registration)
Input : we get two strings s1 , s2.
the format of s1 : trip_id , client_id , city , datetime
the format of s2 : trip_id , fare.
Could you please suggest how to proceed for this kind of question?| Report Duplicate | Flag | PURGE
StartUp Analyst Algorithm Business Question Cache Computer Architecture & Low Level Data Structures Distributed Computing Hash Table Ideas System Design - 0of 0 votes
AnswersYou are given an scenario where there is an Worker object. Each Worker object has one mandatory field unique id workerId and their are few other non unique and not mandatory Ids : DeptId and UnitID.
- CareerCupUser1 April 16, 2016 in United States
Design an cache for your Worker objects considering the fact that most of the queries on your cache will be on unitId. If the there is an query for an Worker which is not available in your cache then that data will be fetched from the server.
Design an cache such that there will be minimum number of server calls. Imagine there are 100;s of such non unique ids non mandatory Ids in the Worker object and you have to design the cache so that your client can query on any given id with minimum calls to server.
Your Worker object looks like this:
Worker1=> workerid=1, deptId=>765, unitId=>123 Name=“” Surname=“” Data=“”
Worker2=> workerid=2 , deptId=>765 Name=“” Surname=“” Data=“”
Worker3=> workerid=3, unitid=>123 Name=“” Surname=“” Data=“”
so when your client queries using unitId getWorkersbyUnitId(123) it should return Worker1 and Worker3.
If query is on deptId 765 then it should return Worker1 and Worker2
You can assume there is never an query on individual workerId.
other information given while discussion is you can query the server using any id and all the worker objects of that id will be fetched by that single call: Example there are 10 workers associated with untId: 99 then server call to getserverUnitIdWorkers(99)-> will output list of 10 workers. Each unitId or any other non mandatory id has approximate 8 to 10 workers associated with it. And there are millions of such unitIds.| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer Cache - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - 0of 0 votes
AnswersDesign a phone book such that fields are searchable with name , with number. Later enhanced teh question asking searchable with address as well.
- gopi.komanduri July 22, 2014 in India| Report Duplicate | Flag | PURGE
Analyst Algorithm Arrays Bit Manipulation Brain Teasers C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures - 1of 3 votes
AnswersDesign a telephone directory for large ppl (he gave example like design for India). fields will be , first name , last name , number . this should be searchable with first name , last name , number as welll.
- gopi.komanduri July 04, 2014 in India
later added more complexity like do the same for organisation where even it contains designations. so this should be searchable with designations.| Report Duplicate | Flag | PURGE
Analyst Algorithm Arrays C C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming Hash Table Ideas Large Scale Computing Linked Lists Object Oriented Design Problem Solving Trees and Graphs - 0of 2 votes
AnswersImplement a LRU cache with O(1) addCache and removeCache.
- msito October 14, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Cache - 0of 0 votes
AnswersDesign a fixed size LRU cache that offers inserts into and retrievals from the cache in constant time.
- Murali Mohan June 12, 2013 in India| Report Duplicate | Flag | PURGE
Cache - -5of 7 votes
Answersneed to implement a weather report functionality. user will provide the city name , need to return the weather report.
- gopi.komanduri May 29, 2013 in India
if weather station exists n functioning properly , will return the weather report of that station .
else ,
will return the nearest available weather station report.
interviewer looking for optimized manner.
looking for datastructures to stores the cities n algo to return the report.| Report Duplicate | Flag | PURGE
Mentor Graphics Analyst Algorithm Arrays Bit Manipulation Brain Teasers C C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming General Questions and Comments Graphics Hash Table Ideas Linked Lists Math & Computation Object Oriented Design Problem Solving Sets Sorting Stacks String Manipulation Terminology & Trivia Threads Trees and Graphs XML - 0of 2 votes
AnswersA log file which has user details(user ID,timestamp) and pages visited in a particular day by that user.The next day -the same kind of log file gets generated.How do you find the probability of users who logged in consecutive days out of the second day - logged in users? The question is simple,but they look for the efficient data structure and time complexity.
- sriramMS December 20, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Application / UI Design Arrays Assembly Automata Behavioral Bit Manipulation Brain Teasers C C# C++ Cache Coding Data Mining Data Structures - 0of 0 votes
AnswersYou have a table which contains huge data may be crores of records and a cache which can contain only 1000 records. Query is done on the basis of some unique ID. When any query happens data should be copied to the cache, but the records which are used least amount of time should be removed and should be occupied with newly added records from table.
- Interviews January 29, 2012 in India
Cache should provide two mechanism , search for record(s) on the basis of a unique id & remove the records which used least amount of time. Cache can contain max 1000 records, and record should be available in cache even after your query is done. So records in cache is refreshed only when new query is done and new record arrives which do not exist in the cache.| Report Duplicate | Flag | PURGE
Amazon Cache - 0of 0 votes
AnswersWorking of Cache (Include Temporal and Spatial locality || also Write through and write back mechanisms || Set-Associativity etc.)
- einstein.goli October 25, 2011 in United States| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer / Developer Cache - 0of 0 votes
Answerswhat is 2 way cache?
- JavaJavas April 14, 2011| Report Duplicate | Flag | PURGE
Cache