Q. Reverse a singly linked list.
asked 3xeasyLinked listsTechnical2023-2024
Ans. Reverse it by walking through the list once and redirecting each node’s next pointer to the previous node. Keep three pointers: previous, current, and next, so you do not lose the remaining list. At the end, previous becomes the new head. Time is O(n), space is O(1).
Q. Explain ACID properties in DBMS
asked 3xeasyDBMSTechnical2023
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. Implement Quick Sort and explain its time complexity.
asked 2xmediumSortingTechnical2024
Ans. Quick Sort partitions the array around a pivot, then recursively sorts the elements smaller and larger than the pivot. It is usually implemented in place using two pointers during partitioning. Average and best time complexity is O(n log n), but worst case is O(n²) with poor pivot choices.
Q. What is the difference between C and C++?
asked 2xeasyProgramming languagesTechnical2023-2024
Ans. C is mainly a procedural systems programming language, while C++ extends C with object oriented and generic programming features. The key practical difference is that C++ provides classes, constructors, destructors, templates and a richer standard library, enabling abstractions such as RAII and containers while still supporting low level memory control.
Q. Explain semaphores vs mutex.
asked 1xmediumOperating systemsTechnical2023
Ans. A mutex gives exclusive ownership of a resource to one thread, while a semaphore controls access using a counter that may allow one or more threads. The key difference is ownership: the thread that locks a mutex should unlock it, but a semaphore can be signalled by a different thread.
Q. Merge overlapping intervals.
asked 1xmediumArraysTechnical2023
Ans. Sort the intervals by start time, then scan once, keeping a result list of merged intervals. For each interval, compare its start with the end of the last interval in the result. If they overlap, extend the end; otherwise, append it. Time complexity is O(n log n) due to sorting, with O(n) space.
Q. ChatGPT uses which algorithm?
asked 1xmediumMachine learningTechnical2023
Ans. ChatGPT uses a Transformer-based large language model algorithm. The key idea is self-attention, which lets the model weigh relationships between words or tokens in a sequence. It is trained on large text data to predict the next token, then often fine-tuned with human feedback to produce more helpful responses.
Q. Design a Traffic Light System.
asked 1xmediumObject oriented designSystem design2023
Ans. Use a finite state machine per junction, controlled by a scheduler that cycles green, amber and red phases with configurable timings. The key detail is safety: conflicting directions must never be green together, transitions pass through amber and all-red gaps, and failures should default to flashing amber or all-red while reporting faults.
Q. Discuss API design principles.
asked 1xmediumApi designTechnical2023
Ans. Good API design is simple, consistent, predictable, secure, and easy to evolve. Use clear resource names, standard HTTP methods and status codes, versioning, pagination, filtering, idempotency for retries, and structured error responses. The most important detail is to design around client needs while keeping contracts stable and backwards compatible.
Q. Temple and Magical Pond puzzle.
asked 1xmediumLogical reasoningTechnical2025
Ans. Work backwards. If he offers 8 flowers at each temple, he must have 8 before the last offering, so 4 before the last pond. Before that he needed 6 after offering, so 3 before the pond, and initially 7. More generally, 7k initially and 8k offered also works.
Q. Write the Quick Sort algorithm.
asked 1xmediumSortingTechnical2024
Ans. Quick Sort is a divide and conquer sorting algorithm that chooses a pivot, partitions the array so smaller elements go before it and larger elements after it, then recursively sorts both sides. Its key detail is pivot choice: average time is O(n log n), but poor pivots can make it O(n²).
Q. Count good nodes in a binary tree.
asked 1xmediumTreesTechnical2023
Ans. Traverse the tree with DFS, carrying the maximum value seen on the path from the root to the current node. A node is good if its value is at least that maximum, then update the maximum for its children. Use recursion or an explicit stack. Time complexity is O(n), space is O(h).
Q. How do you handle office politics?
asked 1xmediumWorkplace ethicsManagerial2023
Ans. Choose a situation where you stayed professional, neutral, and focused on shared goals rather than gossip or alliances. Emphasise listening, understanding stakeholders, communicating transparently, and escalating only when needed. Interviewers listen for maturity, discretion, emotional control, and evidence that you can build relationships without compromising values or productivity.
Q. Design an Interview Processing System.
asked 1xmediumHigh level designSystem design2023
Ans. Build an event-driven system where candidates, interviewers, schedules, feedback and decisions are separate services behind an API gateway. The key detail is workflow consistency: use a state machine for each application, with durable events for scheduled, completed, feedback submitted and decision made, so retries, notifications and audit history remain reliable.
Q. Implement a singly linked list in C++.
asked 1xmediumLinked listsTechnical2024
Ans. Implement it with a Node structure holding the value and a next pointer, and a LinkedList class holding the head pointer. Support insertion by relinking pointers, deletion by tracking the previous node, traversal by following next, and cleanup in the destructor. Head insertion is O(1); search, traversal, and delete by value are O(n).
Q. Design a database schema for a project.
asked 1xmediumDBMSTechnical2024
Ans. Use a relational schema with users, projects, tasks, comments, and project_members. Projects store owner, name, status, and dates. Tasks reference projects and assignees, with priority and state. The key detail is modelling many-to-many membership separately, so permissions, roles, and membership history are not duplicated or hidden in project records.
Q. What is thrashing in an Operating System?
asked 1xmediumOperating systemsTechnical2024
Ans. Thrashing is a state where an operating system spends most of its time swapping pages between RAM and disk instead of executing processes. It happens when memory demand is too high and processes suffer frequent page faults. The key effect is severe performance collapse, often fixed by reducing multiprogramming or adding memory.
Q. What is demand paging and how does it work?
asked 1xmediumOperating systemsTechnical2024
Ans. Demand paging is a virtual memory technique where pages are loaded into RAM only when a process actually needs them. If a referenced page is not in memory, a page fault occurs, the operating system loads it from disk into a free frame or replaces another page, then updates the page table.
Q. Count the number of islands in a graph/grid.
asked 1xmediumGraphsOnline test2024
Ans. Scan the grid and start a DFS or BFS whenever you find an unvisited land cell, counting that as one island. Use a visited set or mark cells in place, and explore the four neighbouring cells to consume the whole island. The time complexity is O(rows × columns), with similar worst-case space.
Q. Find the next permutation of a given string.
asked 1xmediumStringsOnline test2024
Ans. Scan the string from right to left to find the first character smaller than the character after it. Swap it with the smallest character greater than it on its right, then reverse the suffix after that position. This gives the next lexicographic permutation. If no such character exists, there is no higher permutation. Time is O(n).
Q. Explain DevOps and its mechanism in industry.
asked 1xmediumDevopsTechnical2024
Ans. DevOps is a software delivery approach that combines development and operations to release reliable systems faster. In industry it works through shared ownership, automation, continuous integration, continuous delivery, infrastructure as code, monitoring, and feedback loops. The key mechanism is automating build, test, deployment, and recovery so teams can make frequent, low-risk changes.
Q. Explain polymorphism and its types in detail.
asked 1xmediumOOPTechnical2023
Ans. Polymorphism means one interface or operation can work with different types and show different behaviour. The main types are compile-time polymorphism, such as method overloading and operator overloading, resolved by the compiler, and run-time polymorphism, such as method overriding through inheritance or interfaces, resolved by dynamic dispatch.
Q. What are closures and promises in JavaScript?
asked 1xmediumJavaScriptTechnical2024
Ans. Closures are functions that remember variables from their lexical scope even after the outer function has finished. Promises are objects representing the eventual success or failure of an asynchronous operation. The key detail is that closures preserve state, while promises structure async code through pending, fulfilled, and rejected states.
Q. Explain memory management in Operating Systems
asked 1xmediumOperating systemsTechnical2024
Ans. Memory management is the operating system’s job of allocating, tracking, protecting, and freeing main memory for processes. The key idea is virtual memory: each process sees its own address space, while the OS maps it to physical RAM using paging, handles swapping, and prevents one process accessing another’s memory.
Q. How would you handle a conflict within a team?
asked 1xmediumConflict resolutionHR2025
Ans. Pick a real conflict where the stakes mattered but emotions stayed manageable. Emphasise listening to both sides, clarifying facts, focusing on shared goals, and agreeing a practical next step. Show your own role clearly, including any compromise. Interviewers listen for maturity, fairness, communication, accountability, and a result that helped the team.
Q. Solve the 8 Balls Problem using a balance scale
asked 1xmediumLogical reasoningTechnical2023
Ans. Divide the 8 balls into groups of 3, 3 and 2. Weigh 3 against 3. If they balance, the heavier ball is among the remaining 2, so weigh them. If not, the heavier ball is in the heavier group of 3. Weigh two from that group. If equal, the third is heavier.
Q. Explain different types of database normalization
asked 1xmediumDBMSTechnical2024
Ans. Database normalization organises data to reduce duplication and avoid update anomalies, usually through normal forms. 1NF requires atomic values and no repeating groups. 2NF removes partial dependency on a composite key. 3NF removes transitive dependency between non-key attributes. BCNF is stricter, requiring every determinant to be a candidate key.
Q. What is a pointer and explain pointer arithmetic.
asked 1xmediumCTechnical2023
Ans. A pointer is a variable that stores the memory address of another object. Pointer arithmetic means adding, subtracting, incrementing or decrementing a pointer, with movement scaled by the size of the type it points to. For example, incrementing an int pointer moves to the next int, not the next byte. It is mainly valid within arrays.
Q. Explain tokenization, stemming, and lemmatization.
asked 1xmediumNlpTechnical2024
Ans. Tokenization splits text into smaller units such as words, subwords, or sentences. Stemming reduces words to a crude root by chopping endings, such as “running” to “run” or “studies” to “studi”. Lemmatization reduces words to their dictionary form using vocabulary and grammar, so it is usually more accurate but slower.
Q. Explain CI/CD pipelines and their working mechanism.
asked 1xmediumDevopsTechnical2024
Ans. CI/CD pipelines automate the process of building, testing and delivering software changes. When code is pushed, the pipeline usually compiles it, runs tests, performs quality and security checks, packages the application and deploys it to an environment. The key benefit is fast, repeatable releases with early detection of integration or deployment issues.
Q. Convert a given infix expression to postfix expression.
asked 1xmediumStacksTechnical2023
Ans. Use a stack to convert infix to postfix by scanning the expression left to right and outputting operands immediately. Push opening brackets, pop until an opening bracket on closing brackets, and for operators pop higher or equal precedence operators before pushing the current one. Finally pop remaining operators. This runs in O(n) time.
Q. Explain sorting algorithms and their time complexities.
asked 1xmediumSortingTechnical2024
Ans. Sorting algorithms arrange data in a defined order, usually ascending or descending, with different time and space costs. Bubble, selection and insertion sort are simple and usually O(n²). Merge sort is O(n log n) with extra space. Quick sort averages O(n log n) but can be O(n²). Heap sort is O(n log n).
Q. Explain the concept of semaphores in operating systems.
asked 1xmediumOperating systemsTechnical2023
Ans. A semaphore is a synchronisation primitive used by operating systems to control access to shared resources between threads or processes. It holds a counter that is changed using wait and signal operations. A binary semaphore acts like a lock, while a counting semaphore allows a fixed number of concurrent users.
Q. Explain virtual memory and paging in operating systems.
asked 1xmediumOperating systemsTechnical2024
Ans. Virtual memory lets each process see a large, private address space, while the operating system maps those virtual addresses to physical RAM or disk. Paging divides memory into fixed-size pages and frames, with page tables tracking mappings. The key detail is page faults: missing pages are loaded from storage into RAM when accessed.
Q. How would you resolve a conflict between two team leads?
asked 1xmediumConflict resolutionManagerial2023
Ans. Choose an example where the disagreement affected delivery, priorities, or team morale. Emphasise listening to both leads, separating facts from assumptions, aligning on shared goals, and agreeing clear next steps. Interviewers listen for neutrality, emotional control, fairness, communication skill, and whether you protect the wider team while resolving the issue constructively.
Q. Explain cryptographic hash functions and their use cases.
asked 1xmediumSecurityTechnical2024
Ans. A cryptographic hash function maps data of any size to a fixed-size digest in a way that is deterministic, fast to compute, and practically impossible to reverse or collide. The key property is collision resistance. Common uses include password storage with salt, file integrity checks, digital signatures, certificates, blockchains, and message authentication.
Q. Explain dynamic polymorphism and how it works at runtime.
asked 1xmediumOOPTechnical2024
Ans. Dynamic polymorphism means the method that runs is chosen at runtime based on the actual object type, not the reference type. It is usually achieved through method overriding and virtual methods. At runtime, the language uses dynamic dispatch, often via a virtual table, to call the correct overridden implementation.
Q. What are virtual functions and pure virtual functions in C++?
asked 1xmediumOOPTechnical2023
Ans. Virtual functions in C++ are member functions declared with virtual so calls are resolved at runtime based on the actual object type. Pure virtual functions are virtual functions declared with = 0, making the class abstract. Derived classes usually must override them to be instantiable, enabling polymorphism through base class pointers or references.
Q. Explain and resolve the diamond problem in multiple inheritance.
asked 1xmediumOOPTechnical2023
Ans. The diamond problem happens when a class inherits from two classes that both inherit from the same base, creating ambiguity about which base members are used. In C++, resolve it with virtual inheritance, so the most derived class contains only one shared base subobject and member lookup is unambiguous.
Q. How do you handle data preprocessing such as null value removal?
asked 1xmediumData processingTechnical2024
Ans. I handle null values by first measuring where they occur, then choosing removal only when the missing data is small, random, and not informative. Rows with critical missing fields can be dropped, while columns with too many nulls may be removed. The key detail is to make these decisions using training data only to avoid leakage.
Q. Write an SQL query to join two tables based on given conditions.
asked 1xmediumSQLTechnical2023
Ans. Use a SELECT with an explicit JOIN, naming both tables and putting the matching rules in the ON clause, such as matching customer_id in one table to customer_id in the other. Use INNER JOIN when both sides must match, or LEFT JOIN when all rows from the first table must remain. Cost depends on indexes and join size.
Q. Given an undirected graph, determine whether it contains a cycle.
asked 1xmediumGraphsManagerial2024
Ans. Use DFS or BFS and track the parent of each visited vertex. If you reach an already visited neighbour that is not the parent, the graph contains a cycle. Run this from every unvisited vertex to handle disconnected graphs. Store adjacency lists and a visited set. Time complexity is O(V + E).
Q. What is normalization in DBMS and explain different normal forms.
asked 1xmediumDBMSTechnical2023
Ans. Normalization in DBMS is the process of organising tables to reduce data redundancy and avoid update, insert and delete anomalies. 1NF removes repeating groups, 2NF removes partial dependency on a composite key, 3NF removes transitive dependency, and BCNF ensures every determinant is a candidate key. Higher forms handle more specialised dependencies.
Q. Write code to print alternate numbers on each run of the program.
asked 1xmediumImplementationTechnical2023
Ans. Use persistent state: store the last printed number, or just the current parity, in a small file or database. On each program start, read it, print the next alternate number, then update the stored value by adding 2. The data structure is a single integer. Time and space complexity are O(1).
Q. What is a Binary Search Tree and write code for insertion in a BST
asked 1xmediumTreesTechnical2023
Ans. A Binary Search Tree is a binary tree where each node’s left subtree contains smaller values and the right subtree contains larger values. To insert, start at the root, compare the new value, move left or right until a null child is found, then attach a new node there. Average time is O(log n), worst case O(n).
Q. Explain database normalization and describe Third Normal Form (3NF)
asked 1xmediumDBMSTechnical2024
Ans. Database normalization is the process of organising tables to reduce duplication and avoid update, insert and delete anomalies. Third Normal Form means a table is in Second Normal Form and every non-key attribute depends only on the key, not on another non-key attribute. In short, remove transitive dependencies into separate tables.
Q. What are the requirements of a Queue and how can it be implemented?
asked 1xmediumQueueTechnical2023
Ans. A queue must store items in first in, first out order, allowing insertion at the rear and removal from the front. It usually supports enqueue, dequeue, peek, isEmpty, and sometimes size. It can be implemented with a circular array or linked list, giving O(1) enqueue and dequeue when front and rear are tracked.
Q. Explain inheritance and friend class in Object-Oriented Programming.
asked 1xmediumOOPTechnical2025
Ans. Inheritance lets a class reuse and extend the data and behaviour of another class, forming a parent child relationship. It supports code reuse and polymorphism. A friend class, mainly in C++, is a class given special permission to access another class’s private and protected members, which should be used carefully to avoid breaking encapsulation.
Q. Explain operating system concepts related to CPU scheduling and cache
asked 1xmediumOperating systemsTechnical2023
Ans. CPU scheduling decides which ready process or thread runs next, while cache stores recently or frequently used data close to the CPU to reduce memory access time. Key scheduling goals include fairness, throughput, response time and avoiding starvation. Cache performance depends on locality, hit rate, replacement policy and consistency between cache and main memory.
Q. Using 3-liter and 5-liter bottles, measure exactly 4 liters of water.
asked 1xmediumLogical reasoningTechnical2024
Ans. Fill the 5-litre bottle and pour into the 3-litre bottle until it is full. This leaves 2 litres in the 5-litre bottle. Empty the 3-litre bottle, then pour those 2 litres into it. Fill the 5-litre bottle again and pour 1 litre into the 3-litre bottle, leaving exactly 4 litres.
Q. How can you optimize web page load times other than image optimization?
asked 1xmediumWebTechnical2024
Ans. Reduce the critical rendering path by shipping less JavaScript and CSS, loading only what is needed, and caching it well. Minify and bundle assets where useful, defer or async non-critical scripts, use code splitting, enable compression such as Brotli or gzip, use a CDN, and set proper cache headers for repeat visits.
Q. Is it possible to implement a stack using queues? Explain the approach.
asked 1xmediumStack queueTechnical2024
Ans. Yes, a stack can be implemented using queues by rearranging elements so the last inserted element is removed first. With two queues, push the new element into an empty queue, move all old elements behind it, then swap the queues. This makes push O(n), while pop and top are O(1).
Q. Implement Quick Sort and Merge Sort and explain their time complexities.
asked 1xmediumSortingTechnical2024
Ans. Quick Sort partitions the array around a pivot, recursively sorting smaller and larger sides; Merge Sort recursively splits the array in half, then merges sorted halves. Quick Sort averages O(n log n) but can be O(n²) with bad pivots. Merge Sort is always O(n log n) and uses O(n) extra space.
Q. Which loop or function is best for traversing objects in a list and why?
asked 1xmediumOOPTechnical2023
Ans. A for-each loop is usually best for traversing objects in a list because it is clear, simple, and avoids manual index handling. It visits each object once, so the time complexity is linear, O(n). Use an indexed loop only when you need the position as well as the object.
Q. Explain SQL joins and write a SQL query using joins based on given tables.
asked 1xmediumSQLTechnical2024
Ans. SQL joins combine rows from related tables using a matching column, such as a customer_id. INNER JOIN returns only matches, LEFT JOIN keeps all rows from the left table, RIGHT JOIN keeps all from the right, and FULL JOIN keeps both. For customers and orders, join them on customer_id to list each customer’s orders.
Q. Explain how a web browser retrieves data from a server when a URL is loaded.
asked 1xmediumNetworkingTechnical2024
Ans. A browser retrieves data by resolving the URL’s domain to an IP address, opening a connection to the server, sending an HTTP request, and receiving an HTTP response. The key detail is DNS resolution first, followed by TCP connection setup, usually with TLS for HTTPS, before the server returns headers and content.
Q. Calculate the angle between the hour hand and the minute hand of a clock at a given time.
asked 1xmediumLogical reasoningTechnical2023
Ans. Convert the time to angles from 12 o’clock. The minute hand moves 6 degrees per minute, so its angle is 6m. The hour hand moves 30 degrees per hour plus 0.5 degrees per minute, so its angle is 30h + 0.5m. Find the absolute difference, then use the smaller angle: min(difference, 360 - difference).
Q. Compare TCP and UDP protocols.
asked 1xeasyNetworkingTechnical2023
Ans. TCP is connection-oriented, reliable and ordered, while UDP is connectionless, faster and does not guarantee delivery or order. TCP uses handshakes, acknowledgements, retransmission and flow control, so it suits web pages, file transfer and email. UDP has lower overhead and latency, so it suits streaming, gaming, DNS and real-time voice or video.
Q. What is a Trie data structure?
asked 1xeasyTreesTechnical2023
Ans. Implement a Trie using nodes that store a map from character to child node and a boolean marking the end of a word. To insert or search, walk character by character, creating nodes for insert and failing early for search if a child is missing. Insert, search, and prefix lookup take O(L) time, where L is the string length.
Q. Print the following pattern using loops:
*###*
#*#*#
##*##
#*#*#
*###*
asked 1xeasyLogical reasoningTechnical2024
Ans. Use two nested loops for a 5 by 5 grid. For each position, print * if the row index equals the column index, or if row plus column equals 4. Otherwise print #. After each row, print a newline. This works because the stars form the two diagonals of the square.
Showing 60 of 258 questions. Ranked by how often the same question came back across interviews.