Q. What is the difference between a hub and a switch?
asked 3xeasyNetworkingTechnical2021-2023
Ans. A hub repeats incoming data to every port, while a switch forwards data only to the port where the destination device is connected. A hub works at the physical layer and creates one shared collision domain. A switch works mainly at the data link layer, learns MAC addresses, and is faster and more efficient.
Q. Print all permutations of a given string.
asked 2xmediumRecursionTechnical2019-2021
Ans. Use backtracking to build permutations by choosing each unused character in turn, recursing until the current string has the original length, then print it. Keep a character array, a boolean used array, and a temporary result buffer. The time complexity is O(n × n!) and the recursion depth is O(n).
Q. Solve logical puzzles during the interview
asked 2xmediumLogical reasoningTechnical2017
Ans. I solve logic puzzles by defining the facts, constraints, and goal first. I then test cases systematically, eliminate contradictions, and state any assumptions aloud. If a result follows, I give it with the reasoning. If information is missing, I say what cannot be determined and explain what extra fact is needed.
Q. Explain advanced OOPs concepts with examples
asked 2xmediumOOPTechnical2023-2024
Ans. Advanced OOP concepts include inheritance, polymorphism, abstraction, encapsulation, interfaces, composition, and design patterns. For example, a Payment interface can have CardPayment and UpiPayment implementations, showing polymorphism. Encapsulation hides account balance behind methods. Abstraction exposes only pay. Composition lets an Order contain Payment details without inheriting from them.
Q. Write a SQL query to find the second highest salary from the Employee table.
asked 2xmediumSQLTechnical2019-2021
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. Print a pyramid pattern.
asked 2xeasyPatternsTechnical2020
Ans. Use nested loops to print each row with leading spaces followed by stars, increasing the star count by two each row to form a centred pyramid. No special data structure is needed beyond loop counters. For n rows, print n minus row spaces and 2 times row minus 1 stars. Time complexity is O(n squared).
Q. Explain ACID properties in DBMS
asked 2xeasyDBMSTechnical2020-2021
Ans. ACID properties are the guarantees that make database transactions reliable: Atomicity, Consistency, Isolation and Durability. Atomicity means all or nothing, Consistency keeps valid rules, Isolation prevents concurrent transactions interfering, and Durability ensures committed changes survive crashes. They are essential for correctness in systems handling critical data.
Q. What is the final keyword in Java?
asked 2xeasyOOPTechnical2020-2021
Ans. The final keyword in Java prevents further change to a variable, method, or class in a specific way. A final variable cannot be reassigned, a final method cannot be overridden, and a final class cannot be extended. For object references, final fixes the reference, not the object’s internal state.
Q. Explain aggregate functions in SQL.
asked 2xeasyDBMSTechnical2019-2020
Ans. Aggregate functions in SQL compute a single result from a set of rows. Common examples are COUNT, SUM, AVG, MIN and MAX. They are often used with GROUP BY to calculate results per group, such as total sales per customer. Most aggregate functions ignore NULL values, except COUNT(*) which counts all rows.
Q. What are the differences between C and C++?
asked 2xeasyOOPTechnical2015-2021
Ans. C is a procedural language, while C++ is largely a superset of C with object oriented and generic programming features. C++ adds classes, inheritance, polymorphism, templates, exceptions, references, function overloading and the standard library. The most important difference is abstraction: C gives low level control, while C++ supports higher level design without losing that control.
Q. What is the difference between TCP and UDP?
asked 2xeasyNetworkingTechnical2015-2021
Ans. TCP is connection-oriented and reliable, while UDP is connectionless and faster but does not guarantee delivery. TCP orders packets, retransmits lost data, and provides flow and congestion control. UDP sends datagrams with minimal overhead, so it is useful for real-time traffic like video calls, gaming, DNS, or streaming where some loss is acceptable.
Q. What are the differences between C++ and Java?
asked 2xeasyProgramming languagesTechnical2015-2020
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. Write a function to reverse a singly linked list.
asked 2xeasyLinked listsTechnical2020
Ans. Reverse a singly linked list by iterating through it and changing each node’s next pointer to point to the previous node. Keep three references: previous, current, and next, so you do not lose the rest of the list while rewiring. Return previous at the end. This uses O(1) extra space and O(n) time.
Q. What are data structures and what are their types?
asked 2xeasyData structuresTechnical2020
Ans. Data structures are ways to organise and store data so it can be accessed and modified efficiently. Common types are linear structures, such as arrays, linked lists, stacks and queues, and non-linear structures, such as trees, graphs and hash tables. The choice affects time and memory efficiency for operations.
Q. What is polymorphism in object-oriented programming?
asked 2xeasyOOPTechnical2020-2021
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. Explain the difference between a process and a thread
asked 2xeasyOperating systemsTechnical2020
Ans. A process is an independent running program with its own memory space, while a thread is a smaller unit of execution within a process that shares that process’s memory. Processes are more isolated and cost more to create or switch between. Threads are lighter, but shared memory makes synchronisation and race conditions important.
Q. Count the number of vowels from a space-separated input array
asked 2xeasyArraysOnline test2020
Ans. Split the input by spaces, then scan each array element character by character and count characters that are vowels. Use a set containing a, e, i, o, u, and usually their uppercase forms, for constant-time checks. The time complexity is O(n), where n is the total number of characters.
Q. What is the difference between Encapsulation and Abstraction?
asked 2xeasyOOPTechnical2019-2023
Ans. Abstraction hides unnecessary details by exposing what an object does, while encapsulation hides internal state and implementation by controlling how data is accessed or changed. Abstraction is about designing a simple interface. Encapsulation is about protecting data, usually by keeping fields private and using methods to enforce valid behaviour.
Q. Explain the difference between call by value and call by reference.
asked 2xeasyOOPTechnical2015-2021
Ans. Call by value passes a copy of the argument, while call by reference passes access to the original variable. With call by value, changes inside the function do not affect the caller’s variable. With call by reference, changes inside the function can affect the original value, because both refer to the same storage.
Q. Explain OOP concepts in C++.
asked 1xmediumOOPTechnical2021
Ans. OOP in C++ is based on classes and objects, using encapsulation, abstraction, inheritance and polymorphism. Encapsulation hides data behind methods, abstraction exposes only useful behaviour, inheritance reuses and extends existing classes, and polymorphism lets code call derived behaviour through base interfaces, commonly using virtual functions and a virtual destructor.
Q. Explain B-Trees and B+ Trees.
asked 1xmediumDBMSTechnical2020
Ans. B-Trees are balanced multiway search trees where each node stores several sorted keys and child pointers, keeping height small for disk or database access. B+ Trees are similar, but store actual records only in linked leaf nodes, with internal nodes used as indexes. This makes range scans faster and more predictable.
Q. Detect a loop in a linked list
asked 1xmediumLinked listsTechnical2024
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. Explain TCP/IP protocol suite.
asked 1xmediumNetworkingTechnical2021
Ans. The TCP/IP protocol suite is the set of networking protocols that lets devices communicate over the internet and most modern networks. IP handles addressing and routing packets between machines, while TCP provides reliable, ordered delivery using connections, acknowledgements, retransmission and flow control. Common application protocols like HTTP, DNS and SMTP run on top.
Q. What is a dangling pointer in C?
asked 1xmediumOOPTechnical2020
Ans. A dangling pointer in C is a pointer that still holds the address of memory that is no longer valid. This commonly happens after freeing heap memory or returning the address of a local variable. Dereferencing it causes undefined behaviour, so pointers should be reset or avoided after lifetime ends.
Q. Why is String immutable in Java?
asked 1xmediumOOPTechnical2020
Ans. String is immutable in Java so its value cannot change after creation, which makes it safe to share. This matters because strings are widely used for class names, file paths, network connections and keys in maps. Immutability also enables string pool reuse, thread safety without locking, and reliable cached hash codes.
Q. Explain different data structures.
asked 1xmediumGeneralTechnical2021
Ans. Data structures are ways to organise and store data so operations like access, search, insert and delete are efficient. Common examples are arrays, linked lists, stacks, queues, hash tables, trees, heaps and graphs. The key difference is their access pattern and time complexity, so the best choice depends on the problem.
Q. What is the size of void in C/C++?
asked 1xmediumOOPTechnical2021
Ans. void has no size in standard C or C++, because it is an incomplete type representing “no value”. You cannot apply sizeof to void in conforming code. The important distinction is that void* does have a size, because it is a pointer, typically the machine pointer size.
Q. Explain the approach of Quick Sort.
asked 1xmediumSortingTechnical2022
Ans. Quick Sort sorts by choosing a pivot, partitioning the array so smaller elements go to one side and larger elements to the other, then recursively sorting both sides. The key detail is partitioning in place. Average time complexity is O(n log n), but poor pivot choices can make it O(n²).
Q. What is a virtual destructor in C++?
asked 1xmediumOOPTechnical2020
Ans. A virtual destructor in C++ is a destructor declared with virtual in a base class so deletion through a base class pointer calls the derived destructor first. This ensures full cleanup of derived resources. Any class meant to be used polymorphically should usually have a virtual destructor.
Q. Conceptual questions on pointers in C
asked 1xmediumOOPOnline test2015
Ans. A pointer in C is a variable that stores the memory address of another object or function. The key operations are taking an address with &, accessing the pointed value with *, and using NULL to mean it points nowhere. Pointer arithmetic depends on the pointed type, and invalid or dangling pointers cause undefined behaviour.
Q. Conceptual questions on Cloud Computing
asked 1xmediumCloudTechnical2020
Ans. Cloud computing is the on-demand delivery of computing resources such as servers, storage, databases, networking and software over the internet. The key idea is that users rent scalable resources instead of owning infrastructure. Common service models are IaaS, PaaS and SaaS, with benefits like elasticity, cost control and managed availability.
Q. Explain computer networking fundamentals.
asked 1xmediumNetworkingTechnical2023
Ans. Computer networking is how devices communicate by sending data in small packets using shared protocols. The key fundamentals are IP addressing and routing to find destinations, TCP or UDP for transport, DNS for name lookup, ports for applications, and layered models such as TCP/IP that separate physical, network, transport and application responsibilities.
Q. Explain how multithreading works in Java.
asked 1xmediumOOPTechnical2019
Ans. Java multithreading lets a program run multiple threads of execution within the same process, so tasks can progress concurrently. Threads can be created using Thread, Runnable, or higher-level executors. The key detail is that threads share heap memory, so access to shared state must be controlled using synchronisation, locks, or concurrent utilities.
Q. Count the number of inversions in an array
asked 1xmediumSortingTechnical2020
Ans. Use a modified merge sort to count inversions in O(n log n) time. While merging two sorted halves, if an element from the right half is smaller than one from the left, it forms inversions with all remaining elements in the left half. Add that count, merge normally, and return the total.
Q. Explain different CPU scheduling algorithms.
asked 1xmediumOperating systemsTechnical2021
Ans. CPU scheduling algorithms decide which ready process runs next. Common ones are First Come First Served, Shortest Job First, Priority Scheduling, Round Robin, and Multilevel Queue. The key trade-off is between fairness, response time, throughput, and starvation. Preemptive algorithms can interrupt running processes, while non-preemptive ones wait until completion or blocking.
Q. Explain semaphores with respect to deadlocks.
asked 1xmediumOperating systemsTechnical2019
Ans. Semaphores are synchronisation counters used to control access to shared resources, but incorrect use can cause deadlocks. A deadlock occurs when threads wait forever, often because each holds one semaphore while waiting for another. The key prevention is to acquire semaphores in a consistent global order and always release them reliably.
Q. Find the minimum cost path in a matrix or graph
asked 1xmediumDynamic programmingTechnical2020
Ans. Use Dijkstra’s algorithm for a weighted graph with non-negative costs, and dynamic programming for a matrix if movement is only right and down. For Dijkstra, keep shortest known distances in an array and pick the next cheapest node using a priority queue. Time complexity is O((V + E) log V).
Q. Implement Range Minimum Query (RMQ) on an array
asked 1xmediumArraysTechnical2020
Ans. Use a segment tree to implement RMQ by storing the minimum value for each array interval in a binary tree. Build it bottom up in O(n), answer a range query by combining only overlapping segments in O(log n), and support point updates in O(log n). It uses O(n) extra space.
Q. Explain polymorphism in OOP (static and dynamic)
asked 1xmediumOOPTechnical2020
Ans. Polymorphism in OOP means the same interface or operation can behave differently for different types. Static polymorphism is resolved at compile time, commonly through method overloading or generics. Dynamic polymorphism is resolved at runtime, commonly through method overriding, where a base-class reference calls the appropriate subclass implementation.
Q. Predict the output of given pseudocode snippets.
asked 1xmediumLogical reasoningTechnical2019
Ans. Trace the code exactly as a machine would. Write down each variable, update values line by line, and follow loops and conditions carefully. Watch for integer division, operator precedence, off by one loop limits, and changes inside nested loops. For recursion, track calls and return values using a small stack table.
Q. What does the Bootstrap Class Loader do in Java?
asked 1xmediumOOPTechnical2021
Ans. The Bootstrap Class Loader loads the core Java classes needed to start and run the JVM. These include fundamental classes such as java.lang.Object, java.lang.String, and other classes from the standard runtime. It is the parent of other class loaders and is implemented in native JVM code, not Java.
Q. Explain the concept of mutex in operating systems
asked 1xmediumOperating systemsTechnical2015
Ans. A mutex is a locking mechanism that ensures only one thread or process can access a shared resource or critical section at a time. A thread must acquire the mutex before entering and release it after leaving. This prevents race conditions, but incorrect use can cause deadlock or poor performance.
Q. Explain the steps involved in deadlock prevention
asked 1xmediumOperating systemsTechnical2020
Ans. Deadlock prevention means designing the system so at least one necessary deadlock condition can never hold. The steps are to control resource use by avoiding hold and wait, allowing preemption where possible, making sharable resources non-exclusive, or imposing a strict global order for acquiring resources to prevent circular wait.
Q. What are virtual functions and why are they used?
asked 1xmediumOOPTechnical2021
Ans. Virtual functions are member functions that can be overridden in derived classes and are called based on the object’s actual runtime type, not the pointer or reference type. They are used to implement runtime polymorphism, letting common base-class interfaces call derived-class behaviour correctly, such as through base pointers or references.
Q. Explain the types of different Java class loaders.
asked 1xmediumOOPTechnical2021
Ans. Java has bootstrap, platform or extension, application or system, and custom class loaders. The bootstrap loader loads core JDK classes, the platform loader loads standard platform modules or old extension classes, and the application loader loads the classpath. Custom loaders support plugins or isolation. They normally follow parent-first delegation.
Q. Find the Kth smallest element in an unsorted array
asked 1xmediumArraysOnline test2020
Ans. Use Quickselect to partition the array like Quicksort until the pivot lands at index k minus 1, then return that value. It works in average O(n) time and O(1) extra space. The key detail is choosing a good or random pivot to avoid the O(n²) worst case.
Q. Explain deadlock and methods for deadlock avoidance
asked 1xmediumOperating systemsTechnical2020
Ans. Deadlock is a state where two or more processes wait forever because each holds a resource the others need. It requires mutual exclusion, hold and wait, no pre-emption, and circular wait. Avoidance methods include ordering resource acquisition, requesting all resources upfront, allowing pre-emption where possible, and using Banker’s algorithm to keep the system in a safe state.
Q. Find the 4th highest salary from an employee table.
asked 1xmediumSQLTechnical2021
Ans. Use a ranking query that orders salaries descending and returns the row where the dense rank is 4. The key detail is to use distinct salary ranking, not raw row position, so duplicate salaries do not change the result. In SQL, DENSE_RANK over salary descending is the usual approach.
Q. What are virtual functions and where are they used?
asked 1xmediumOOPTechnical2021
Ans. Virtual functions are member functions in a base class that can be overridden in derived classes and called through a base class pointer or reference. They are used for runtime polymorphism, where the actual object type decides which function runs. In C++, destructors are often virtual in polymorphic base classes.
Q. Design a database structure for an E-Commerce website
asked 1xmediumDb designTechnical2020
Ans. Use a relational database with tables for users, addresses, products, categories, inventory, carts, cart items, orders, order items, payments, shipments and reviews. Products link to categories, orders link to users, and order items store product price and quantity at purchase time. The key detail is keeping orders immutable while inventory updates transactionally.
Q. How do you detect and remove a loop in a linked list?
asked 1xmediumLinked listsTechnical2019
Ans. Use Floyd’s slow and fast pointer method to detect the loop, then remove it by finding the node where the cycle starts and setting the previous node’s next pointer to null. After slow and fast meet, move one pointer to head and advance both one step at a time. Time is O(n), space is O(1).
Q. Logical reasoning questions similar to RS Agarwal reasoning problems
asked 1xmediumLogical reasoningOnline test2020
Ans. Identify the type first, such as series, coding, blood relation, direction, seating, syllogism or puzzle. Write the given facts in symbols, tables or diagrams. Work step by step, eliminate impossible options and check edge cases. For patterns, compare differences, positions or letter values. Practise standard formats to improve speed and accuracy.
Q. Design a system of your choice using Object-Oriented Programming (OOP) concepts
asked 1xmediumOOPTechnical2020
Ans. I would design a parking lot system with classes such as ParkingLot, Floor, Spot, Vehicle, Ticket and Payment. Encapsulation keeps spot allocation and pricing rules inside services, inheritance models Vehicle types, and polymorphism calculates fees differently. The key detail is separating responsibilities so allocation, ticketing and payment can change independently.
Q. Determine relationships in a blood relation problem based on given information.
asked 1xmediumLogical reasoningOnline test2021
Ans. Start by identifying the central person and write each relationship step by step. Convert words like “mother’s brother” into simple links, such as uncle. Draw a small family tree if needed, marking gender clearly. Work from the known person to the unknown person, then state the final relationship directly.
Q. Given 3-liter and 5-liter jars and an infinite amount of water, measure exactly 4 liters.
asked 1xmediumLogical reasoningTechnical2020
Ans. Fill the 5-litre jar and pour into the 3-litre jar, leaving 2 litres in the 5-litre jar. Empty the 3-litre jar. Pour the 2 litres into it. Fill the 5-litre jar again, then pour into the 3-litre jar until it is full. Exactly 4 litres remain in the 5-litre jar.
Q. Arrange numbers 1 to 9 in 9 circles forming a triangle such that the sum of each side is equal
asked 1xmediumLogical reasoningTechnical2020
Ans. Let the common side sum be S. The three side sums count every number once, and each corner twice, so 3S = 45 plus the corner sum. Choose corners 1, 5 and 9, giving S = 20. Then place: top 1; left side 6, 8, 5; right side 3, 7, 9; base 5, 2, 4, 9.
Q. Given a real-world software development scenario, explain how you would approach the system design and implementation.
asked 1xmediumDesign approachTechnical2024
Ans. I would start by clarifying requirements, users, scale, data, latency, availability and security needs, then design the smallest reliable architecture that satisfies them. The key detail is to make trade-offs explicit: choose clear APIs, data models, storage, caching, queues and deployment patterns, then implement iteratively with tests, monitoring and rollback plans.
Q. What do you do if your teammate doesn't cooperate with you?
asked 1xeasyConflict resolutionHR2015
Ans. Choose a real example where cooperation was blocked by priorities, communication, or trust, not personality. Emphasise staying calm, clarifying goals, listening first, agreeing responsibilities, and escalating only if needed. Interviewers listen for maturity, accountability, conflict resolution, and whether you protect the team outcome rather than blame the teammate.
Q. If you were given 50 lakhs INR to spend in a week, how would you spend it?
asked 1xeasyDecision makingHR2020
Ans. A strong answer should show judgement, planning, and values, not fantasy spending. Pick a practical context, such as investing in education, family security, debt repayment, charity, or a small venture. Emphasise prioritisation, risk control, and measurable impact. Interviewers listen for maturity, responsibility, financial sense, and whether you can make thoughtful decisions under constraints.
Q. Describe a challenging situation you faced and how you handled it.
asked 1xunknownConflict resolutionHR2021
Ans. Pick a real work challenge with stakes, conflict, uncertainty, or time pressure. Explain enough context to make it clear, then emphasise your specific actions, judgement, communication, and resilience. Interviewers listen for ownership, calm problem solving, learning, and a measurable or credible outcome, not blame or unnecessary drama.
Showing 60 of 387 questions. Ranked by how often the same question came back across interviews.