Q. Given maximum occurrences of 'a', 'b', and 'c', construct the longest possible string such that no three consecutive characters are the same.
asked 2xmediumStringsOnline test2019
Ans. Use a greedy max-heap of the remaining counts for a, b and c. Repeatedly choose the character with the highest remaining count, unless it would create three consecutive equal characters; in that case choose the next highest. If no valid character exists, stop. Time complexity is O(n log 3), effectively O(n).
Q. Explain ACID properties in DBMS.
asked 2xeasyDBMSTechnical2021
Ans. ACID properties are the guarantees that make database transactions reliable: Atomicity, Consistency, Isolation and Durability. Atomicity means all or nothing, Consistency keeps valid rules, Isolation prevents concurrent transactions interfering, and Durability ensures committed changes survive crashes. They are essential for correctness in systems handling critical data.
Q. What are the differences between C and C++?
asked 2xeasyOOPTechnical2021
Ans. C is a procedural language, while C++ is largely a superset of C with object oriented and generic programming features. C++ adds classes, inheritance, polymorphism, templates, exceptions, references, function overloading and the standard library. The most important difference is abstraction: C gives low level control, while C++ supports higher level design without losing that control.
Q. What is abstraction in Object-Oriented Programming?
asked 2xeasyOOPTechnical2021-2023
Ans. Abstraction in Object-Oriented Programming is the idea of exposing only the essential features of an object while hiding unnecessary implementation details. The key detail is that it lets users work with what an object does, not how it does it, often through interfaces, abstract classes, and public methods.
Q. What is the difference between SQL and NoSQL databases?
asked 2xeasyDBMSTechnical2020-2025
Ans. SQL databases store structured data in tables with fixed schemas and use SQL for relational queries. NoSQL databases use more flexible models such as documents, key value pairs, columns, or graphs. The key difference is that SQL favours strong consistency and complex joins, while NoSQL often favours flexibility, scale, and high availability.
Q. What is inheritance and what are the types of inheritance?
asked 2xeasyOOPTechnical2020-2021
Ans. Inheritance is an object-oriented programming concept where a class derives properties and behaviour from another class, enabling code reuse and specialisation. The main types are single, multiple, multilevel, hierarchical and hybrid inheritance. The key detail is that language support differs, for example Java does not allow multiple inheritance of classes but supports it through interfaces.
Q. Find the Lowest Common Ancestor (LCA) of two nodes in a Binary Tree
asked 2xeasyTreesOnline test, Technical2017-2022
Ans. Use a recursive depth first search: if the current root is null or equals either target node, return it. Search left and right subtrees. If both return non-null, the current root is the LCA; otherwise return the non-null side. This uses the call stack, with linear time and tree-height space.
Q. What is the difference between function overloading and function overriding?
asked 2xeasyOOPTechnical2020-2021
Ans. Function overloading means defining multiple functions with the same name but different parameter lists, while function overriding means a subclass provides its own implementation of a method already defined in its superclass. Overloading is resolved at compile time in many languages; overriding is resolved at run time using dynamic dispatch.
Q. Explain different types of RAID.
asked 1xmediumDBMSTechnical2019
Ans. RAID types combine disks for performance, redundancy, or both. RAID 0 stripes data for speed but has no fault tolerance. RAID 1 mirrors data and survives one disk failure. RAID 5 uses distributed parity and survives one failure. RAID 6 survives two failures. RAID 10 combines mirroring and striping for speed and resilience.
Q. Explain how HTTP and HTTPS work.
asked 1xmediumNetworkingManagerial2023
Ans. HTTP is a stateless request response protocol where a client, usually a browser, sends a request to a server and receives a response with status, headers and content. HTTPS is HTTP over TLS, which encrypts the data, verifies the server’s identity with certificates and protects messages from tampering in transit.
Q. Detect a cycle in a Directed Graph
asked 1xmediumGraphsTechnical2022
Ans. Use DFS with a recursion stack to detect a cycle in a directed graph. Mark each node as unvisited, visiting, or visited. During DFS, if you reach a node marked visiting, there is a cycle. If DFS finishes, mark it visited. This takes O(V + E) time and O(V) space.
Q. Explain the locking system in DBMS.
asked 1xmediumDBMSTechnical2021
Ans. A locking system in a DBMS controls concurrent access to data so transactions do not conflict and data stays consistent. A shared lock allows multiple transactions to read, while an exclusive lock allows one transaction to write. The key issue is lock granularity and protocols like two phase locking, which help ensure serialisability.
Q. Explain JWT authentication in detail.
asked 1xmediumSecurityTechnical2023
Ans. JWT authentication uses a signed JSON Web Token to prove a user’s identity without storing session state on the server. After login, the server issues a token containing claims such as user id and expiry. The client sends it in the Authorization header. The server validates the signature, expiry and claims before allowing access.
Q. How is KNN used in sentiment analysis?
asked 1xmediumMachine learningTechnical2019
Ans. KNN is used in sentiment analysis by representing each text as a feature vector and assigning the sentiment most common among its k nearest labelled examples. Text is usually vectorised with TF-IDF, bag-of-words, or embeddings, and cosine similarity is often used because word-count vectors are high-dimensional and sparse.
Q. What is swapping in operating systems?
asked 1xmediumOperating systemsTechnical2020
Ans. Swapping is an operating system memory management technique where data, pages, or entire processes are moved between main memory and disk. It frees RAM when memory is under pressure and brings the data back when needed. The key point is that disk access is much slower than RAM, so excessive swapping hurts performance.
Q. Explain 1NF, 2NF, and 3NF with examples.
asked 1xmediumDBMSTechnical2020
Ans. 1NF means atomic fields, 2NF removes partial dependency on a composite key, and 3NF removes transitive dependency. For example, a table with multiple phone numbers in one cell breaks 1NF. A course enrolment table storing student name by student ID breaks 2NF. Storing department location via department ID in employee breaks 3NF.
Q. What are SSH keys and how are they used?
asked 1xmediumNetworkingTechnical2021
Ans. SSH keys are a pair of cryptographic keys used to authenticate securely to remote systems, commonly over SSH. The public key is placed on the server, while the private key stays on the client and must be protected. During login, the server verifies you hold the private key without receiving it.
Q. Find the Kth largest element in an array.
asked 1xmediumArraysTechnical2023
Ans. Use Quickselect to find the Kth largest element by partitioning the array around a pivot and only recursing into the side that can contain the answer. Convert it to the index n minus k in sorted ascending order. Average time is O(n), worst case O(n²), with O(1) extra space.
Q. Explain the lifecycle of a thread in Java.
asked 1xmediumOperating systemsTechnical2023
Ans. A Java thread moves through NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING and TERMINATED states. It is NEW after creation, becomes RUNNABLE after start(), may run when scheduled, may block on locks or wait for signals or timeouts, and ends when run() completes or throws. A terminated thread cannot be restarted.
Q. How are NPM packages versioned and managed?
asked 1xmediumSoftware toolsTechnical2024
Ans. NPM packages are versioned using semantic versioning: major, minor and patch, such as 2.3.1. Dependencies are declared in package.json, often with ranges like caret or tilde. The package-lock.json file records exact resolved versions, making installs repeatable across machines and environments.
Q. Explain ACID properties and the CAP theorem.
asked 1xmediumDBMSTechnical2025
Ans. ACID describes reliable database transactions: Atomicity means all or nothing, Consistency preserves valid rules, Isolation hides concurrent transaction effects, and Durability makes committed data survive failures. CAP says a distributed system cannot fully guarantee Consistency, Availability, and Partition tolerance at once; during network partitions, it must choose consistency or availability.
Q. Explain the workflow of a credit card system
asked 1xmediumDomain knowledgeTechnical2020
Ans. A credit card payment goes from authorisation to clearing and then settlement. The merchant sends the transaction to its acquirer, through the card network, to the issuer. The issuer checks the card, funds, fraud rules and approves or declines. Later, approved transactions are batched, fees are applied, and money is settled to the merchant.
Q. Explain the types of trees in data structures.
asked 1xmediumTreesTechnical2021
Ans. Common tree types include general trees, binary trees, binary search trees, balanced trees, heaps, tries, and B-trees. The key difference is how nodes are organised and what operation they optimise. Binary search trees support ordered lookup, heaps support priority access, tries support prefix search, and B-trees support efficient disk-based indexing.
Q. What are the steps to connect MySQL with Java?
asked 1xmediumDBMSTechnical2019
Ans. Add the MySQL JDBC driver, import JDBC classes, create a connection using DriverManager with the MySQL URL, username and password, then create a Statement or PreparedStatement to run queries. Process the ResultSet for reads, handle exceptions, and close ResultSet, Statement and Connection, preferably with try-with-resources.
Q. What is JWT and how is it used with REST APIs?
asked 1xmediumSecurityManagerial2024
Ans. JWT is a JSON Web Token, a compact signed token used to prove a user’s identity and claims to a REST API. After login, the server issues a JWT and the client sends it in the Authorization header, usually as a Bearer token. The key detail is that the API verifies the signature and expiry before trusting it.
Q. Explain the singleton design pattern with code.
asked 1xmediumDesign patternsTechnical2023
Ans. The Singleton pattern ensures a class has exactly one instance and provides a global access point to it. It is usually implemented with a private constructor and a static method or property returning the instance. The key detail is thread safety, especially if the instance is created lazily in a multi-threaded program.
Q. How can deadlocks be managed or avoided in Java?
asked 1xmediumOperating systemsTechnical2023
Ans. Deadlocks in Java are avoided by ensuring threads acquire locks in a consistent global order and release them promptly. Keep synchronised sections small, avoid calling external code while holding locks, and prefer higher-level concurrency utilities. ReentrantLock with tryLock and timeouts can help recover, while thread dumps can diagnose deadlocks.
Q. How do you react when disputes happen in a team?
asked 1xmediumTeamworkHR2021
Ans. Pick a real dispute where you stayed calm, listened to both sides, and helped move the team towards a decision. Emphasise facts, respect, shared goals, and any compromise or escalation used. Interviewers listen for emotional control, fairness, communication, accountability, and proof that conflict led to progress rather than blame.
Q. Find the pivot element in a rotated sorted array.
asked 1xmediumBinary searchTechnical2021
Ans. Use binary search to find the pivot, usually the smallest element, where the sorted order restarts. Compare the middle element with the rightmost element: if mid is greater, the pivot is in the right half; otherwise it is in the left half including mid. This takes O(log n) time and O(1) space.
Q. How are multithreading and CPU scheduling related?
asked 1xmediumOperating systemsTechnical2020
Ans. Multithreading provides multiple threads that can run, and CPU scheduling decides which runnable thread gets CPU time and when. On a single core, scheduling interleaves threads to give concurrency. On multiple cores, it can run threads in parallel. The key detail is that schedulers usually schedule kernel-level threads, not whole processes.
Q. How does authentication work in a web application?
asked 1xmediumSecurityManagerial2024
Ans. Authentication verifies a user’s identity, usually by checking submitted credentials against stored user data, then issuing a session cookie or token for later requests. The key detail is that passwords should never be stored directly; store salted password hashes, use HTTPS, and protect cookies with secure, HttpOnly and same-site settings.
Q. What are the different types of memory in a browser?
asked 1xmediumFrontendTechnical2023
Ans. The main types are stack memory and heap memory. The stack stores function calls, local variables, and primitive values with short lifetimes. The heap stores objects, arrays, closures, DOM nodes, and other dynamically allocated data. In JavaScript, heap memory is managed by garbage collection when objects are no longer reachable.
Q. Write SQL queries to retrieve data from given tables
asked 1xmediumSQLOnline test2020
Ans. Use SELECT to choose columns, FROM to name tables, WHERE to filter rows, JOIN to combine related tables, GROUP BY for aggregation, and ORDER BY for sorting. The key detail is matching joins on primary and foreign keys. Indexes on filter and join columns usually make retrieval close to logarithmic lookup rather than full table scans.
Q. Count the number of subarrays with sum equal to zero.
asked 1xmediumArraysOnline test2020
Ans. Use prefix sums and a hash map of prefix sum frequencies to count zero-sum subarrays in one pass. Start with frequency of sum 0 as 1. For each element, update the running sum; if it has appeared before, add its frequency to the answer, then increment that frequency. Time is O(n), space is O(n).
Q. Estimate how many marriages happen in Delhi in a year.
asked 1xmediumGuesstimationManagerial2020
Ans. About 1.5 to 2 lakh marriages happen in Delhi each year. Take Delhi’s population as roughly 2 crore. About 1.5% to 2% of the population enters the main marriage age band each year, and roughly half form couples. That gives around 150,000 to 200,000 weddings annually, before small adjustments for remarriages or migrants.
Q. Explain OAuth and how you implemented it in a project.
asked 1xmediumNetworkingTechnical2021
Ans. OAuth is an authorisation framework that lets an application access a user’s resources without handling their password. I implemented OAuth 2.0 using the authorisation code flow: redirecting users to the provider, exchanging the returned code for tokens, storing refresh tokens securely, and sending access tokens on API requests.
Q. What do you know about DevOps, Docker, and Kubernetes?
asked 1xmediumDevopsTechnical2021
Ans. DevOps is a culture and set of practices that bring development and operations together to deliver software faster and more reliably. Docker packages applications with their dependencies into portable containers. Kubernetes orchestrates those containers, handling deployment, scaling, service discovery, load balancing, and recovery when containers or nodes fail.
Q. Design a database schema for a school management system
asked 1xmediumDatabase designSystem design2022
Ans. Use a relational schema with tables for students, guardians, teachers, classes, subjects, enrolments, attendance, exams, marks, fees and users. The key detail is modelling many to many relationships with junction tables, such as student enrolments in classes and teacher assignments to subjects. Add primary keys, foreign keys, unique constraints and indexes on common searches.
Q. Explain the flow of a website from frontend to backend.
asked 1xmediumWebManagerial2024
Ans. A website flow starts when the browser requests a page, renders the frontend, then sends API requests to the backend for data or actions. The backend receives the request, validates it, runs business logic, reads or writes the database, and returns a response, usually JSON, which the frontend uses to update the UI.
Q. Explain how CPU scheduling works in an operating system.
asked 1xmediumOperating systemsTechnical2020
Ans. CPU scheduling is how the operating system chooses which ready process or thread runs next on the CPU. The scheduler keeps runnable tasks in scheduling queues and applies a policy such as round robin, priority, or shortest job first. The key trade-off is fairness, responsiveness, throughput, and context-switch overhead.
Q. How can you cut a cake three times to get 8 equal pieces?
asked 1xmediumLogical reasoningTechnical2020
Ans. Make two straight cuts down through the cake at right angles, crossing in the centre, so the top is divided into four equal quarters. Then make one horizontal cut halfway up the cake, parallel to the table. That single cut splits each quarter into two equal layers, giving 4 times 2 equals 8 equal pieces.
Q. How can you measure 45 minutes using two identical wires?
asked 1xmediumLogical reasoningTechnical2021
Ans. Assuming each wire takes 60 minutes to burn, light the first wire at both ends and the second at one end. The first wire burns out in 30 minutes. At that moment, light the other end of the second wire. Its remaining burn time is 30 minutes, so burning from both ends takes 15 more minutes: 45 total.
Q. Solve guesstimate problems by choosing correct parameters
asked 1xmediumEstimationTechnical2020
Ans. Choose the few parameters that drive the estimate, split the problem into simple parts, assign plausible values, then multiply through and sanity check. For example, estimate daily coffee cups in London as population times coffee drinkers times cups per drinker: 9 million times 50% times 1.5 gives about 7 million cups per day.
Q. Check whether a given point lies inside a triangle or not.
asked 1xmediumGeometryOnline test2020
Ans. Use orientation tests: a point lies inside or on a triangle if it is on the same side of all three directed edges. Compute the sign of cross products for edges AB, BC and CA with the point. If all signs are non-negative or all non-positive, return true. Time complexity is O(1).
Q. Describe a decision in your life that you later regretted.
asked 1xmediumSelf reflectionHR2021
Ans. Choose a real but not damaging example, such as delaying feedback, taking on too much work, or not asking for help early. Emphasise your judgement at the time, what went wrong, and the specific lesson you applied later. Interviewers listen for ownership, self-awareness, maturity, and evidence that regret led to better decisions.
Q. Explain how to manage and update versions of npm packages.
asked 1xmediumToolsTechnical2024
Ans. Manage npm package versions through package.json and the lock file, using semantic version ranges for allowed updates and package-lock.json for exact installed versions. Check changes with npm outdated, update with npm update, or install a specific version with npm install package@version. Commit the lock file and test after upgrades.
Q. Explain the Trie data structure and its common operations.
asked 1xmediumTreesTechnical2017
Ans. A Trie is a tree data structure used to store strings by sharing common prefixes. Each node represents a character, and paths from the root form words. Common operations are insert, search, and prefix search. Each takes O(L) time, where L is the word length, but Tries can use significant memory.
Q. Write a MySQL query to create a table and add constraints.
asked 1xmediumSQLTechnical2019
Ans. Use a CREATE TABLE statement with column definitions followed by constraints such as primary key, foreign key, unique, not null, check and default. The database stores this as schema metadata, not an application data structure. Creating the table is generally constant time, excluding validation or storage engine overhead.
Q. Explain cookies and how servers use them to manage sessions
asked 1xmediumNetworkingTechnical2021
Ans. Cookies are small name value pieces of data that a server asks a browser to store and send back on later requests. For sessions, the server usually stores session data server side and puts only a session ID in the cookie, letting it recognise the user across stateless HTTP requests. Secure, HttpOnly and SameSite flags reduce risk.
Q. What are common applications of graphs in computer science?
asked 1xmediumGraphsTechnical2021
Ans. Graphs are used to model relationships and connections, such as social networks, web pages, computer networks, maps, dependency graphs, and recommendation systems. The key idea is that vertices represent entities and edges represent relationships, allowing algorithms like BFS, DFS, shortest path, and topological sort to solve real problems efficiently.
Q. Compare SQL and NoSQL databases and explain when to use each.
asked 1xmediumDBMSTechnical2023
Ans. SQL databases are best for structured data, strong consistency, complex queries and transactions, while NoSQL databases suit flexible schemas, high scale, fast writes and distributed systems. Use SQL for banking, orders or reporting where relationships matter. Use NoSQL for logs, feeds, caching, documents or rapidly changing data models.
Q. Estimate how many people in Delhi drive their car themselves.
asked 1xmediumGuesstimationManagerial2020
Ans. About 1.5 million people. Delhi has roughly 20 million residents, perhaps 12 million adults. If around 25% of adults live in car-owning households, that is 3 million potential car users. Assuming about half are regular drivers and drive themselves rather than using chauffeurs, the estimate is roughly 1.5 million.
Q. Discuss and analyze a given case study during company presentation
asked 1xmediumProblem solvingGroup discussion2020
Ans. Choose a case where you quickly understood the business context, identified the core problem, and made a structured recommendation. Emphasise your reasoning, trade-offs, data used, and collaboration with stakeholders. Interviewers listen for commercial awareness, clear thinking, prioritisation, communication under pressure, and whether your conclusion is practical rather than just theoretically correct.
Q. How would you handle simultaneous orders of the same product in a system?
asked 1xmediumConcurrencyManagerial2023
Ans. I would handle it by making stock reservation an atomic operation in the database or inventory service. Each order attempts to decrement available stock only if stock is still positive, using a transaction with row locking or optimistic version checks. Failed updates mean the item is sold out, preventing overselling under concurrent requests.
Q. How would you optimize your code to handle multiple simultaneous requests?
asked 1xmediumPerformanceManagerial2023
Ans. I would make request handling non-blocking, keep shared state minimal, and use concurrency controls so slow I/O does not block other users. The key detail is to protect bottlenecks: use connection pooling, caching, queues for expensive background work, rate limits, and horizontal scaling with stateless workers behind a load balancer.
Q. There are two girls; given that one of them is a girl, what is the probability that both of them are girls?
asked 1xmediumProbabilityTechnical2019
Ans. The probability is 1/3, assuming two children and “one is a girl” means at least one is a girl. List equally likely possibilities: BB, BG, GB, GG. Remove BB because it has no girl. Of the remaining three cases, only GG has both girls. If a specific child is known to be a girl, it becomes 1/2.
Q. Reverse a linked list
asked 1xeasyLinked listsTechnical2022
Ans. Reverse a linked list by iterating through it and changing each node’s next pointer to point to the previous node. Keep three pointers: previous, current, and next, so you do not lose the rest of the list. At the end, previous is the new head. Time complexity is O(n), space complexity is O(1).
Q. Detect a cycle in a linked list
asked 1xeasyLinked listsSystem design2022
Ans. Use Floyd’s tortoise and hare algorithm: keep two pointers, one moving one node at a time and the other moving two nodes at a time. If they ever meet, there is a cycle. If the fast pointer reaches null, there is no cycle. It uses constant extra space and runs in O(n) time.
Q. Given a series of prime numbers, find the next number in the series.
asked 1xeasyNumber seriesTechnical2021
Ans. List the prime numbers in order and compare the given series with that list. Check whether it uses consecutive primes or skips by a fixed pattern, such as every second prime or increasing gaps. Once the rule is clear, continue the same pattern and choose the next prime in that position.
Q. Find the count of 3-digit numbers that are multiples of both 3 and 4.
asked 1xeasyNumber theoryTechnical2021
Ans. 75. A number that is a multiple of both 3 and 4 must be a multiple of their LCM, 12. Count the 3-digit multiples of 12: from 100 to 999. This is floor(999/12) minus floor(99/12), which is 83 minus 8, giving 75.
Showing 60 of 319 questions. Ranked by how often the same question came back across interviews.