Q. Implement merge sort on an array.
asked 1xmediumSortingTechnical2023
Ans. Use divide and conquer: recursively split the array into two halves until each part has one element, then merge sorted halves back together by comparing front elements. The key data structure is a temporary array used during merging. Merge Sort runs in O(n log n) time and uses O(n) extra space.
Q. Reverse a stack without using extra space
asked 1xmediumStackTechnical2019
Ans. Reverse it using recursion: pop the top item, recursively reverse the remaining stack, then insert the popped item at the bottom. The key helper is “insert at bottom”, which recursively pops until the stack is empty, pushes the item, then restores the popped items. Time complexity is O(n²), with O(n) call stack space.
Q. Write SQL queries using JOIN and ORDER BY
asked 1xmediumSQLTechnical2019
Ans. Use JOIN to combine rows from related tables through matching keys, then use ORDER BY to sort the final result by one or more columns. For example, join customers to orders on customer id, then order by order date. The data structure is relational tables, often indexed; cost depends on join size and sorting.
Q. Write SQL queries to solve a given problem.
asked 1xmediumSQLOnline test2023
Ans. I would first identify the required output, source tables, join keys, filters, grouping, and ordering, then build the query in that order. The key detail is choosing the correct join type and aggregation level, because most SQL bugs come from duplicating rows before GROUP BY or accidentally excluding rows with INNER JOIN.
Q. Perform level order traversal of a binary tree
asked 1xmediumTreesTechnical2019
Ans. Use breadth first search with a queue. Put the root in the queue, then repeatedly remove the front node, visit it, and add its left and right children if they exist. This visits nodes level by level from left to right. The time complexity is O(n), and the space complexity is O(w), where w is the maximum width.
Q. Cut a cake into 8 equal pieces using only 3 cuts.
asked 1xmediumLogical reasoningManagerial2023
Ans. Make two straight vertical cuts through the centre of the cake at right angles, dividing it into four equal quarters. Then make one horizontal cut through the middle of the cake, parallel to the top and bottom. That splits each quarter into two equal layers, so 4 pieces become 8 equal pieces.
Q. Solve coding problems based on strings, arrays, and trees
asked 1xmediumMixedOnline test2019
Ans. Use pattern matching: sliding window or two pointers for strings and arrays, hash maps for frequency or lookup, and DFS or BFS for trees. The key detail is choosing the right traversal and maintaining minimal state. Most array and string solutions are O(n); tree traversals are O(n) time and O(h) or O(n) space.
Q. What is multithreading in Java and how is it implemented?
asked 1xmediumOOPTechnical2014
Ans. Multithreading is running multiple threads within one process so tasks can make progress concurrently and share the same memory space. In Java it is implemented using the Thread class, Runnable or Callable tasks, and usually ExecutorService thread pools. Shared data must be protected with synchronisation tools such as synchronized, locks, or concurrent collections.
Q. Write an SQL query to delete duplicate values from a table.
asked 1xmediumSQLTechnical2023
Ans. Use a common table expression with ROW_NUMBER over the duplicate-defining columns, then delete rows whose row number is greater than one. Keep a stable row, usually the smallest primary key or earliest created date. The database uses sorting or hashing internally, so typical cost is about O(n log n), depending on indexes.
Q. Write an SQL query based on joins to retrieve required data.
asked 1xmediumSQLTechnical2023
Ans. Use a SELECT statement with an INNER JOIN between the related tables, matching the foreign key in one table to the primary key in the other, then list the required columns and add filtering if needed. For optional related data, use a LEFT JOIN so unmatched main records are still returned.
Q. Find the longest common substring without repeating characters
asked 1xmediumStringsTechnical2019
Ans. Use a sliding window over the string, keeping characters in a set or map of last seen positions. Move the right pointer forward, and when a repeated character appears inside the window, move the left pointer past its previous occurrence. Track the maximum window length. This runs in O(n) time and O(k) space.
Q. Predict the output of a program based on dynamic polymorphism.
asked 1xmediumOOPTechnical2021
Ans. The output is determined by the runtime object type, not the reference type, for overridden instance methods. If a base-class reference points to a derived-class object and calls an overridden method, the derived version runs. Static methods, fields, and private methods are not dynamically dispatched and depend on the declared reference type.
Q. What is database normalization and its different normal forms?
asked 1xmediumDBMSTechnical2019
Ans. Database normalization structures relational tables to reduce duplication and prevent update, insert, and delete anomalies. 1NF uses atomic values, 2NF removes partial dependency on a composite key, 3NF removes transitive dependency on non-key columns, and BCNF requires every determinant to be a candidate key. Higher forms handle multivalued and join dependencies.
Q. Write an SQL query to find the second maximum element from a table.
asked 1xmediumSQLTechnical2014
Ans. Select the maximum value that is less than the overall maximum value in the table. In SQL, this is usually done with a subquery: the outer query finds the maximum, while the inner query finds the table’s maximum to exclude. It uses no special data structure, and performance is typically linear without an index.
Q. Remove duplicate elements from an array without using any extra space.
asked 1xmediumArraysTechnical2023
Ans. Sort the array in place, then use two pointers to compact unique values at the front. Keep one pointer at the last unique element and scan with the other; when a new value appears, move it next. This uses constant extra space, takes O(n log n) time due to sorting, and does not preserve original order.
Q. Write an SQL query using SUM() along with an INNER JOIN on two tables.
asked 1xmediumSQLTechnical2019
Ans. Use an INNER JOIN between the parent table and detail table, then apply SUM to the numeric column and group by the parent key. For example, join customers to orders and sum order amounts per customer. The database uses table indexes as the key data structure; performance is roughly linear over matched rows.
Q. Explain association, aggregation, and composition in OOP with examples.
asked 1xmediumOOPManagerial2023
Ans. Association is a general relationship between objects, aggregation is a weak whole-part relationship, and composition is a strong whole-part relationship with shared lifetime. A Teacher associated with a Student can exist independently. A Team aggregates Players, who may leave. A House is composed of Rooms, which normally do not exist without the House.
Q. Normalize a given database table and explain the normalization process.
asked 1xmediumDBMSTechnical2014
Ans. Normalize a table by decomposing it into smaller related tables that remove redundancy and update anomalies while preserving dependencies and data. First ensure atomic values for 1NF, remove partial dependencies for 2NF, remove transitive dependencies for 3NF, then use keys and foreign keys to maintain relationships.
Q. Implement a linked list and then convert it into a circular linked list.
asked 1xmediumLinked listsTechnical2023
Ans. Implement a singly linked list with nodes containing data and a next pointer, then convert it to circular by setting the last node’s next pointer to the head. Maintain a head reference, traverse until next is null, and link it back. Insertion is O(1) at head or O(n) at tail, conversion is O(n).
Q. What are the different types of process scheduling in operating systems?
asked 1xmediumOperating systemsTechnical2019
Ans. The main types of process scheduling are long-term, short-term, and medium-term scheduling. Long-term scheduling admits jobs into memory, short-term scheduling chooses the next ready process for the CPU, and medium-term scheduling swaps processes in and out of memory. CPU scheduling may also be preemptive or non-preemptive.
Q. Design an online ticket booking system and suggest features you would add.
asked 1xmediumDesignTechnical2017
Ans. Design it with search, seat selection, temporary reservation, payment, confirmation, and ticket delivery services behind an API gateway, using a database for events, seats, bookings, and payments. The key detail is concurrency: lock selected seats for a short time or use atomic seat status updates so two users cannot buy the same ticket.
Q. Write an SQL query to find the third highest salary from an employee table.
asked 1xmediumSQLTechnical2023
Ans. Select the distinct salaries, sort them in descending order, skip the first two, and return the next one. In SQL this is usually done with DISTINCT plus ORDER BY descending and LIMIT with OFFSET, or with DENSE_RANK. The key detail is using distinct salaries, so duplicate top salaries do not change the result.
Q. Find the Lowest (Longest) Common Ancestor (LCA) of two nodes in a binary tree
asked 1xmediumTreesTechnical2019
Ans. Use a recursive DFS: if the current node is null or equals either target, return it; otherwise search left and right. If both sides return a node, the current node is the LCA. If only one side returns a node, pass it up. This uses the call stack, runs in O(n) time and O(h) space.
Q. Write an SQL query to find the top 5 customers with the highest order amount.
asked 1xmediumSQLManagerial2023
Ans. Group orders by customer, calculate the total order amount for each customer using SUM, sort the results in descending order, and return only the first five rows. If customer details are needed, join the orders table to the customers table on customer_id before grouping. The key detail is using GROUP BY with ORDER BY and LIMIT.
Q. Given an array of integers, find the length of the longest increasing subsequence.
asked 1xmediumDynamic programmingOnline test2019
Ans. Use a tails array where tails[i] stores the smallest possible ending value of an increasing subsequence of length i + 1. For each number, binary search its position in tails and replace or append it. The final length of tails is the answer. This takes O(n log n) time and O(n) space.
Q. Why are abstract classes needed over interfaces? Explain with a real-life example.
asked 1xmediumOOPTechnical2021
Ans. Abstract classes are needed when related classes must share common state or behaviour, not just a contract. An interface says what a class can do, while an abstract class can also provide default logic and fields. For example, Car and Bike can extend Vehicle, sharing registration number and start logic, while implementing their own movement details.
Q. Explain different sorting algorithms and compare their time and space complexities.
asked 1xmediumSortingManagerial2014
Ans. Common sorting algorithms include bubble, selection and insertion sort at O(n²), merge sort at O(n log n) with O(n) extra space, quicksort at average O(n log n) but worst O(n²), and heap sort at O(n log n) with O(1) extra space. In practice, quicksort is fast, while merge sort is stable.
Q. Answer coding questions related to OOPS concepts and variable/function declarations.
asked 1xmediumOOPTechnical2023
Ans. Use OOP by modelling data as classes with clear fields, methods, constructors, and access control. Declare variables with the narrowest useful scope and meaningful types, and declare functions with clear names, parameters, return types, and minimal side effects. Apply encapsulation, inheritance, polymorphism, and abstraction only where they simplify the design.
Q. How would you ensure that the same seat cannot be booked by two users at the same time?
asked 1xmediumOperating systemsTechnical2017
Ans. Use a database transaction with row-level locking or an atomic conditional update on the seat record. The booking should only succeed if the seat is still available, and the database should enforce this with a unique constraint on the seat and event, so concurrent requests cannot both commit successfully.
Q. Explain the diamond problem in object-oriented programming and how it is resolved in Java.
asked 1xmediumOOPTechnical2014
Ans. The diamond problem occurs when a class inherits the same method through two different parent paths, making it unclear which implementation to use. Java avoids this for classes by not allowing multiple class inheritance. With interfaces, conflicting default methods must be resolved by explicitly overriding the method in the implementing class.
Q. Find the third last element of a singly linked list when the size of the list is not given.
asked 1xmediumLinked listsTechnical2021
Ans. Use two pointers: move the first pointer three nodes ahead, then move both pointers together until the first pointer reaches the end. The second pointer will then be at the third last node. If the list has fewer than three nodes, no such element exists. This takes O(n) time and O(1) space.
Q. Distribute 17 horses among three persons such that A gets 1/2, B gets 1/3, and C gets 1/9 of the horses.
asked 1xmediumLogical reasoningTechnical2021
Ans. Borrow one horse, making 18. Then A gets 1/2 of 18, which is 9; B gets 1/3, which is 6; C gets 1/9, which is 2. They receive 9 + 6 + 2 = 17 horses, so the borrowed horse is returned. Strictly from 17 alone, exact whole shares are impossible.
Q. Remove all occurrences of the character 'A' from a string in O(n) time without using any additional data structure
asked 1xmediumStringsTechnical2019
Ans. Use an in-place two-pointer scan: read each character once and write it back only if it is not 'A'. The write pointer tracks the next valid position, and after the scan the string is truncated or terminated there. This uses constant extra space and O(n) time.
Q. Every element appears three times except one. Find the unique element in O(N) time. Example: Input [2,2,2,1,3,3,3], Output: 1.
asked 1xmediumBit manipulationTechnical2021
Ans. Count the set bits at each bit position across all numbers, take each count modulo 3, and rebuild the unique number from the remaining bits. The repeated numbers contribute multiples of three, so they vanish modulo 3. This runs in O(N) time and uses O(1) extra space.
Q. You are given 10 coins where one coin is heavier. Find the heavier coin using a balance scale in the minimum number of weighings.
asked 1xmediumLogical reasoningTechnical2023
Ans. Minimum is 3 weighings. Two weighings give only 9 possible outcome patterns, but there are 10 possible heavy coins. Weigh 3 coins against 3. If one side is heavier, weigh 1 against 1 from that side. If they balance, the third is heavy. If the first weighing balances, test the remaining 4 with 2 against 2, then 1 against 1.
Q. Given Employee(empID, empName, empAge) and Bonus(bonusID, empID, bonusAmount) tables, write a SQL query to find employee-wise total bonus
asked 1xmediumSQLTechnical2020
Ans. Join Employee with Bonus on empID, then group by each employee and calculate the sum of bonusAmount. Select empID, empName, and the total bonus. Use an inner join if only employees with bonuses are needed, or a left join with a zero default to include employees with no bonus.
Q. Given Employee(empID, empName, empAge) and Bonus(bonusID, empID, bonusAmount) tables, write a SQL query to find employees who have not received any bonus
asked 1xmediumSQLTechnical2020
Ans. Use a left join from Employee to Bonus on empID, then keep only rows where the matching Bonus empID is null. This returns employees with no bonus record. An equivalent approach is using NOT EXISTS with a correlated subquery. With an index on Bonus.empID, this is efficient, typically near linear in table size.
Q. What are different SQL commands?
asked 1xeasySQLTechnical2023
Ans. SQL commands are commonly grouped into DDL, DML, DQL, DCL and TCL. DDL defines schema using commands like CREATE and ALTER. DML changes data using INSERT, UPDATE and DELETE. DQL retrieves data using SELECT. DCL manages permissions with GRANT and REVOKE. TCL manages transactions using COMMIT, ROLLBACK and SAVEPOINT.
Q. Why are interfaces used in OOPS?
asked 1xeasyOOPTechnical2023
Ans. Interfaces are used in OOP to define a contract that classes must follow without specifying how they implement it. They support abstraction and polymorphism, letting code depend on behaviour rather than concrete classes. This reduces coupling, makes implementations interchangeable, and improves testing and maintainability.
Q. Explain exception handling in Java.
asked 1xeasyOOPTechnical2014
Ans. Exception handling in Java is a mechanism for dealing with runtime errors without abruptly stopping normal program flow. Risky code is placed in a try block, errors are handled in catch blocks, and cleanup goes in finally. Java has checked exceptions, which must be caught or declared, and unchecked exceptions.
Q. Explain operations on a linked list
asked 1xeasyLinked listsTechnical2019
Ans. Linked list operations include traversal, insertion, deletion, searching, and updating nodes. Traversal visits nodes from the head using next pointers. Insertion and deletion are efficient when the target node or previous node is known, usually O(1). Searching takes O(n) because nodes must be checked one by one.
Q. Why do you need interfaces in Java?
asked 1xeasyOOPTechnical2021
Ans. Interfaces in Java define a contract that classes can implement, letting code depend on behaviour rather than concrete classes. This enables polymorphism, loose coupling, easier testing, and cleaner design. The key point is that an interface says what operations are available, while each implementing class decides how those operations work.
Q. Explain ACID properties in databases
asked 1xeasyDBMSTechnical2019
Ans. ACID properties are guarantees that make database transactions reliable: Atomicity, Consistency, Isolation, and Durability. Atomicity means all changes commit or none do. Consistency keeps data valid under rules and constraints. Isolation makes concurrent transactions behave safely. Durability means committed changes survive crashes, usually through logging and persistent storage.
Q. Explain different types of SQL joins.
asked 1xeasySQLTechnical2014
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. Explain Third Normal Form (3NF) in DBMS
asked 1xeasyDBMSTechnical2020
Ans. Third Normal Form is a database design rule where a table is in Second Normal Form and has no transitive dependencies. Every non-key attribute must depend only on a candidate key, not on another non-key attribute. This reduces redundancy and avoids update, insert, and delete anomalies.
Q. What is a kernel in an operating system?
asked 1xeasyOperating systemsTechnical2019
Ans. A kernel is the core part of an operating system that manages the computer’s hardware and provides essential services to software. It controls CPU scheduling, memory, devices, file access, and system calls. The key point is that it acts as the protected bridge between user programs and the hardware.
Q. Are objects passed by value or by reference?
asked 1xeasyOOPTechnical2020
Ans. Objects are usually passed by value, but the value being passed is often a reference to the object. That means the function receives its own copy of the reference. It can mutate the same underlying object, but reassigning the parameter to a new object does not change the caller’s variable.
Q. Write an SQL JOIN query to join given tables.
asked 1xeasySQLTechnical2021
Ans. Use an INNER JOIN between the two tables on their shared key, selecting the required columns from each table. For example, join an orders table to a customers table using customer_id so each order is matched with its customer. The key detail is choosing the correct join condition, since it controls which rows match.
Q. Explain common searching and sorting algorithms.
asked 1xeasySortingTechnical2014
Ans. Common searching algorithms include linear search, which checks each item in O(n), and binary search, which finds an item in a sorted array in O(log n). Common sorting algorithms include bubble, insertion and selection sort in O(n²), merge sort and heap sort in O(n log n), and quicksort on average O(n log n).
Q. What is indexing in databases and why is it used?
asked 1xeasyDBMSTechnical2017
Ans. Indexing in databases is a way to store a searchable structure for one or more columns so rows can be found faster. It is used to speed up queries, especially filtering, joining, and sorting. The key trade-off is that indexes use extra storage and make writes slower because the index must also be updated.
Q. Find unique numbers till a given index in an array.
asked 1xeasyArraysOnline test2023
Ans. Use a hash set to scan the array from index 0 to the given index and store each value seen. After the scan, the set contains the unique numbers in that prefix, and its size gives the count. This takes O(k) time for index k and O(k) extra space.
Q. Explain different types of SQL joins and their use cases
asked 1xeasyDBMSTechnical2023
Ans. SQL JOINs combine rows from related tables. INNER JOIN returns only matching rows, useful for required relationships. LEFT JOIN returns all left rows plus matches, useful for optional data. RIGHT JOIN is the reverse, less commonly needed. FULL OUTER JOIN returns all rows from both sides. CROSS JOIN creates every pair, often for combinations.
Q. What is multiple inheritance and how is it handled in Java?
asked 1xeasyOOPTechnical2017
Ans. Multiple inheritance means a class inherits behaviour or state from more than one parent class. Java does not allow multiple inheritance of classes, mainly to avoid ambiguity such as the diamond problem. Instead, Java supports implementing multiple interfaces, including default methods, where conflicts must be resolved explicitly by the implementing class.
Q. Have you ever worked in a team? How do you handle conflicts within the team?
asked 1xeasyConflict resolutionHR2021
Ans. Choose a real team situation where the goal mattered and your role was clear. Emphasise listening first, separating facts from opinions, and keeping the discussion focused on the shared outcome. Show that you raise issues early, stay respectful, accept feedback, and help agree practical next steps. Interviewers listen for maturity, collaboration, and accountability.
Q. What is the difference between function overloading and function overriding?
asked 1xeasyOOPTechnical2020
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. Machine Learning in finance
asked 1xunknownVerbalGroup discussion2017
Ans. Pick a real finance use case, such as fraud detection, credit risk, pricing, or forecasting, where the stakes and constraints were clear. Emphasise business impact, data quality, model validation, explainability, regulation, and monitoring. Interviewers listen for sound judgement, not just algorithms, and evidence that you balance performance with risk, fairness, and accountability.
Q. Is today's youth confident or confused?
asked 1xunknownVerbalGroup discussion2017
Ans. A strong answer should take a balanced view: young people are often confident in voice and ambition, but may feel confused by choices, pressure and rapid change. Pick a real example from education, work or volunteering. Emphasise empathy, evidence and maturity. Interviewers listen for fairness, social awareness and clear reasoning.
Q. Logical reasoning questions testing analytical thinking
asked 1xunknownLogical reasoningOnline test2019
Ans. Identify the rule or relationship before trying to answer. Separate facts from assumptions, look for patterns, categories, sequences, cause and effect, or exclusions. Work step by step, eliminate impossible options, and check that the remaining answer fits every condition. If stuck, test simple examples rather than guessing.
Q. English language questions testing grammar and comprehension
asked 1xunknownVerbalOnline test2019
Ans. Read the whole sentence or passage first to understand meaning, not just individual words. Check grammar rules such as subject verb agreement, tense, articles, prepositions and pronouns. For comprehension, identify the main idea, tone and supporting details. Eliminate options that change the meaning, sound awkward or introduce information not given.
Q. Arithmetic aptitude questions involving basic numerical problem solving
asked 1xunknownArithmeticOnline test2019
Ans. Identify what is being asked, write down the given numbers, and choose the needed operation: addition, subtraction, multiplication, division, percentage, ratio, or average. Convert units if required, simplify the numbers, and calculate step by step. Check the result against the question to ensure it is reasonable and in the correct form.
Showing 60 of 87 questions. Ranked by how often the same question came back across interviews.