Q. What are the differences between Java and C?
asked 4xeasyOOPHR, Technical2017-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. What are the differences between C and Python?
asked 3xeasyProgramming languagesHR, Technical2020
Ans. C++ is a compiled, statically typed language focused on performance and control, while Python is an interpreted, dynamically typed language focused on simplicity and fast development. The most important difference is that C++ gives manual control over memory and hardware-level details, whereas Python manages memory automatically but is usually slower.
Q. What is the difference between range and xrange in Python?
asked 3xeasyPythonTechnical2019-2022
Ans. In Python 2, range creates a full list in memory, while xrange returns a lazy sequence object that generates values as needed. The key practical difference is memory use, especially for large ranges. In Python 3, range behaves like Python 2’s xrange, and xrange no longer exists.
Q. Write a program to swap two numbers without using a third variable.
asked 3xeasyMathTechnical2020-2021
Ans. Swap them using arithmetic: set the first number to the sum of both, set the second to the new first minus the second, then set the first to the new first minus the new second. This uses constant space and constant time. The key caveat is integer overflow, so a temporary variable is usually safer.
Q. What is a friend function in C++?
asked 2xmediumOOPTechnical2020
Ans. A friend function in C++ is a non-member function that is allowed to access the private and protected members of a class. It is declared inside the class using the friend keyword, but it is defined and called like a normal function. It is commonly used for operator overloading or related helper functions.
Q. What is Monkey Patching in Python?
asked 2xmediumOOPTechnical2020
Ans. Monkey patching in Python is changing or replacing a module, class, method, or attribute at runtime. It works because Python objects are dynamic, so you can assign new behaviour after import. It is often used in tests or quick fixes, but it can make code harder to understand and maintain.
Q. Explain Hadoop and its core components.
asked 2xmediumBig dataManagerial2019
Ans. Hadoop is an open source framework for storing and processing very large datasets across clusters of commodity machines. Its core components are HDFS for distributed storage, YARN for cluster resource management and job scheduling, MapReduce for parallel batch processing, and Hadoop Common, which provides shared libraries and utilities.
Q. How do you insert a node into a tree? Explain the logic.
asked 2xmediumTreesTechnical2020
Ans. To insert a node into a binary search tree, start at the root and compare the new value with the current node. Go left if it is smaller, right if it is larger, until you find an empty child position. Attach the new node there. Time complexity is O(h), where h is tree height.
Q. How do you measure the execution time of a program in C and Python?
asked 2xmediumPerformanceTechnical2020
Ans. In C, record a timestamp before and after the code using clock_gettime or clock, and in Python use time.perf_counter or the timeit module. The important detail is choosing the right clock: perf_counter and clock_gettime measure elapsed wall time, while CPU-time functions exclude time spent waiting.
Q. Explain the approach to convert a given infix expression to postfix expression.
asked 2xmediumStackTechnical2020
Ans. Use a stack to hold operators and build the postfix expression by scanning the infix expression from left to right. Output operands immediately. For an operator, pop higher or equal precedence operators from the stack before pushing it. Push left brackets, and pop until the matching left bracket on a right bracket. This runs in linear time.
Q. Define Internet of Things (IoT).
asked 2xeasyNetworkingManagerial2019
Ans. The Internet of Things is a network of physical objects embedded with sensors, software and connectivity so they can collect, exchange and act on data over the internet. These objects can include devices, vehicles, appliances and industrial machines. The key idea is enabling monitoring, automation and control without constant human involvement.
Q. How is Python different from Java?
asked 2xeasyOOPTechnical2020
Ans. Python is dynamically typed, usually interpreted, and designed for concise, flexible code, while Java is statically typed, compiled to JVM bytecode, and designed for stronger compile-time checks and large structured applications. The most important practical difference is that Java catches many type errors before running, while Python often finds them at runtime.
Q. What is a lambda function in Python?
asked 2xeasyFunctional programmingTechnical2020
Ans. A lambda function in Python is a small anonymous function defined with the lambda keyword. It can take any number of arguments but contains only one expression, whose value is returned automatically. It is commonly used for short callbacks, such as sorting with a key function, where defining a full function would be unnecessary.
Q. Explain different types of joins in DBMS.
asked 2xeasyDBMSTechnical2019-2020
Ans. Joins combine rows from two tables based on related columns. Inner join returns only matching rows. Left, right and full outer joins keep unmatched rows from one or both sides with nulls. Cross join returns all combinations. Self join joins a table to itself. Natural or equi joins match columns with equal values.
Q. What is Object Oriented Programming (OOP)?
asked 2xeasyOOPTechnical2020
Ans. Object-Oriented Programming is a programming style that organises software around objects, which combine data and behaviour. Objects are usually created from classes. The key idea is encapsulation: keeping state and the operations on that state together, with controlled access. OOP also commonly uses abstraction, inheritance and polymorphism.
Q. What is the difference between BFS and DFS?
asked 2xeasyGraphsTechnical2020
Ans. DFS explores as far as possible along one path before backtracking, while BFS explores all neighbours level by level. DFS uses recursion or a stack; BFS uses a queue. Both mark visited nodes to avoid repeats. For a graph with V vertices and E edges, both run in O(V + E) time.
Q. What is the difference between TCP and UDP?
asked 2xeasyNetworkingTechnical2020
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. Explain polymorphism in object-oriented programming.
asked 2xeasyOOPTechnical2020-2024
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 encapsulation in object-oriented programming.
asked 2xeasyOOPTechnical2020-2024
Ans. Encapsulation is the practice of keeping an object’s data and the methods that operate on it together, while hiding internal details from outside code. The key point is controlled access: fields are usually private, and other code interacts through public methods, which helps protect invariants and reduce unintended dependencies.
Q. Which data types are available in Python but not in C?
asked 2xeasyData typesTechnical2020
Ans. Python has built-in high-level types such as lists, tuples, dictionaries, sets, strings, and arbitrary-size integers, which C does not provide as native data types. C mainly has primitive numeric types, characters, arrays, pointers, structs, and unions, so those Python structures must be implemented manually or via libraries.
Q. How will you print your name in C without using a semicolon?
asked 2xeasyCTechnical2020
Ans. Use printf as the condition of an if statement, with your name as the string argument. The printf call executes while evaluating the condition, so the name is printed, and no semicolon is needed because the if block itself can be empty or contain only braces. This relies on printf returning the number of characters printed.
Q. What is the difference between a compiler and an interpreter?
asked 2xeasyProgramming basicsTechnical2020-2023
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. What is the difference between arrays in C and lists in Python?
asked 2xeasyData structuresTechnical2020
Ans. Arrays in C are fixed-size, contiguous blocks of elements of the same type, while Python lists are dynamic, resizable containers holding references to objects. The key difference is abstraction: C arrays expose low-level memory and require manual size management, whereas Python lists manage resizing and can hold mixed types.
Q. Write the logic to print all prime numbers within a given range.
asked 2xeasyMathTechnical2019
Ans. Use a sieve of Eratosthenes up to the range end, then print numbers marked prime within the requested bounds. Create a boolean array, mark 0 and 1 non-prime, and for each prime p mark multiples from p squared. The time complexity is O(n log log n) and space is O(n).
Q. What is the difference between an abstract class and an interface?
asked 2xeasyOOPTechnical2019-2020
Ans. An abstract class is a base class that can share state and implemented behaviour, while an interface defines a contract that classes agree to implement. The key detail is inheritance: a class usually extends one abstract class, but can implement multiple interfaces, making interfaces better for capabilities across unrelated classes.
Q. What is the difference between Artificial Intelligence and Machine Learning?
asked 2xeasyAi mlHR, Technical2019-2020
Ans. Artificial Intelligence is the broader field of making computers perform tasks that seem intelligent, while Machine Learning is a subset of AI where systems learn patterns from data instead of being explicitly programmed. The key difference is that AI describes the goal, and Machine Learning is one common method used to achieve it.
Q. Explain how Heap Sort works.
asked 1xmediumSortingTechnical2017
Ans. Heap Sort sorts by first building a max heap from the array, then repeatedly moving the largest element at the root to the end and heapifying the remaining part. The key detail is that heapify restores the heap property after each swap. It runs in O(n log n) time and sorts in place.
Q. Explain heap memory in Python.
asked 1xmediumMemory managementTechnical2020
Ans. Heap memory in Python is the area where objects and data structures are dynamically allocated at runtime. Variables hold references to these objects, not the objects themselves. Python’s memory manager handles allocation and deallocation, mainly using reference counting and garbage collection to reclaim objects that are no longer reachable.
Q. How is memory managed in Python?
asked 1xmediumOperating systemsHR2020
Ans. Python manages memory automatically using a private heap, with objects allocated and freed by the interpreter rather than the programmer. The key mechanism is reference counting, where objects are deallocated when their reference count reaches zero, supported by a cyclic garbage collector to clean up reference cycles that counting alone cannot handle.
Q. What AWS services have you used?
asked 1xmediumCloud computingTechnical2020
Ans. I have used EC2, S3, RDS, Lambda, API Gateway, IAM, CloudWatch, SQS, SNS, Route 53 and CloudFormation. The most important part was using IAM carefully, with least privilege access, and combining CloudWatch logs and metrics to debug production issues and monitor reliability.
Q. Explain Object Parsing in Python.
asked 1xmediumOOPTechnical2020
Ans. Object parsing in Python means reading structured input and converting it into Python objects such as dictionaries, lists, classes, or dataclasses. The key detail is choosing the right parser for the format, such as json for JSON or xml libraries for XML, then validating the result before using it to avoid type and data errors.
Q. How can you make garbage in Java?
asked 1xmediumOOPTechnical2019
Ans. You make garbage in Java by creating objects and then removing all reachable references to them. For example, reassign a variable, set it to null, or let a local variable go out of scope. The object is then eligible for garbage collection, though the JVM decides when collection actually happens.
Q. What is an Adapter Class in Java?
asked 1xmediumOOPTechnical2019
Ans. An Adapter Class in Java is a class that provides empty implementations of all methods in an interface, so a subclass can override only the methods it needs. It is commonly used with event listener interfaces in AWT and Swing, reducing boilerplate when an interface has multiple methods.
Q. What is the direct access method?
asked 1xmediumOperating systemsTechnical2020
Ans. Direct access is a file access method where a record can be read or written directly using its address, key, or relative record number, without scanning earlier records. The important point is that storage locations are addressable, so access is much faster than sequential access for known records.
Q. Write the Bellman–Ford algorithm.
asked 1xmediumGraphsTechnical2017
Ans. Bellman-Ford computes single-source shortest paths by initialising all distances to infinity, setting the source to zero, then relaxing every edge V minus 1 times. Store the graph as an edge list of u, v, weight. Finally, scan edges once more to detect a negative-weight cycle. Time complexity is O(VE).
Q. Explain the concept of VPC in AWS.
asked 1xmediumCloud computingTechnical2020
Ans. A VPC, or Virtual Private Cloud, is a logically isolated network in AWS where you run resources like EC2 instances, databases and load balancers. You control its IP address range, subnets, routing, security groups and network ACLs. The key point is that it lets you design secure public and private network areas in the cloud.
Q. Explain Garbage Collection in Java.
asked 1xmediumOOPTechnical2020
Ans. Garbage collection in Java is automatic memory management that finds objects no longer reachable by the program and reclaims their heap memory. The key point is reachability from roots such as stack variables, static fields and active threads. It reduces manual memory errors, but collection timing is not deterministic and may briefly pause execution.
Q. What are self-referential pointers?
asked 1xmediumPointersTechnical2020
Ans. Self-referential pointers are pointers inside a data structure that point to another object of the same type. For example, a node in a linked list has a pointer to the next node. They are essential for dynamic structures such as linked lists, trees and graphs, where objects are connected at runtime.
Q. Write the algorithm for Shell Sort.
asked 1xmediumSortingTechnical2017
Ans. Shell sort repeatedly sorts elements far apart, then reduces the gap until it becomes 1. Start with a gap such as n/2, compare and insert elements within each gap-based sublist using insertion sort, then halve the gap. When the final gap is 1, the array is fully insertion sorted. Average time depends on gaps.
Q. Explain memory management in Python.
asked 1xmediumOperating systemsTechnical2020
Ans. Python manages memory automatically using a private heap, reference counting, and a garbage collector for reference cycles. Every object has a reference count, and when it reaches zero the object can be freed. The key detail is that del removes a reference, not necessarily the object or memory immediately.
Q. How is MongoDB different from MySQL?
asked 1xmediumDBMSTechnical2019
Ans. MongoDB is a document-oriented NoSQL database, while MySQL is a relational SQL database. MongoDB stores flexible JSON-like documents and is good when data shape changes often. MySQL stores data in tables with fixed schemas, joins, and strong relational constraints, which suits structured data and transactions.
Q. What is the volatile keyword in C++?
asked 1xmediumOOPTechnical2020
Ans. volatile tells the C compiler that an object’s value may change in ways it cannot see, so it must not optimise away or cache accesses to it. Each read or write must be performed as written. It is mainly used for memory-mapped hardware registers and signal-shared variables. It does not make operations atomic or thread-safe.
Q. Explain database triggers and cursors.
asked 1xmediumDBMSTechnical2024
Ans. Database triggers are stored procedures that run automatically when events such as insert, update or delete occur, while cursors let a program process query results row by row. Triggers are useful for enforcing rules or auditing changes, but can hide side effects. Cursors are flexible, but often slower than set-based SQL operations.
Q. Write an SQL query using an INNER JOIN.
asked 1xmediumSQLTechnical2019
Ans. Use an INNER JOIN by selecting columns from the first table, joining the second table, and matching related keys in the ON condition, such as customer id in both tables. The important detail is that it returns only rows where the join condition matches in both tables, excluding unmatched rows.
Q. Differentiate between 1NF, 2NF, and 3NF.
asked 1xmediumDBMSTechnical2019
Ans. 1NF removes repeating groups by making each field atomic, 2NF removes partial dependency on part of a composite key, and 3NF removes transitive dependency between non-key fields. In practice, each higher normal form assumes the previous one and reduces duplication and update anomalies by ensuring facts depend on the key, the whole key, and nothing but the key.
Q. Explain the Collection Framework in Java.
asked 1xmediumOOPTechnical2019
Ans. The Java Collection Framework is a standard set of interfaces and classes for storing, accessing and manipulating groups of objects. Its core interfaces include List, Set, Queue and Map, with implementations such as ArrayList, HashSet, PriorityQueue and HashMap. The main benefit is consistent APIs, reusable algorithms and predictable performance choices.
Q. What are the four pillars of Business 4.0?
asked 1xmediumTechnology trendsHR2019
Ans. The four pillars of Business 4.0 are intelligence, agility, automation, and cloud. In practice, this means using data and AI for smarter decisions, agile methods for faster change, automation for efficiency and scale, and cloud platforms for flexible, resilient, and cost-effective digital operations.
Q. What is pickling and unpickling in Python?
asked 1xmediumOOPTechnical2020
Ans. Pickling is serialising a Python object into a byte stream, and unpickling is converting that byte stream back into the original object. It is done with the pickle module, often for saving objects to files. The key caution is never unpickle data from untrusted sources, because it can execute code.
Q. Design and implement a basic elevator system.
asked 1xmediumObject oriented designTechnical2018
Ans. Model the system with Elevator, Request, Scheduler and Controller classes, where each elevator tracks current floor, direction, state and assigned stops. Use two priority queues per elevator for up and down requests, serving nearest stops in the current direction first. New requests are assigned to the cheapest elevator by distance and direction. Operations are logarithmic in queued stops.
Q. Given a square, divide it into 7 equal parts.
asked 1xmediumLogical reasoningManagerial2019
Ans. Mark one side of the square into seven equal lengths. From each mark, draw a straight line parallel to the opposite side across the square. This creates seven congruent rectangles. Each rectangle has the same width and the full height of the square, so each has one seventh of the square’s area.
Q. Put forward your views about the caste system.
asked 1xmediumVerbalHR2019
Ans. A strong answer should take a clear, humane stand against caste discrimination while staying respectful and balanced. Emphasise equality, dignity, constitutional values, and social inclusion. Pick examples from education, workplace, or community life where fairness matters. Interviewers listen for maturity, empathy, awareness of social realities, and rejection of prejudice.
Q. How would you resolve a dispute among your teammates?
asked 1xmediumConflict resolutionHR2020
Ans. Choose a real dispute where you helped reduce tension and reach a practical outcome. Emphasise listening to both sides, separating facts from assumptions, focusing on shared goals, and agreeing clear next steps. Interviewers listen for calm judgement, fairness, communication skills, and evidence that you protect team relationships while still solving the issue.
Q. Find a general formula to sum all odd numbers that are divisible by 3.
asked 1xmediumMathematical reasoningTechnical2017
Ans. The odd numbers divisible by 3 are 3, 9, 15, 21, and so on. They form an arithmetic sequence with first term 3 and common difference 6. The sum of the first n such numbers is n/2[2(3) + (n − 1)6] = 3n².
Q. Solve a basic resistance-based circuit to find current in different branches.
asked 1xmediumPhysicsManagerial2019
Ans. Use Ohm’s law and resistor combination rules. First reduce any series and parallel resistors to an equivalent resistance. Find the total current from the supply using I = V/R. Then work backwards: current is the same in series branches, while voltage is the same across parallel branches. Apply I = V/R to each branch.
Q. Situational questions testing how you would handle tricky workplace scenarios.
asked 1xmediumConflict resolutionHR2020
Ans. Choose a realistic workplace scenario involving conflict, pressure, ambiguity, or a difficult stakeholder. Emphasise calm judgement, communication, ownership, and respect for process. Show how you would gather facts, involve the right people, act ethically, and protect outcomes. Interviewers listen for maturity, self-awareness, collaboration, and practical problem solving rather than blame.
Q. Using a 3-liter and a 5-liter mug, how can you measure exactly 4 liters of water?
asked 1xmediumLogical reasoningTechnical2019
Ans. Fill the 5-litre mug and pour into the 3-litre mug until it is full, leaving 2 litres in the 5-litre mug. Empty the 3-litre mug. Pour the 2 litres into it. Fill the 5-litre mug again, then pour into the 3-litre mug until full. Exactly 4 litres remain.
Q. Propose a new idea in the field of Machine Learning that has not been implemented yet.
asked 1xmediumMachine learningTechnical2020
Ans. I would propose self-auditing ML models that continuously generate, test and publish their own falsifiable assumptions during deployment. The key detail is a built-in evaluator that compares live outcomes with these assumptions, flags drift or bias, and automatically reduces confidence or asks for human review before harmful decisions scale.
Q. You have a round birthday cake and need to cut it into 8 equal pieces using only 3 cuts. How will you do it?
asked 1xmediumLogical reasoningManagerial2020
Ans. Make two straight cuts across the top through the centre, at right angles, creating four equal quarters. Then make one horizontal cut through the middle of the cake’s height. Each quarter is split into a top and bottom half, so 4 times 2 gives 8 equal pieces.
Q. Given a date in dd-mm-yyyy format on which an eclipse occurred, calculate the date when the next eclipse occurs and output it in yyyy-mm-dd format.
asked 1xmediumLogical reasoningOnline test2019
Ans. Parse the input date, then add the eclipse cycle assumed by the problem, commonly the Saros cycle: 18 years, 11 days and about 8 hours. Handle leap years and month lengths while adding days. If only a date is required, ignore the time part or round as instructed. Finally print as yyyy-mm-dd.
Q. Basic system design discussion
asked 1xunknownBasicsTechnical2020
Ans. Start by clarifying requirements, scale, users, latency, availability, and data consistency needs. Then propose a high level architecture with clients, load balancer, stateless services, database, cache, queue, and monitoring. The most important detail is choosing storage and consistency correctly, because it drives performance, failure handling, and future scaling.
Showing 60 of 535 questions. Ranked by how often the same question came back across interviews.