Q. Detect a loop in a linked list
asked 3xmediumLinked listsTechnical2021-2024
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. Count possible decodings of a given digit sequence
asked 2xmediumDynamic programmingOnline test2021-2022
Ans. Use dynamic programming where dp[i] is the number of ways to decode the prefix ending at position i. Add dp[i-1] if the current digit is 1 to 9, and add dp[i-2] if the last two digits form 10 to 26. Handle 0 only as part of 10 or 20. Time is O(n), space can be O(1).
Q. Find the longest increasing subsequence in an array
asked 2xmediumDynamic programmingOnline test, Technical2020-2021
Ans. Use a patience sorting approach: maintain an array tails, where tails[i] is the smallest possible tail value of an increasing subsequence of length i + 1. For each number, binary search its position in tails and replace or append it. The length of tails is the LIS length. Time complexity is O(n log n).
Q. Which sorting algorithm is best and why?
asked 2xeasySortingTechnical2020-2021
Ans. There is no single best sorting algorithm, because the choice depends on the data and constraints. In practice, Timsort is often best for general-purpose library sorting because it is stable, fast on real-world partially sorted data, and has O(n log n) worst-case time. Quicksort is fast on average but not always stable.
Q. What is the time complexity of Merge Sort?
asked 2xeasySortingOnline test, Technical2019-2023
Ans. Merge sort is a divide and conquer sorting algorithm that splits the array into halves, recursively sorts each half, then merges the sorted halves. Its time complexity is O(n log n) in best, average, and worst cases because each level processes all n elements and there are log n levels. It usually needs O(n) extra space.
Q. Find the second largest element in an array
asked 2xeasyArraysOnline test, Technical2022-2023
Ans. Scan the array once while keeping two variables: largest and second largest. For each element, update largest if it is bigger, shifting the old largest to second largest; otherwise update second largest if it lies between them. This uses constant extra space and runs in linear time. Handle duplicates based on whether “second largest” means distinct.
Q. Difference between abstract classes and interfaces in C#
asked 2xeasyOOPTechnical2019-2022
Ans. An abstract class is a base class that can contain state, constructors, fields, and implemented or abstract members, while an interface defines a contract a type must implement. A class can inherit only one abstract class, but it can implement multiple interfaces, so interfaces are best for shared capability across unrelated types.
Q. Compute the sum of squares of the first n natural numbers
asked 2xeasyMathOnline test, Technical2021
Ans. The sum of squares of the first n natural numbers is n multiplied by n plus 1 multiplied by 2n plus 1, all divided by 6. In formula form, it is n(n + 1)(2n + 1) / 6. This computes the result in constant time, but use a large integer type to avoid overflow.
Q. What is the time complexity of Quick Sort in best, average, and worst cases?
asked 2xeasySortingOnline test2019-2020
Ans. Quick Sort runs in O(n log n) time in the best and average cases, and O(n²) in the worst case. The key factor is pivot choice: balanced partitions give logarithmic recursion depth, while repeatedly choosing the smallest or largest element creates highly unbalanced partitions and quadratic work.
Q. Explain ASP.NET MVC life cycle
asked 1xmediumWebTechnical2022
Ans. ASP.NET MVC life cycle starts when a request is routed to a controller and action, then model binding builds action parameters, filters run, the action executes, and an ActionResult generates the response. The key detail is routing maps the URL first, while filters can run before and after action execution and result rendering.
Q. Implement Merge Sort algorithm.
asked 1xmediumSortingTechnical2021
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. Implement Quick Sort algorithm.
asked 1xmediumSortingTechnical2021
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. Sort an array of 0s, 1s, and 2s.
asked 1xmediumArraysTechnical2024
Ans. Use the Dutch National Flag algorithm with three pointers: low, mid and high. Scan once: put 0s before low, leave 1s in the middle, and put 2s after high by swapping. This sorts in place with no extra data structure, taking O(n) time and O(1) space.
Q. Discuss the topic: Rural vs Urban.
asked 1xmediumTeamworkGroup discussion2020
Ans. A strong answer should compare rural and urban life with balance, not stereotypes. Pick a situation involving education, healthcare, jobs, or migration. Emphasise trade-offs, such as opportunity versus community, infrastructure versus cost, and access versus sustainability. Interviewers listen for fairness, social awareness, practical examples, and the ability to avoid one-sided opinions.
Q. Explain lambda expressions in Java
asked 1xmediumOOPTechnical2021
Ans. Lambda expressions in Java are concise anonymous functions used to implement functional interfaces, which have exactly one abstract method. They let you pass behaviour as data, often to streams, collections, or callbacks. A key detail is that lambdas can capture local variables only if those variables are final or effectively final.
Q. Find the diameter of a binary tree.
asked 1xmediumTreesTechnical2019
Ans. Use a postorder DFS that returns the height of each subtree and updates a global maximum diameter at every node. For each node, the longest path through it is left height plus right height, measured in edges. Visit each node once, so the time complexity is O(n), with O(h) recursion stack space.
Q. What is a copy constructor in Java?
asked 1xmediumOOPTechnical2024
Ans. A copy constructor in Java is a constructor that creates a new object by copying data from another object of the same class. Java does not provide one automatically, so you write it yourself. The key detail is deciding whether referenced mutable objects should be copied deeply or just shared.
Q. Explain Microsoft Server Architecture
asked 1xmediumSystem architectureTechnical2021
Ans. Microsoft Server Architecture is a layered Windows Server design that separates hardware, kernel services, system services, application services and client access. The key detail is that core services such as Active Directory, DNS, DHCP, file services, IIS and security run as managed server roles, allowing centralised administration, authentication, scalability and fault isolation.
Q. How does hoisting work in JavaScript?
asked 1xmediumJavaScriptTechnical2019
Ans. Hoisting means JavaScript processes declarations before running the code, so some names can be referenced before their declaration line. Function declarations are hoisted with their body, while var declarations are hoisted but initialised as undefined. let and const are hoisted too, but cannot be used before initialisation because of the temporal dead zone.
Q. Print a given matrix in spiral order.
asked 1xmediumArraysTechnical2015
Ans. Traverse the matrix layer by layer using four boundaries: top, bottom, left, and right. Print the top row, right column, bottom row, and left column, then move the boundaries inward. No extra data structure is needed apart from the output. Time complexity is O(mn), and space is O(1).
Q. Solve a given trigonometric equation.
asked 1xmediumTrigonometryOnline test2014
Ans. Rewrite the equation using standard identities, such as sin squared x plus cos squared x equals 1, double angle, or factor formulas. Put everything in one trig function where possible, solve over the required interval, then add the general period. Check for excluded values caused by division or transformations.
Q. Solve coding problems based on graphs
asked 1xmediumGraphsOnline test2022
Ans. Model the data as an adjacency list, then choose traversal or shortest path based on the task. Use BFS for unweighted shortest paths or levels, DFS for connectivity, cycles and components, topological sort for DAG dependencies, and Dijkstra for weighted positive edges. Most BFS or DFS solutions run in O(V + E) time.
Q. Find all permutations of a given string
asked 1xmediumBacktrackingOnline test2024
Ans. Use backtracking to build permutations one character at a time, swapping characters in place or using a current path with a used array. When the path length equals the string length, add it to the result list. Time complexity is O(n × n!) and space is O(n) excluding output.
Q. Find the number of selective arrangements
asked 1xmediumCombinatoricsOnline test2021
Ans. The number of selective arrangements of r items chosen from n distinct items is n! / (n - r)!. This is because you first select r items, C(n, r), then arrange them, r!, giving C(n, r) × r! = nPr. Compute with factorials or iterative multiplication in O(r).
Q. How will you store a paragraph in memory?
asked 1xmediumStringsTechnical2021
Ans. I would store a paragraph as a string, which is a sequence of characters in memory. In C, this is usually a character array ending with a null character. In higher level languages, a string object stores the characters plus metadata such as length and encoding, often using dynamically allocated memory.
Q. What are context and scope in JavaScript?
asked 1xmediumJavaScriptTechnical2019
Ans. Scope is where variables and functions are accessible, while context is the value of this during execution. JavaScript has lexical scope, so inner functions can access outer variables. The most important detail is that this depends on how a function is called, except in arrow functions, which inherit this from their surrounding scope.
Q. What are triggers in SQL and their types?
asked 1xmediumDBMSTechnical2022
Ans. Triggers in SQL are database objects that automatically execute when a specified event occurs on a table or view. Common types are BEFORE, AFTER and INSTEAD OF triggers, usually fired by INSERT, UPDATE or DELETE operations. They can run once per row or once per statement, depending on the database.
Q. Explain the lifecycle of a React component
asked 1xmediumReactTechnical2019
Ans. A React component’s lifecycle is the sequence of mounting, updating, and unmounting. Mounting creates it and puts it in the DOM, updating re-renders it when props or state change, and unmounting removes it. In modern React, lifecycle behaviour is usually handled with useEffect, including cleanup for subscriptions, timers, or listeners.
Q. Reverse a linked list in groups of K nodes
asked 1xmediumLinked listsTechnical2020
Ans. Reverse each block of K nodes by iteratively flipping next pointers, then connect the previous block’s tail to the new head of the reversed block. First check that K nodes exist if the problem says incomplete groups stay unchanged. Use only pointer variables, so the time complexity is O(n) and extra space is O(1).
Q. Explain indexing in SQL Server and its types
asked 1xmediumDBMSTechnical2022
Ans. Indexing in SQL Server is a way to organise data so queries can find rows faster without scanning the whole table. The main types are clustered indexes, which define the physical row order, and non-clustered indexes, which store separate lookup structures. Indexes improve reads but add storage and slow inserts, updates, and deletes.
Q. How can memory leakage be avoided in Python?
asked 1xmediumProgramming languageTechnical2021
Ans. Memory leaks in Python are avoided by ensuring objects are no longer referenced when they are not needed. Use context managers for files and connections, clear large containers, avoid unnecessary globals and caches, and use weak references for back references. The key detail is to break reference cycles, especially when objects define destructors.
Q. What is polymorphism and abstraction in OOP?
asked 1xmediumOOPTechnical2021
Ans. Polymorphism is the ability to use a common interface while different classes provide their own behaviour, and abstraction is hiding implementation details while exposing only essential operations. The key idea is that abstraction defines what an object can do, while polymorphism lets different object types do it in their own way.
Q. Write a program to rotate a matrix diagonally
asked 1xmediumArraysOnline test2024
Ans. Rotate the matrix diagonally by transposing it across the main diagonal. For a square matrix, swap each element at row i, column j with the element at row j, column i, only for j greater than i. Use the input 2D array in place. Time complexity is O(n²), space is O(1).
Q. Difference between race condition and deadlock
asked 1xmediumMultithreadingTechnical2021
Ans. A race condition is incorrect behaviour caused by timing-dependent access to shared data, while a deadlock is when threads or processes wait forever for each other’s resources. The key difference is that a race may still complete with a wrong result, but a deadlock prevents progress entirely until something is interrupted or released.
Q. Explain ES6 features and how context is formed
asked 1xmediumJavaScriptTechnical2019
Ans. ES6 added let and const, arrow functions, classes, modules, promises, template literals, destructuring, default parameters, spread/rest, maps, sets and iterators. JavaScript context is formed when code runs: the engine creates an execution context with a lexical environment, variable environment, scope chain and this binding, then manages it on the call stack.
Q. Sort an array consisting only of 0s, 1s, and 2s
asked 1xmediumArraysTechnical2023
Ans. Use the Dutch National Flag approach with three pointers: low, mid, and high. Scan once: move 0s to the front, 2s to the end, and leave 1s in the middle. This sorts the array in place using constant extra space, with O(n) time complexity.
Q. Explain equals() and hashCode() contract in Java
asked 1xmediumOOPTechnical2021
Ans. In Java, if two objects are equal according to equals(), they must return the same hashCode(). equals() should be reflexive, symmetric, transitive, consistent, and return false for null. hashCode() must be consistent while the object is unchanged. This matters because hash-based collections like HashMap and HashSet rely on it.
Q. Optimize the previously discussed matrix solution
asked 1xmediumOptimizationTechnical2020
Ans. Optimise it by removing the auxiliary matrix and storing state in the original matrix where possible. For example, use the first row and first column as markers, with separate flags if their original values matter. This keeps the traversal linear, so the time complexity is O(mn) and the extra space is O(1).
Q. What are delegates in C# and where are they used?
asked 1xmediumOOPTechnical2019
Ans. Delegates in C# are type-safe references to methods with a specific parameter list and return type. They are used to pass behaviour as values, such as callbacks, event handlers, predicates, and LINQ operations. The key point is that events are built on delegates, often multicast delegates that can call several handlers.
Q. Explain common design patterns and SOLID principles.
asked 1xmediumOOPTechnical2019
Ans. Design patterns are reusable solutions such as Singleton, Factory, Strategy, Observer and Adapter, while SOLID principles guide maintainable object-oriented design. SOLID means single responsibility, open for extension but closed for modification, substitutable subclasses, small focused interfaces and depending on abstractions. The key is using them pragmatically to reduce coupling and improve changeability.
Q. Difference between sleep() and wait() methods in Java
asked 1xmediumMultithreadingTechnical2021
Ans. sleep pauses the current thread for a specified time, while wait pauses a thread until another thread calls notify or notifyAll on the same object. The key difference is that sleep does not release any lock it holds, but wait releases the object monitor and must be called inside a synchronised block.
Q. English comprehension passage with related questions.
asked 1xmediumVerbalOnline test2020
Ans. Read the passage once for the main idea, then read each question carefully before returning to the relevant lines. Base answers only on what the passage states or clearly implies, not outside knowledge. Watch for qualifiers such as always, mainly, except, and not. For vocabulary questions, use context rather than memory alone.
Q. What are forward refs in React and why are they used?
asked 1xmediumReactTechnical2021
Ans. Forward refs in React let a parent pass a ref through a component to one of its child DOM nodes or class components. They are used when a component needs to expose focus, scrolling, measuring, animations, or integration with third party libraries, without breaking encapsulation more than necessary.
Q. Spirally traverse a given matrix and print the elements
asked 1xmediumArraysOnline test2024
Ans. Maintain four boundaries: top, bottom, left and right, and print rows or columns while shrinking them inward after each pass. Traverse top row, right column, bottom row, then left column, checking boundaries before each step. No extra data structure is needed apart from output. Time complexity is O(rows × columns), space is O(1).
Q. What are dangling pointers and how can they be avoided?
asked 1xmediumPointersTechnical2015
Ans. Dangling pointers are pointers that still hold the address of memory after that memory has been freed or gone out of scope. They can cause undefined behaviour if dereferenced. Avoid them by setting pointers to null after freeing, not returning addresses of local variables, using clear ownership rules, and preferring smart pointers or managed memory where available.
Q. What is a private constructor and where can it be used?
asked 1xmediumOOPTechnical2022
Ans. A private constructor is a constructor that can be called only from inside its own class. It is used to stop other code creating objects directly. Common uses are Singleton classes, factory methods, utility classes with only static members, or classes that need tight control over how instances are created.
Q. Implement a problem based on Linked List data structure.
asked 1xmediumLinked listsOnline test2020
Ans. Use a linked list by defining nodes that store a value and a next pointer, then maintain a head pointer to traverse or update the list. For most operations, handle empty list, head changes, and pointer rewiring carefully. Traversal, search, insertion, or deletion usually take O(n) time and O(1) extra space.
Q. Find the Longest Increasing Subsequence (LIS) in an array
asked 1xmediumDynamic programmingOnline test2021
Ans. Use the patience sorting approach: maintain an array where each position stores the smallest possible tail value for an increasing subsequence of that length. For each number, binary search the first tail greater than or equal to it and replace it. This gives the LIS length in O(n log n) time and O(n) space.
Q. Find the kth smallest and kth largest element in an array
asked 1xmediumArraysTechnical2021
Ans. Use Quickselect to find the kth smallest with index k minus 1, and the kth largest with index n minus k after partitioning. It partitions like Quicksort but only recurses into the needed side. Average time is O(n), worst case is O(n²), and space is O(1) if done in place.
Q. Find the largest palindromic substring in a given string.
asked 1xmediumStringsTechnical2020
Ans. Expand around every possible centre and keep the longest palindrome seen. For each index, check both odd length and even length centres, moving left and right while characters match. This uses constant extra space and runs in O(n²) time, which is usually acceptable unless Manacher’s O(n) algorithm is specifically required.
Q. Find the measure of an angle in a given geometric figure.
asked 1xmediumGeometryOnline test2014
Ans. Use the given angle facts to build equations, then solve for the unknown angle. Look for angles on a straight line, angles around a point, vertically opposite angles, triangle angle sums, isosceles triangle equal angles, and parallel line angle rules. Mark equal angles clearly and work step by step until the required angle is found.
Q. Function to check if a singly linked list is a palindrome
asked 1xmediumLinked listsTechnical2020
Ans. Use the fast and slow pointer approach: find the middle, reverse the second half, then compare it with the first half node by node. The key detail is reversing only half the list, so it uses O(1) extra space and runs in O(n) time. Optionally restore the list afterwards.
Q. What is the difference between shallow copy and deep copy?
asked 1xmediumOOPTechnical2023
Ans. A shallow copy creates a new outer object but reuses references to the same nested objects, while a deep copy recursively creates new copies of nested objects too. The key difference is aliasing: changing a shared nested object affects both the original and shallow copy, but not a proper deep copy.
Q. Explain the diamond problem in Java and how it is resolved.
asked 1xmediumOOPTechnical2024
Ans. The diamond problem is ambiguity caused when a class inherits the same method through multiple paths. Java avoids it by allowing a class to extend only one class. With interfaces, default method conflicts are possible, but Java resolves them by preferring class methods, choosing the most specific interface, or forcing the class to override.
Q. Aptitude questions testing quantitative and logical reasoning
asked 1xmediumLogical reasoningOnline test2023
Ans. Identify what is being asked, list the given facts, and translate them into equations, ratios, tables, or diagrams. Work step by step, checking units and assumptions. For logic questions, eliminate impossible options and look for patterns. Estimate first if choices are given, then calculate accurately to confirm.
Q. Find the Longest Common Subsequence (LCS) between two strings
asked 1xmediumDynamic programmingOnline test2021
Ans. Use dynamic programming with a 2D table where dp[i][j] stores the LCS length for the first i characters of one string and first j of the other. If characters match, add one from dp[i-1][j-1]; otherwise take the maximum of top or left. Time and space are O(nm).
Q. Find the element in an array that appears more than n/2 times
asked 1xmediumArraysTechnical2021
Ans. Use the Boyer-Moore majority vote algorithm to find the element that appears more than n/2 times. Keep a candidate and a count, increasing for the same value and decreasing for a different one. If a majority is guaranteed, return the candidate. Otherwise, verify it with a second pass. Time is O(n), space is O(1).
Q. Find the length of the longest substring without repeating characters.
asked 1xmediumStringsOnline test2024
Ans. Use a sliding window and a hash map of each character’s most recent index to find the longest substring without repeats. Move the right pointer through the string; if a character was seen inside the current window, move the left pointer just after its previous index. Track the maximum window length. Time is O(n), space is O(k).
Q. How would you conduct a one-to-one requirement gathering workshop with a client?
asked 1xmediumCommunicationManagerial2017
Ans. Pick a real workshop where you owned the outcome. Emphasise preparation, stakeholder research, clear objectives, structured questioning, active listening, probing assumptions, and confirming priorities. Show how you captured requirements, separated needs from solutions, managed scope, and agreed next steps. Interviewers listen for confidence, collaboration, traceability, and client-focused communication.
Q. Prepare a response document for an RFP, keeping in mind the scope of work and your strengths.
asked 1xmediumRequirement analysisManagerial2017
Ans. Choose an RFP where you clearly understood the client’s scope, shaped a compliant response, and used your strengths to add value. Emphasise how you analysed requirements, coordinated inputs, highlighted differentiators, managed deadlines, and reduced risk. Interviewers listen for structure, commercial awareness, attention to detail, collaboration, and a clear link between your strengths and the winning response.
Showing 60 of 376 questions. Ranked by how often the same question came back across interviews.