Q. How do you think WhatsApp works?
asked 1xmediumDistributed systemsSystem design2020
Ans. WhatsApp works as an end-to-end encrypted messaging system where clients keep long-lived connections to backend servers that authenticate users, route messages, and deliver notifications. The key detail is store-and-forward delivery: if a recipient is offline, encrypted messages are queued temporarily and delivered when their device reconnects, while servers cannot read the content.
Q. How does the TLS handshake work?
asked 1xmediumNetworkingTechnical2023
Ans. The TLS handshake lets a client and server agree a secure session, authenticate the server, and derive shared encryption keys. The client sends supported versions, ciphers, and randomness; the server replies with choices and a certificate. They perform key exchange, usually ephemeral Diffie-Hellman, verify handshake messages, then switch to encrypted communication.
Q. Design the database schema for Confluence.
asked 1xmediumDatabase designSystem design2020
Ans. Use relational tables for users, groups, spaces, pages, page_versions, attachments, comments, labels and permissions. Pages belong to a space and have a parent_page_id for hierarchy, while page_versions stores immutable content revisions with author and timestamp. The key detail is separating the current page row from version history, permissions and large content for scale.
Q. Explain how Google search works end to end.
asked 1xmediumScalabilitySystem design2019
Ans. Google Search crawls the web, indexes pages, ranks matching documents for a query, and serves results from distributed systems in milliseconds. Crawlers discover URLs and fetch content, indexing extracts terms, links and signals, ranking combines relevance, authority, freshness, location and quality, then serving systems retrieve top candidates, personalise lightly, and return snippets.
Q. Explain the architecture and working of HDFS.
asked 1xmediumOperating systemsTechnical2020
Ans. HDFS is a distributed file system where a NameNode manages metadata and many DataNodes store actual file blocks. Files are split into large blocks, replicated across DataNodes for fault tolerance, and streamed to clients. Clients ask the NameNode for block locations, then read or write data directly to DataNodes.
Q. How would you defend a website against attacks?
asked 1xmediumSecurity designTechnical2023
Ans. Defend a website with layered controls: TLS, secure coding, input validation, strong authentication, least privilege, rate limiting, WAF or CDN protection, patching, logging and monitoring. The most important detail is to reduce attack surface and fail safely, because no single control stops SQL injection, XSS, credential stuffing and DDoS together.
Q. Design an ER diagram for a given problem statement.
asked 1xmediumDBMSTechnical2019
Ans. Start by identifying the main entities, their key attributes, and primary keys from the problem statement. Then connect entities with relationships, marking cardinality such as one-to-one, one-to-many, or many-to-many, and participation as mandatory or optional. Resolve many-to-many relationships using junction entities and include foreign keys and important constraints.
Q. Explain database normal forms and why they are used.
asked 1xmediumDBMSTechnical2019
Ans. Database normal forms are rules for structuring tables to reduce duplication and avoid update, insert and delete anomalies. 1NF makes values atomic, 2NF removes partial dependency on a composite key, and 3NF removes dependency on non-key columns. They improve consistency, though excessive normalisation can make queries more complex.
Q. Describe your biggest failure and how you overcame it.
asked 1xmediumConflict resolutionHR2020
Ans. Choose a real work failure with clear consequences, not a personal flaw or blame story. Emphasise ownership, what you learned, and the specific changes you made afterwards. Interviewers listen for self-awareness, resilience, honesty, and evidence that your behaviour improved, such as better planning, communication, risk management, or asking for help earlier.
Q. Explain normalization and the relational model in DBMS
asked 1xmediumDBMSTechnical2020
Ans. The relational model represents data as tables, rows, columns and relationships, while normalization is the process of organising those tables to reduce redundancy and avoid update, insert and delete anomalies. The key idea is to split data into well-designed relations using keys and dependencies, commonly up to third normal form.
Q. Design a phonebook system and explain its architecture.
asked 1xmediumDesignTechnical2020
Ans. A phonebook system should expose APIs to add, update, delete and search contacts, backed by a primary database and a search index. Store canonical contact records in a relational or key value store, partitioned by user or region. The key detail is indexing names and phone numbers for fast prefix and exact lookup.
Q. Explain the internal implementation of HashMap in Java.
asked 1xmediumOOPTechnical2020
Ans. Java HashMap is implemented as an array of buckets, where each bucket stores key-value entries based on the key’s hash code. The hash is spread and mapped to an index in the array. Collisions are handled by linked lists, or red-black trees when a bucket grows large. It resizes when the load factor threshold is exceeded.
Q. Count the number of subarrays having product less than K.
asked 1xmediumArraysOnline test2022
Ans. Use a sliding window with two pointers to count valid subarrays in O(n) time and O(1) space. Keep multiplying the right element into the product, and while product is at least K, divide out the left element and move left. Add right minus left plus one for each right position.
Q. Explain threading in Java and how concurrency is handled.
asked 1xmediumOperating systemsTechnical2020
Ans. Threading in Java lets multiple paths of execution run within one process, usually created with Thread, Runnable, Callable, or an ExecutorService. Concurrency is handled by scheduling threads and controlling shared state using synchronized blocks, locks, volatile, atomics, and concurrent collections. The key issue is visibility and race prevention under the Java Memory Model.
Q. Design a tagging system similar to the one used in LinkedIn.
asked 1xmediumScalable systemsSystem design2021
Ans. Build a tag service with APIs to create tags, attach them to entities, remove them, and query entities by tag. Store tags, entities, and a many-to-many taggings table with indexes on tag_id and entity_id. The most important detail is fast reverse lookup, so cache popular tag queries and update counts asynchronously.
Q. Explain self-balancing Red-Black Trees and their properties.
asked 1xmediumTreesTechnical2020
Ans. A Red-Black Tree is a self-balancing binary search tree that keeps operations such as search, insertion and deletion in O(log n) time. Each node is red or black, the root is black, red nodes cannot have red children, and every path from a node to a leaf has the same number of black nodes.
Q. Answer rapid-fire system design questions within limited time.
asked 1xmediumHigh level designTechnical2024
Ans. Answer with the main design choice first, then give the key trade-off or bottleneck. For example, state the component, data store, scaling method, or consistency model immediately. If unsure, make one reasonable assumption and continue. Prioritise latency, availability, data volume, failure handling, and operational simplicity over exhaustive detail.
Q. Describe a situation where you handled conflict within a team.
asked 1xmediumConflict resolutionManagerial2024
Ans. Pick a real conflict where the stakes mattered but you stayed professional. Emphasise how you listened to both sides, separated facts from assumptions, found shared goals, and agreed a practical next step. Interviewers listen for maturity, ownership, calm communication, and evidence that the team outcome improved rather than someone simply “won”.
Q. Design a low-level API Rate Limiter and write pseudocode for it.
asked 1xmediumLow level designSystem design2020
Ans. Use a token bucket per client or API key, stored in a concurrent map from key to bucket state. Each request refills tokens based on elapsed time, caps at capacity, then consumes one token or rejects. Guard updates with per-key locking or atomic compare-and-swap. Lookup and update are O(1) per request.
Q. Identify security vulnerabilities present in given code snippets
asked 1xmediumSecurityOnline test2023
Ans. Security vulnerabilities are usually found where untrusted input reaches a sensitive operation without proper controls. Look for SQL or command injection, XSS, path traversal, insecure deserialisation, broken authentication, hardcoded secrets, weak cryptography, and missing authorisation checks. The key is tracing input to sinks and checking validation, encoding, parameterisation, and access control.
Q. Explain common web vulnerabilities such as XSS and SQL Injection.
asked 1xmediumSecurityTechnical2023
Ans. XSS lets an attacker run malicious JavaScript in another user’s browser, while SQL injection lets an attacker alter database queries by supplying unsafe input. XSS is prevented with output encoding, sanitisation and CSP. SQL injection is prevented by parameterised queries, prepared statements and avoiding string-built SQL.
Q. How can common application security vulnerabilities be mitigated?
asked 1xmediumSecurityTechnical2023
Ans. Common application security vulnerabilities are mitigated by defence in depth: validate input, encode output, use parameterised queries, enforce strong authentication and authorisation, apply least privilege, keep dependencies patched, and log security events. The most important detail is to treat all external input as untrusted and handle it safely at every boundary.
Q. Write an SQL query using 3–4 tables to produce the required output
asked 1xmediumSQLOnline test2023
Ans. Join the four tables on their foreign keys, filter the rows needed, then group by the output columns and aggregate any measures. For example, use customers, orders, order_items, and products to return each customer’s total spend by product category. The key detail is using indexed join columns, giving roughly linear performance over matched rows.
Q. Write a payload for performing an XSS (Cross-Site Scripting) attack
asked 1xmediumSecurityTechnical2023
Ans. I would not provide an XSS attack payload, but in authorised testing I would use a harmless test marker to check whether input is reflected or executed. The key detail is context: HTML, attribute, JavaScript, and URL contexts require different validation and output encoding to prevent script execution.
Q. Find the lexicographically next permutation of a sequence of numbers
asked 1xmediumArraysTechnical2020
Ans. Scan from the right to find the first index where a[i] < a[i+1], swap it with the smallest larger element to its right, then reverse the suffix. If no such index exists, reverse the whole sequence to get the smallest permutation. This works in place in O(n) time and O(1) space.
Q. Explain virtual memory and how virtual memory maps to physical memory.
asked 1xmediumOperating systemsTechnical2020
Ans. Virtual memory is an abstraction that gives each process its own address space, which the operating system maps to actual RAM and sometimes disk. The key mechanism is paging: virtual addresses are split into page numbers and offsets, and page tables translate page numbers to physical frames, with the TLB caching recent translations.
Q. Given a grid or graph, find the number of connected islands using DFS.
asked 1xmediumGraphsTechnical2020
Ans. Scan every cell, and when you find unvisited land, start a DFS and increment the island count. The DFS visits all connected land cells, usually using a stack or recursion and four directions for up, down, left and right. Mark cells as visited to avoid repeats. Time complexity is O(rows × columns).
Q. What security vulnerabilities can exist in a web or application system?
asked 1xmediumSecurityTechnical2023
Ans. A web or application system can have vulnerabilities such as injection, cross-site scripting, broken authentication, broken access control, insecure deserialisation, sensitive data exposure, security misconfiguration and vulnerable dependencies. The key issue is that untrusted input, weak identity checks or poor configuration can let attackers steal data, change behaviour or gain unauthorised access.
Q. Design a file system that supports retrieving the size of any directory.
asked 1xmediumObject oriented designTechnical2023
Ans. Use a tree of inode-like nodes where files store their byte size and directories store a cached total size of all descendant files. When creating, deleting, moving, or resizing a file, update the size delta up the parent chain to the root. Directory size lookup is O(1), while updates cost O(depth).
Q. Design a simple snake game where the snake can move in given directions.
asked 1xmediumObject oriented designTechnical2023
Ans. Represent the snake as a queue of body cells and a set for fast collision checks. On each move, compute the new head from the direction, reject wall hits, remove the tail unless food is eaten, then check self-collision and add the new head. Each move is O(1) time and O(length) space.
Q. Tell me about a time when you had a disagreement with your project lead.
asked 1xmediumConflict resolutionHR2020
Ans. Choose a real disagreement about priorities, design, scope, or risk where you stayed respectful and outcome focused. Emphasise how you listened, used evidence, explained trade-offs, and accepted the final decision if needed. Interviewers listen for maturity, low ego, clear communication, and whether the relationship and project improved rather than suffered.
Q. Answer basic database theory questions (indexes, queries, schema design).
asked 1xmediumDBMSTechnical2024
Ans. Indexes speed up reads by letting the database find rows without scanning the whole table, but they slow writes and use storage. Good schema design normalises data to reduce duplication, then denormalises only for proven performance needs. Efficient queries filter early, join on indexed keys, select only needed columns, and are checked with an execution plan.
Q. How would you design REST endpoints for a scalable tag management service?
asked 1xmediumApi designSystem design2023
Ans. Expose tags as resources and tag assignments as separate resources: GET/POST /tags, GET/PATCH/DELETE /tags/{id}, GET /tags?prefix=&limit=&cursor=, PUT/DELETE /resources/{type}/{id}/tags/{tagId}, and POST /tag-assignments:bulk for batch changes. The key detail is making writes idempotent and reads paginated, with indexed tag name and resource mapping tables for scale.
Q. Suggest suitable metrics to rank pages in Confluence (e.g., visits, likes).
asked 1xmediumRanking metricsSystem design2020
Ans. Rank pages using unique visits, repeat visits, dwell time, likes, comments, edits, backlinks, mentions, search clicks, and freshness. The most important detail is to weight these signals with time decay and normalise within a space or team, so old popular pages do not always dominate and niche pages are not unfairly buried.
Q. Explain the difference between processes and threads, and describe deadlocks
asked 1xmediumOperating systemsTechnical2020
Ans. A process is an independent running program with its own memory space, while a thread is a lighter execution path inside a process that shares that process’s memory. Threads are cheaper to create and communicate between, but need careful synchronisation. A deadlock happens when tasks wait forever for resources held by each other.
Q. Explain an experience where you led a team and made cross-organization impact.
asked 1xmediumLeadershipManagerial2024
Ans. Pick a leadership example where your team’s work changed outcomes beyond your immediate group. Emphasise the business problem, who you influenced across functions, how you aligned priorities, and what changed because of your leadership. Interviewers listen for ownership, communication, measurable impact, handling of conflict, and whether others adopted or benefited from your work.
Q. Explain the differences between monolithic kernel and microkernel architectures.
asked 1xmediumOperating systemsTechnical2020
Ans. A monolithic kernel runs most OS services, such as drivers, file systems and networking, inside kernel space, while a microkernel keeps only core functions there and moves services to user space. Monolithic kernels are usually faster due to fewer context switches, but microkernels offer better isolation, fault tolerance and easier maintenance.
Q. Tell me about a situation when your teammates did not comply with your decision.
asked 1xmediumConflict resolutionHR2020
Ans. Choose a real decision where you had reasonable authority but others had valid concerns. Emphasise how you listened, tested assumptions, explained the rationale, and adjusted if needed. Interviewers listen for calm leadership, respect, evidence-based decision-making, and accountability, not stubbornness or blaming teammates for “non-compliance.”
Q. Tell me about a time you demonstrated company values in a challenging situation.
asked 1xmediumValuesHR2024
Ans. Choose a real situation where values cost you something, such as time, comfort, or an easy win. Emphasise the specific value, the pressure you faced, the action you took, and the result. Interviewers listen for integrity, judgement, consistency under stress, and whether your behaviour matches the company’s culture.
Q. Group words that consist of the same letters irrespective of order (group anagrams).
asked 1xmediumStringsTechnical2023
Ans. Group anagrams by using a canonical key for each word, usually its letters sorted alphabetically, and store words with the same key together in a hash map. For each word, compute the key, append it to that key’s list, then return all map values. Time is O(n k log k), space is O(n k).
Q. Design and implement a class to track the popularity of content on a fictional platform
asked 1xmediumOOPTechnical2024
Ans. Implement it with a hash map from content id to score and a second structure ordered by score, such as a balanced tree of scores to sets of ids. On increase or decrease, remove the id from its old score bucket and insert it into the new one. Updates are O(log n), and max lookup is O(1) or O(log n).
Q. Which type of CPU scheduling algorithm is used in real-world operating systems and why?
asked 1xmediumOperating systemsTechnical2020
Ans. Real-world operating systems use preemptive, priority-based scheduling, often as a multilevel feedback queue or fair-share variant. They need to respond quickly to interactive tasks while still giving CPU time to background jobs. This hybrid approach balances fairness, responsiveness, throughput and priority handling better than simple FCFS or round-robin.
Q. How does the Google push notification system work and which Google application enables it?
asked 1xmediumNetworkingSystem design2020
Ans. Google push notifications work through Firebase Cloud Messaging, formerly GCM, where the app registers for a device token and the server sends messages to that token via Google’s servers. The device keeps a persistent connection to Google, so messages can be delivered efficiently. The enabling application is Google Play services.
Q. Explain CPU scheduling and compare algorithms like Round Robin and Shortest Job First (SJF)
asked 1xmediumOperating systemsTechnical2020
Ans. CPU scheduling decides which ready process gets the CPU next, aiming for good responsiveness, throughput, and low waiting time. Round Robin gives each process a fixed time slice, so it is fair and good for interactive systems. Shortest Job First runs the shortest burst first, giving low average waiting time, but can starve long jobs.
Q. What factors would you consider regarding localization vs globalization of tags in the system?
asked 1xmediumRequirements analysisSystem design2023
Ans. I would keep tags global as canonical IDs, and localise only their display names, descriptions, synonyms and search matching. The most important detail is not to treat translated words as separate tags, because that fragments content, analytics, moderation and recommendations. Locale-specific tags can exist only where concepts genuinely differ by region.
Q. Find the minimum number of platforms required at a railway/bus station so that no train/bus waits
asked 1xmediumArraysTechnical2022
Ans. Sort all arrival times and departure times separately, then scan them with two pointers, counting active trains. If the next arrival is before or at the next departure, one more platform is needed; otherwise one is freed. Track the maximum active count. This uses arrays only and runs in O(n log n) time.
Q. Given an initial string and a large list of strings, find the longest matching prefix for each string.
asked 1xmediumStringsTechnical2020
Ans. Compare each list string with the initial string character by character and record characters until the first mismatch or one string ends. The result is that substring. This uses no extra data structure beyond the output and runs in O(total compared characters), bounded by the sum of min(length(initial), length(string)) over all strings.
Q. Explain and justify the data structures chosen for implementing the file system and reporting functionality.
asked 1xmediumData structuresTechnical2023
Ans. Use a tree of directory and file nodes, with each directory storing its children in a hash map keyed by name. This matches the hierarchical path structure and gives fast lookup, insert and delete per path component. For reporting, maintain aggregate metadata such as size and file counts on nodes, updated on changes, so reports are efficient.
Q. Find the maximum sum path in a tree from one node to another. The path may or may not pass through the root.
asked 1xmediumTreesOnline test2020
Ans. Use a postorder DFS and keep a global maximum for the best path seen anywhere. For each node, compute the best downward path starting there: node value plus the better of left or right downward gain, ignoring negative gains. Update the global answer with left gain plus node value plus right gain. Time is O(n), space is O(h).
Q. Design and implement an efficient file management solution to handle operations on files, optimizing for performance
asked 1xmediumHashingTechnical2024
Ans. Use a trie-like directory tree, where each node represents a folder or file and stores its children in a hash map plus metadata such as size, owner and timestamps. Path lookup, create, delete and move run in O(k), where k is path depth. Hash maps make child access near O(1).
Q. Design a suggestion system that returns all dictionary words matching a given prefix, similar to Google search suggestions
asked 1xmediumTrieSystem design2020
Ans. Use a trie where each node represents a character, and store an end marker for complete words. To answer a query, traverse the prefix in O(p), then run DFS from that node to collect matching words. The key detail is result size dominates cost, so time is O(p + total output size).
Q. Given an integer n, determine the number of valid Binary Search Trees that can be formed using nodes numbered from 1 to n.
asked 1xmediumDynamic programmingOnline test2021
Ans. The number of valid Binary Search Trees with nodes 1 to n is the nth Catalan number. Use dynamic programming where dp[i] stores the number of BSTs using i nodes, and for each root choice combine left and right subtree counts. The recurrence is dp[n] = sum(dp[left] * dp[right]). Time complexity is O(n²).
Q. Explain and compare BFS, DFS, Dijkstra’s algorithm, Bidirectional BFS, and heuristic graph algorithms like PageRank and A*.
asked 1xmediumGraphsTechnical2020
Ans. BFS explores level by level for shortest paths in unweighted graphs, DFS explores deeply for traversal, Dijkstra finds shortest paths with non-negative weights, Bidirectional BFS searches from both ends, and heuristic algorithms guide exploration or ranking. A* uses a heuristic plus path cost, while PageRank iteratively scores nodes by link importance.
Q. Minimum Platforms Problem: Given arrival and departure times of trains, find the minimum number of platforms required so that no train waits
asked 1xmediumGreedyTechnical2020
Ans. Sort the arrival and departure times separately, then scan them with two pointers to find the maximum number of trains present at once. If the next arrival is before or equal to the next departure, add a platform; otherwise free one. The maximum count is the answer. Time complexity is O(n log n).
Q. Given a directed graph with n nodes and m edges representing relationships between people, find the minimum size of the largest strongly connected group.
asked 1xmediumGraphsOnline test2021
Ans. The answer is the size of the largest strongly connected component in the directed graph. Use Kosaraju’s or Tarjan’s algorithm with adjacency lists to find all strongly connected components, count their sizes, and take the maximum. This runs in O(n + m) time and uses O(n + m) space.
Q. Given two arrays A and B of long integers, find the lowest non-negative value X satisfying given pairing/constraint conditions between elements of A and B
asked 1xmediumArraysOnline test2022
Ans. Find X with binary search over the non-negative long range, using a feasibility check for each candidate value. Sort the arrays, then greedily form required pairs, using two pointers if the constraint is ordered, or a balanced multiset if arbitrary matching is needed. The key is monotonicity. Time is typically O(n log n log R).
Q. Given N, D, and T, count the number of binary strings of length N using unlimited 0s and 1s such that there are no D consecutive 0s and no T consecutive 1s
asked 1xmediumDynamic programmingOnline test2020
Ans. Use dynamic programming over the last character and its current run length. Let dp0[i][k] count length i strings ending with k zeros, where k < D, and dp1[i][k] similarly for ones, where k < T. Extend by same bit if allowed, or switch bit resetting run length to 1. Time is O(N(D+T)).
Q. Given an array of tower heights, for each index i find the nearest index j (left or right) such that arr[j] < arr[i]; if both exist, choose the closest one.
asked 1xmediumStacksOnline test2020
Ans. Use a monotonic increasing stack to compute the nearest smaller index on the left, and another pass to compute the nearest smaller index on the right. For each i, compare the two distances and choose the closer valid index. This runs in O(n) time and uses O(n) extra space.
Q. Given an IP address and lists of blocked IP addresses, blocked IP prefixes, and blocked ports, determine whether the given IP address should be allowed or blocked.
asked 1xmediumStringsTechnical2023
Ans. Block the request if the IP matches an exact blocked address, falls within any blocked prefix, or the port is blocked; otherwise allow it. Store exact IPs and ports in hash sets, convert IPs to integers, and store prefixes in a binary trie or ranges. Lookup is O(1) for sets and O(32) for IPv4 prefixes.
Showing 59 of 150 questions. Ranked by how often the same question came back across interviews.