Q. Explain ACID properties in DBMS.
asked 6xeasyDBMSTechnical2023-2024
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. Reverse a linked list.
asked 5xeasyLinked listsTechnical2017-2023
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. Explain Heap Sort algorithm.
asked 3xmediumSortingTechnical2017-2021
Ans. Heap Sort sorts an array by first building a binary heap, usually a max heap, then repeatedly moving the largest element to the end and restoring the heap property. The key detail is heapify: it fixes a subtree in logarithmic time. Overall time is O(n log n), with O(1) extra space.
Q. Write the merge sort algorithm
asked 3xmediumSortingTechnical2019-2024
Ans. Merge sort is a divide and conquer sorting algorithm that splits the array into halves, sorts each half recursively, then merges the sorted halves. The key step is merging by comparing the smallest remaining elements. It runs in O(n log n) time and usually needs O(n) extra space.
Q. Reverse a singly linked list.
asked 3xeasyLinked listsTechnical2019-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. Detect a loop in a linked list.
asked 3xeasyLinked listsTechnical2017-2020
Ans. Use Floyd’s cycle detection with two pointers, slow and fast, starting at the head. Move slow one node at a time and fast two nodes at a time. If they ever meet, there is a loop. If fast reaches null, there is no loop. This runs in O(n) time and O(1) space.
Q. What is a deadlock in Operating Systems?
asked 3xeasyOperating systemsTechnical2023-2024
Ans. Deadlock is a state where two or more processes are permanently blocked because each is waiting for a resource held by another process. The key point is that none can continue without external intervention. It typically requires mutual exclusion, hold and wait, no preemption, and circular wait to occur.
Q. What is the difference between SQL and MongoDB?
asked 3xeasyDBMSTechnical2021-2023
Ans. SQL databases are relational and store data in tables with fixed schemas, while MongoDB is a NoSQL document database that stores data as flexible JSON-like documents. The key difference is modelling: SQL is best for structured data and joins, while MongoDB suits changing, nested, or document-oriented data.
Q. Explain polymorphism in object-oriented programming.
asked 3xeasyOOPTechnical2020-2023
Ans. Polymorphism is the ability to treat different object types through the same interface while each type provides its own behaviour. For example, different shapes can all have an area method, but each calculates it differently. The key benefit is writing flexible code that depends on common behaviour rather than specific concrete classes.
Q. Find all triplets in an array with a given sum.
asked 2xmediumArraysTechnical2020
Ans. Sort the array, then fix one element and use two pointers on the remaining range to find pairs that complete the target sum. Move the left or right pointer based on whether the current sum is too small or too large. Skip duplicates if unique triplets are required. Time complexity is O(n²), space is O(1) apart from output.
Q. Explain the difference between mutex and semaphore.
asked 2xmediumOperating systemsTechnical2017-2019
Ans. A mutex is a lock for exclusive access by one thread, while a semaphore is a counter that allows a fixed number of threads to access a resource. The key difference is ownership: the thread that locks a mutex should unlock it, but a semaphore can be signalled by another thread.
Q. Solve the Coin Change problem using dynamic programming.
asked 2xmediumDynamic programmingTechnical2017-2020
Ans. Use a one-dimensional DP array where dp[x] stores the minimum number of coins needed to make amount x. Initialise dp[0] to 0 and all other entries to infinity, then for each amount try every coin and update dp[x]. The answer is dp[amount], or -1 if unreachable. Time is O(amount × coins), space is O(amount).
Q. Explain the Quick Sort algorithm and write its pseudocode.
asked 2xmediumSortingTechnical2020
Ans. Quick Sort sorts by choosing a pivot, partitioning the array so smaller elements go left and larger elements go right, then recursively sorting both parts. In pseudocode words: quicksort range, partition around pivot, recurse on left range, recurse on right range. It is in-place, averages O(n log n), but worst case is O(n²).
Q. Count possible paths from top-left to bottom-right in an N x M matrix
asked 2xmediumDynamic programmingOnline test, Technical2021
Ans. The number of paths is C(N + M - 2, N - 1), assuming you can only move right or down. You must make exactly N - 1 down moves and M - 1 right moves in any order. A dynamic programming solution also works using a 2D table, in O(NM) time.
Q. Given an array, find the maximum value of a[i] + (a[j] * a[k]) such that i < j < k and a[i] < a[j] < a[k].
asked 2xmediumArraysOnline test2021
Ans. Scan each element as the middle value and maximise using the best valid value on each side. Keep a balanced set of previous values to find the largest a[i] below a[j], and a multiset of later values to find the best a[k] above a[j]. Evaluate valid triples and update the answer in O(n log n).
Q. How would you handle a situation where a team member is not contributing and you are overloaded with work?
asked 2xmediumTeamworkManagerial2020
Ans. Pick a real example where you stayed professional, addressed the issue early, and protected delivery. Emphasise clarifying responsibilities, speaking privately with the team member, offering help if there was a blocker, and escalating only if needed. Interviewers listen for accountability, fairness, communication, and the ability to manage workload without blame.
Q. Given n numbers, you can remember k distinct integers. For every extra integer you can't remember, you have to pay a value X. Find the total amount you have to pay.
asked 2xmediumArraysOnline test2021-2023
Ans. The total amount is max(0, distinct_count minus k) multiplied by X. Count how many different integers appear in the n numbers, because remembering duplicates costs nothing extra. Use a hash set to track distinct values, then compute the excess over k. Time complexity is O(n), with O(distinct_count) space.
Q. Given an array, find the minimum cost of jumping out of the array. You can either jump 2 indices forward or 1 index backward, and the cost of a jump from index i is a[i].
asked 2xmediumDynamic programmingOnline test2020-2021
Ans. Model each index as a node and run Dijkstra from index 0 to a virtual exit node. From index i, add edges to i + 2, or exit if past the end, and to i - 1 if valid, each with cost a[i]. With non-negative costs, this gives the minimum cost in O(n log n).
Q. Explain the internal implementation of HashMap
asked 2xhardData structuresTechnical2019-2024
Ans. A HashMap is implemented as an array of buckets, where a key’s hash code is transformed into an index to store the key value entry. If multiple keys map to the same bucket, collisions are handled using a linked list or, in modern Java, a balanced tree after a threshold. Resizing happens when the load factor is exceeded.
Q. Compare SQL and NoSQL databases
asked 2xeasyDBMSTechnical2024
Ans. SQL databases are relational, schema based, and use SQL for structured queries, while NoSQL databases use models such as document, key value, column, or graph for more flexible data. SQL usually gives strong consistency and joins; NoSQL is often chosen for horizontal scaling, high throughput, and changing data structures.
Q. Compare arrays and linked lists.
asked 2xeasyData structuresTechnical2020-2021
Ans. Arrays store elements contiguously and give fast index access, while linked lists store nodes connected by pointers and support easier insertion or deletion when the position is known. Arrays have O(1) access but costly middle inserts. Linked lists have O(n) access, extra pointer memory, and poorer cache locality.
Q. Implement a queue using two stacks.
asked 2xeasyStack queueTechnical2017-2023
Ans. Use two stacks, one for incoming elements and one for outgoing elements. Enqueue pushes onto the incoming stack. Dequeue pops from the outgoing stack; if it is empty, move all elements from incoming to outgoing first. This reverses order correctly. Each operation is amortised O(1), with O(n) extra space.
Q. What is paging in operating systems?
asked 2xeasyOperating systemsTechnical2021
Ans. Paging is a memory management technique where a process’s virtual address space is split into fixed-size pages, and physical memory is split into same-size frames. The OS maps pages to frames using a page table, allowing non-contiguous allocation. The key benefit is avoiding external fragmentation while supporting virtual memory.
Q. Explain different types of SQL joins.
asked 2xeasyDBMSTechnical2017-2021
Ans. SQL joins combine rows from related tables using a matching condition, usually a key. INNER JOIN returns only matching rows. LEFT JOIN returns all rows from the left table plus matches from the right. RIGHT JOIN is the reverse. FULL OUTER JOIN returns all rows from both sides. CROSS JOIN returns every combination of rows.
Q. Difference between Array and Linked List.
asked 2xeasyData structuresTechnical2020
Ans. An array stores elements in contiguous memory and supports fast index access, while a linked list stores elements as nodes connected by pointers and is efficient for insertions or deletions when the position is known. Arrays are usually better for searching by index and cache performance. Linked lists use extra memory for pointers.
Q. Difference between a router and a bridge.
asked 2xeasyNetworkingManagerial, Technical2021-2024
Ans. A bridge connects network segments at the data link layer, while a router connects different networks at the network layer. A bridge forwards frames using MAC addresses, usually within one LAN. A router forwards packets using IP addresses, chooses paths between networks, and separates broadcast domains.
Q. Search for a key in a Binary Search Tree.
asked 2xeasyTreesTechnical2020
Ans. Search a Binary Search Tree by comparing the key with the current node and moving left if it is smaller, right if it is larger, and stopping when it matches or reaches null. This uses the BST ordering property. Time complexity is O(h), where h is tree height, O(log n) if balanced and O(n) if skewed.
Q. Add 1 to a number represented as a string.
asked 2xeasyStringsTechnical2020
Ans. Scan the string from right to left, add one with a carry, and update digits until the carry becomes zero. Use a mutable character array or string builder because strings are often immutable. If all digits are 9, prepend 1 and set the rest to 0. Time complexity is O(n), space is O(n).
Q. Explain heap sort and its time complexity.
asked 2xeasySortingTechnical2019-2020
Ans. Heap sort sorts an array by first building a binary heap, usually a max heap, then repeatedly swapping the largest element with the last unsorted position and heapifying the reduced heap. Building the heap takes O(n), each removal costs O(log n), so total time is O(n log n). Space is O(1).
Q. Explain inheritance and virtual functions.
asked 2xeasyOOPTechnical2021
Ans. Inheritance lets a class reuse and extend the data and behaviour of another class. The existing class is the base class, and the new class is the derived class. Virtual functions allow method calls to be resolved at run time, so a base class reference can call the derived class’s overridden implementation.
Q. Difference between SQL and NoSQL databases.
asked 2xeasyDBMSTechnical2020-2021
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. Explain the difference between DBMS and RDBMS.
asked 2xeasyDBMSTechnical2023-2024
Ans. A DBMS stores and manages data, while an RDBMS is a type of DBMS that stores data in related tables. The key difference is that an RDBMS enforces relationships using keys, such as primary and foreign keys, and usually supports SQL, constraints, normalisation, and stronger data integrity rules.
Q. What are the differences between C++ and Java?
asked 2xeasyProgramming languagesTechnical2020-2023
Ans. C is a procedural, compiled, low-level language with manual memory management, while Java is object-oriented, runs on a virtual machine, and uses garbage collection. C gives more control over memory and hardware, so it is common in systems programming. Java favours portability, safety, and large application development through its standard runtime.
Q. What is the difference between an Array and a List?
asked 2xeasyData structuresTechnical2020
Ans. An array is a fixed-size, indexed block of elements, while a list is a more flexible collection that can grow or shrink. Arrays usually give fast random access by index. Lists are easier for adding and removing items, though performance depends on whether the list is backed by an array or linked nodes.
Q. Difference between Machine Learning and Deep Learning.
asked 2xeasyAi mlTechnical2020-2021
Ans. Machine Learning is a broad field where algorithms learn patterns from data, while Deep Learning is a subset that uses multi-layer neural networks to learn complex representations. The key difference is feature handling: traditional ML often needs human-designed features, whereas deep learning can learn features automatically, especially from large unstructured data like images, speech and text.
Q. Differentiate between DDL, DML, and DCL with examples.
asked 2xeasyDBMSTechnical2023-2024
Ans. DDL defines or changes database structure, DML reads or modifies the data, and DCL controls access permissions. Examples of DDL are CREATE TABLE, ALTER TABLE and DROP TABLE. Examples of DML are SELECT, INSERT, UPDATE and DELETE. Examples of DCL are GRANT and REVOKE. DDL often causes structural, schema-level changes.
Q. Explain linked list insertion and deletion operations.
asked 2xeasyLinked listsTechnical2017-2019
Ans. Linked list insertion and deletion work by changing node pointers rather than shifting elements. To insert, create a node and link it between the previous node and the next node. To delete, make the previous node point to the deleted node’s next node. The key detail is handling head updates. Operations are O(1) once the position is known.
Q. Explain the difference between Merge Sort and Quick Sort.
asked 2xeasySortingTechnical2017-2024
Ans. Merge Sort splits the array, sorts both halves, then merges them, while Quick Sort chooses a pivot and partitions elements around it. Merge Sort has guaranteed O(n log n) time but needs extra space. Quick Sort is usually faster in practice and can be in-place, but its worst case is O(n squared).
Q. What is the difference between a Compiler and an Interpreter?
asked 2xeasyProgramming basicsTechnical2020
Ans. A compiler translates the whole program into machine code or another target form before execution, while an interpreter reads and executes the program step by step at runtime. Compiled programs usually run faster after compilation, while interpreted programs are often easier to test and debug because errors appear as the code is executed.
Q. Implement Kadane’s Algorithm to find the maximum subarray sum.
asked 2xeasyArraysTechnical2023-2024
Ans. Use Kadane’s Algorithm by scanning the array once, keeping the best sum ending at the current index and the best sum seen overall. At each element, either extend the current subarray or start a new one there. It uses only variables, runs in O(n) time, and O(1) space.
Q. What are encapsulation and abstraction in object-oriented programming?
asked 2xeasyOOPTechnical2020
Ans. Encapsulation is bundling data with the methods that operate on it and restricting direct access, while abstraction is exposing only essential behaviour and hiding implementation details. Encapsulation protects object state through access control. Abstraction reduces complexity by letting users depend on interfaces or high-level operations rather than internal code.
Q. Explain the difference between method overloading and method overriding.
asked 2xeasyOOPTechnical2021
Ans. Method overloading means defining multiple methods with the same name but different parameter lists in the same class, while method overriding means a subclass provides its own implementation of a method already defined in its parent class. Overloading is resolved at compile time, whereas overriding is resolved at runtime using dynamic dispatch.
Q. Write an SQL query to find the second highest salary from an employee table
asked 2xeasySQLTechnical2020
Ans. Select the distinct salaries, sort them in descending order, and return the second row using an offset. The key detail is using distinct, so duplicate top salaries do not hide the true second highest salary. This approach sorts the salary values, so its typical time complexity is O(n log n).
Q. Explain common Git commands and their differences. What is the master branch?
asked 2xeasyToolsManagerial2020
Ans. Common Git commands include clone to copy a repository, pull to fetch and merge remote changes, fetch to download without merging, add to stage files, commit to save staged changes locally, push to upload commits, branch to manage lines of work, and merge or rebase to integrate changes. Master is the traditional default main branch.
Q. What is the difference between compile-time polymorphism and run-time polymorphism?
asked 2xeasyOOPTechnical2020
Ans. Compile-time polymorphism is resolved by the compiler, while run-time polymorphism is resolved while the program is executing. Compile-time polymorphism usually means method or operator overloading, where the call is chosen from the declared types. Run-time polymorphism usually means method overriding, where the actual object type decides which implementation runs.
Q. What is Belady’s Anomaly?
asked 1xmediumOperating systemsTechnical2024
Ans. Belady’s anomaly is the counterintuitive case where giving a process more page frames causes more page faults, not fewer. It is most commonly seen with the FIFO page replacement algorithm. Stack-based algorithms such as LRU and optimal replacement do not suffer from it because their resident page sets grow monotonically.
Q. What is non-blocking I/O?
asked 1xmediumOperating systemsTechnical2021
Ans. Non-blocking I/O is an I/O mode where a read or write call returns immediately instead of waiting for data or space to become available. If the operation cannot proceed, it reports that status, and the program tries again later, often using an event loop, callbacks, or readiness notifications.
Q. Write a nested SQL query.
asked 1xmediumSQLTechnical2023
Ans. Use an outer SELECT to return rows, with an inner SELECT in the WHERE clause to compute the comparison set or value. For example, find employees whose salary is above the company average by comparing salary to a subquery that returns AVG(salary). The key detail is that the inner query runs logically before the outer filter.
Q. Design a Tic-Tac-Toe game.
asked 1xmediumLow level designTechnical2019
Ans. Use a Game object holding a 3x3 board, current player, move history and status. Each move validates bounds, emptiness and turn, writes the mark, then checks row, column and diagonals. The key detail is efficient win detection using row, column and diagonal counters, giving constant time per move.
Q. Explain Banker’s Algorithm
asked 1xmediumOperating systemsTechnical2024
Ans. The Banker’s Algorithm is a deadlock avoidance method that grants a resource request only if the system remains in a safe state afterwards. It tracks available resources, current allocations, and each process’s maximum need. If some ordering lets all processes finish, the request is safe; otherwise it is delayed.
Q. Puzzle: Long walking problem
asked 1xmediumLogical reasoningTechnical2020
Ans. The starting point can be the North Pole, but it is not unique. After walking south one mile, the eastward mile must bring you back to the same point before walking north. That happens at the North Pole, and also one mile north of any latitude circle near the South Pole whose circumference is 1/n mile.
Q. Puzzle: Maximum run in cricket
asked 1xmediumLogical reasoningTechnical2020
Ans. With only 50 overs and no wides or no-balls, the maximum for one batsman is 1653. Hit sixes for the first five balls of each over, then take 3 to keep strike: 33 per over for 49 overs. In the last over, hit six sixes, adding 36. Total: 49 × 33 + 36.
Q. Design and implement an LRU Cache
asked 1xmediumCacheTechnical2017
Ans. Implement an LRU cache with a hash map from key to list node and a doubly linked list ordered by recent use. On get, return the value and move the node to the front. On put, update or insert at the front. If capacity is exceeded, remove the tail. Both operations are O(1).
Q. Design a database schema for a school.
asked 1xmediumDb designTechnical2020
Ans. Use a relational schema with Students, Teachers, Courses, Classes, Enrolments, Attendance, Assessments and Grades. Students and Teachers have primary keys; Classes link a Course to a Teacher, room and term; Enrolments is the many-to-many table between Students and Classes. Add foreign keys, unique constraints and indexes on lookup and join columns.
Q. Three thieves and a river crossing puzzle.
asked 1xmediumLogical reasoningTechnical2023
Ans. All three can cross in three trips if the boat holds two people. Send thieves A and B across. A returns with the boat. Then send A and C across. Now B is already on the far bank, so A and C join him, and the boat has never carried more than two.
Q. How do you approach a design problem? Explain the steps.
asked 1xmediumProblem solvingTechnical2020
Ans. Pick a real design problem with clear users, constraints, and trade-offs. Emphasise how you clarified goals, gathered evidence, explored options, made decisions, tested assumptions, and iterated. Interviewers listen for structured thinking, user focus, collaboration, practical judgement, and how you balance quality, time, risk, and business impact.
Q. How will you handle an underperforming member of your team?
asked 1xmediumTeamworkHR2021
Ans. Pick a real example where you supported improvement, not one where you simply removed someone. Emphasise early private feedback, listening for causes, clear expectations, measurable goals, coaching, and follow-up. Interviewers listen for fairness, accountability, empathy, documentation, and whether you protect team performance while giving the person a genuine chance to improve.
Q. Given a number sequence, find the next number in the series and code it.
asked 1xmediumLogical reasoningTechnical2020
Ans. Identify the rule, then implement that rule directly. Check simple patterns first: constant difference, constant ratio, alternating sequences, squares or cubes, primes, Fibonacci-style sums, or differences of differences. Use enough terms to confirm the pattern, calculate the next value, then write concise code that reproduces the same logic.
Q. Given N, find two numbers whose product is greater than or equal to N and whose sum is minimum.
asked 1xmediumMathematicsOnline test2020
Ans. Choose the two numbers as close to √N as possible. For integers, start with a = floor(√N), then set b = ceil(N / a). Check nearby values if needed, especially by decreasing a slightly, and choose the pair with the smallest a + b while ensuring a × b ≥ N.
Q. Find the next number in the series: 1, 2, 5, 10, _
asked 1xeasyLogical reasoningTechnical2021
Ans. 17. Look at the differences between terms: 2 minus 1 is 1, 5 minus 2 is 3, and 10 minus 5 is 5. The differences are consecutive odd numbers, so the next difference is 7. Add 7 to 10 to get 17.
Showing 60 of 985 questions. Ranked by how often the same question came back across interviews.