Section : Networks And Protocols
“Protocols” is a fancy word that has a meaning in English totally independent of computer science. It means a system of rules and regulations that govern something. A kind of “official procedure” or “official way something must be done”.
For people to connect to machines and code that communicate with each other, they need a network over which such communication can take place. But the communication also needs some rules, structure, and agreed-upon procedures.
Thus, network protocols are protocols that govern how machines and software communicate over a given network. An example of a network is our beloved world wide web.
You may have heard of the most common network protocols of the internet era – things like HTTP, TCP/IP etc. Let’s break them down into basics.
General Problem Statement And Overview
The initial introduction to the interview usually goes for a few minutes, where you will introduce yourselves and the interviewer will give you your question.
Your goal here is to listen closely to understand the the problem being presented. The question will either be a high level design question, or a lower level design of a frontend component. Its likely the the question will relate some how to the product the company builds. Or a specific highly used component within the product. So doing some initial practice runs using the companys product you are applying for can help get you in the right frame of mind before the interview.
How would you go about designing the frontend of a chat application like Slack?
How would you build the frontend of a photo sharing application like Instagram?
How would you go about designing an infinite scrolling newsfeed?
How would you design a combobox / typeahead component ?
What Is The Write
Example:”Write-through is the preferred method of data storage in many applications, especially in banking and medical device control, as it’s good at preventing data loss. In less critical applications, and especially when the volume of data is large, an alternative method known as “write-back” speeds up system performance because updates are typically written exclusively to the cache and are saved in the main memory only under certain conditions or at specified intervals.”
Also Check: How To Master Interview Questions
How Can You Design An Atm System
In banking systems, an ATM is used to deposit and withdraw money from their customers. It also facilitates users to see their account balance. It would be best if you made a design plan to create this system.
You should keep the following features in your mind while designing this service:
- Each user has at least one bank account at the bank.
- The user should be able to insert a card and perform transactions.
- ATM should authenticate the user based on the PIN entered.
- Once authenticated user should be able to transactions, namely view account balance, deposit cash, and withdraw cash.
- Users can only perform one transaction at any given time.
- At the end of a transaction, appropriate messages should be displayed to the user to communicate the success/failure of the transaction.
- At the end of a transaction, the user should be able to start another transaction.
- The machine should return the card when the user exits.
How Do You Decide Between Web Applications And Locally Installed Applications
This question can help interviewers evaluate your ability to make important decisions based on client needs. Explain your methods for applying client specifications and deciding on the solutions that best meet the client’s needs to highlight your communication and analytical skills.
Example:”Ultimately, my decision to use either structure depends on what the client wants to achieve with the application. In my last role, I first collaborated with clients to understand what objectives they needed their software to achieve. One client was a large-chain retailer that required a large-scale web application to support online shopping. My team and I consulted with the client to establish the main specifications for the application, and I used these parameters to decide on a web application to better support the client’s business success.”
Recommended Reading: What Do They Ask You At A Job Interview
Design A Parking Lot System
- What are some of the Required Features?
- The parking lot can have multiple levels where each level has multiple rows for parking spots.
- The parking lot can support parking for cars, buses, motorcycles hence spots can be of multiple sizes.
- Consider the parking lot capacity at the time of designing the system.
- Design appropriate pricing for each parking spot.
Ask Questions And Establish Scope
The biggest mistake you can make during a system design interview is to jump right into the design without first asking questions. Because system design interview questions are intentionally vague, youll want to collaborate with your interviewer to establish design scope and validate any assumptions you may have.
Youll likely want to ask some or all of the following questions:
- Which features are most important?
- How many daily active users are there?
- Can I leverage existing cloud providers like AWS, GCP, or Azure? , auto-scaling groups, document storage , message queues , cache , or CDN .
- What types of data are we dealing with?
- Do we need to consider ?
- Can I assume that ?
Once you feel that you have a decent understanding of the problem, you can move on to the high-level design.
Recommended Reading: Is Grokking The System Design Interview Worth It
How Do You Design A Url Shortening Service Like Tinyurl Or Bitly
TinyURL or bit.ly takes a long URL and generates a new unique short URL. These systems are also capable of taking the shortened URL and returning the original full URL.
- What are some of the Required Features?
- Generate a short URL having a length shorter than the original URL.
- Store the original URL and map it to the shortened one.
- Allow redirects in the shortened URLs.
- Support custom names for short URLs.
- Handle multiple requests at the same time.
What Should One Anticipate In A System Designs Interview
Such an interview normally starts off with a very open-ended problem, such as design your own social network . As the discussion progresses, the interviewer will add extra restrictions or assumptions to reduce the scope of the problem.
In order to tackle these questions, things that help you are practice and having a structured approach.
If you are looking for a job related to System design, you need to prepare for the 2022 System design Interview Questions. It is true that every interview is different as per the different job profiles. Here, we have prepared the important System Design Interview Questions and Answers, which will help you get success in your interview.
This 2022 System design Interview Questions article will present the 10 most important and frequently asked System design Interview questions. These questions are divided into two parts are as follows:
Recommended Reading: How To Do A Pre Recorded Video Interview
Explain Two Common System Design Tools
- System flow chart
The system flow chart consists of a diagrammatic representation that shows how a system operates. The diagrammatic representation is simpler to understand. It is one of the main tools used by the system analyst to display an overview of the processes in an entire system.
- Data flow diagram
A data flow diagram is a system design tool used to explain the movement of data through a system and the operations or processing that it carries out. It displays how data enters the system from external sources, how it travels from one operation to another, and how it is stored.
What Are Some Of The Components Of A Microprocessor
Example:”Some of the components of a microprocessor include the arithmetic and logic unit, which performs math computations such as division, addition and subtraction and Boolean functions registers, which act as the temporary data holding places of microprocessors control units, which receive signals from the CPU and move data from one microprocessor to another and memory caches, which accelerate the computing process, as the CPU doesn’t have to use the slower RAM to retrieve data.”
Recommended Reading: Byte By Byte Vs Interview Kickstart
Guidelines For High Level Designs
As you being to design solutions to use-cases its helpful to be constantly asking – what is the user trying to do here? to help frame your solution. Asking this helps prevent creating solutions to problems that arent relevant and helps you stay focussed on driving a solution forward that keeps things simple.
As you practice on real examples its good to keep things simple. No need to over-complicate things. The majority of times solutions wont be ground breaking new designs. A good enough solution is one where it solves the specific use-case in front of you, and you have analyzed its trade-offs and called out any potential limitations. This is much better than an over-engineered solution that attempts to solve everything at once.
It can be helpful to apply different lenses to look at the problem from different view points. Especially if you get stuck or not sure how to move things forward. Switching lenses can help you enumerate different potential solutions and considerations that apply to your solution.
The users viewpoint
Thinking in terms of how the user will actually use the system, and being able to visualize that, can help uncover edge cases and different user experiences you may need to take into consideration.
For example when navigating away from an infinite scrolling list, when the user comes back would they expect the scroll position to be in the same spot of the list when they went back?
The architects viewpoint
The maintainers viewpoint
Describe The Single Responsibility Principle
According to the single-responsibility principle , every module, class, or function within a software application should be in charge of a single aspect of that programs operation and should encapsulate that aspect. The services provided by a module, class, or function should all be closely related to that obligation. SRP is among the most often applied design concepts in object-oriented programming. It is applied in software components, classes, and microservices.
Recommended Reading: Grokking The Coding Interview Book
High Level Architecture Design
Youll have the top use-cases of the system or component as you move into this phase of the interview.
There are no hard and fast rules here. But one way to think about structuring this phase of the interview is taking a top down approach. It can be helpful to start high level from the top with basic wire-frames, and then depending on how you prefer to think about things, work from a top down perspective to flesh out those details, or work from the bottom up.
Starting with basic wire-frames can help you understand the problem of the particular use-case you are solving and get on the same page as the interviewer. A good approach from there is identifying the abstract data entities that power the specific use-case.
The design artifacts youll create for both high and low level designs typically include but not limited to:
- High level wire-frame to define the problem and to confirm you on the same page as the interviewer.
- Data entities – e.g pseudo code of type definitions for data entities.
- Break down of wire-frame into individual components, identifying their hierarchy and composition.
- The higher level APIs those components rely on.
- Both user and system initiated events use that interact with the data entities that power the functionality of the use-case.
Explain The Steps To Create A Chat System Like Whatsapp Facebook Or A Similar One
We all know the standard working of a chat system. It permits users to chat either one-to-one or group chat. The steps are as follows:
- Understand all required features present in chat systems
- Find out all possible problems which might happen like encryption, notification etc.
- Determine all essential tools such as database schema, storage, connectors, and push notifications
Check this video link to get details.
You May Like: Email To Schedule An Interview
Ip Hashing Based Selection
You can configure your load balancer to hash the IP address of incoming requests, and use the hash value to determine which server to direct the request too. If I had 5 servers available, then the hash function would be designed to return one of five hash values, so one of the servers definitely gets nominated to process the request.
IP hash based routing can be very useful where you want requests from a certain country or region to get data from a server that is best suited to address the needs from within that region, or where your servers cache requests so that they can be processed fast.
In the latter scenario, you want to ensure that the request goes to a server that has previously cached the same request, as this will improve speed and performance in processing and responding to that request.
If your servers each maintain independent caches and your load balancer does not consistently send identical requests to the same server, you will end up with servers re-doing work that has already been done in as previous request to another server, and you lose the optimization that goes with caching data.
What Are The Various Consistency Patterns Available In System Design
Consistency from the CAP theorem states that every read request should get the most recently written data. When there are multiple data copies available, there arises a problem of synchronizing them so that the clients get fresh data consistently. Following are the consistency patterns available:
- Weak consistency: After a data write, the read request may or may not be able to get the new data. This type of consistency works well in real-time use cases like VoIP, video chat, real-time multiplayer games etc. For example, when we are on a phone call, if we lose network for a few seconds, then we lose information about what was spoken during that time.
- Eventual consistency: Post data write, the reads will eventually see the latest data within milliseconds. Here, the data is replicated asynchronously. These are seen in DNS and email systems. This works well in highly available systems.
- Strong consistency: After a data write, the subsequent reads will see the latest data. Here, the data is replicated synchronously. This is seen in RDBMS and file systems and are suitable in systems requiring transactions of data.
Don’t Miss: What Do They Ask At A Job Interview
What Is Associative Mapping
Example:”The associative mapping technique uses several mapping functions to transfer data from the main memory to the cache memory. This means that any main memory is mapped into any line of the cache. As a result, the cache memory address is not in use. The associative cache controller processes and interprets the request by utilizing the main memory address format.”
Tips To Crack Amazon System Design Interview Questions
As you may have noticed, the Amazon system design interview questions can be tricky. The questions are ambiguous, and you will have to deal with the unstructured nature of the discussion. However, with extra practice, youâll be prepared to handle anything the interviewers throw at you. Hereâs what you should do before and during the interview to make the best impression.
Don’t Miss: Design Questions For Product Manager Interview
How Do You Approach System Design
To perfectly design any system, the following things must be kept in mind-
- The system should be robust, re-usable, and well-documented.
- It should be user-friendly and helpful to people.
- The system should be well-ranked and placed well based on the reviews of the users.
- The system can store user data for further inquiry depending upon the area’s population density.
- The design process should be smooth and avoid any complications.
New Course: Full Stack Development for Beginners
How Can You Design A Url Shortening Service Like Tinyurl Or Bitly Etc
The interviewer asks this question to check if you can create a program that can shorten long URLs like TinyURL or bit.ly. These programs take a long URL and generate a new and unique short URL. You can also put shortened URL here and get the original full-length URL.
Here, you have to show your solid foundation in design. You can also specify things that are not listed in the example response, such as creating a unique ID for each URL, handling redirects and how you delete expired URLs, etc.?
You should keep the following features in your mind:
- Your application must return a URL shorter than the original URL.
- You have to store the original URL for future purposes.
- The newly generated URL must be able to link to the stored original URL.
- Shortened URL should allow redirects to the original.
- It must support custom short URLs.
- It should also be capable of supporting many requests at once.
What type of questions the interviewer can discuss while you answer this question:
- How can you deal with the issues such as if two users input the same custom URL or get more users than expected?
- How would you regulate your database storage space?
What technologies would be best to use to develop such applications?
- Hashing to link original and new URLs.
- REST API to load high balance traffic and handle front-end client communication.
- Use multithreading to handle multiple requests simultaneously.
- Use NoSQL database to store original URLs .
Recommended Reading: How To Write An After Interview Thank You Email