Infosys Interview Preparation Guide
Infosys Interview Preparation Guide
The Waterfall model is a linear and sequential approach to software development consisting of distinct phases such as requirements, design, implementation, testing, deployment, and maintenance . Its advantages include simple project management, easy to understand and use, and well-suited for smaller projects with clear requirements. However, its rigid structure is a disadvantage since it does not easily accommodate changes once the project is underway. This lack of flexibility contrasts with Agile methodologies, which emphasize iterative development, early testing, and stakeholder collaboration, allowing for adjustments based on user feedback and changes in requirements during the development process. Agile is better suited for complex projects prone to frequent changes .
Abstraction and encapsulation are complementary principles in object-oriented programming. Abstraction focuses on hiding the complex reality while exposing only the necessary parts through simplified models or interfaces, enabling developers to deal with higher-level concepts efficiently . Encapsulation, on the other hand, involves bundling data with the methods that operate on it, and restricting access to some of the object’s components. This ensures a controlled interface of the object and prevents the outside code from accessing its internal state directly . Together, these principles enhance modularity and separation of concerns in software design, allowing easier management of complexity, and providing a framework for robust and adaptable code .
Method overloading in C++ occurs when multiple functions have the same name but different parameters (type, number, or both). These functions are distinguished by the signature rather than the return type . An example is having a function print(int a) and another print(double a) in the same class or scope. Method overriding happens when a derived class provides a specific implementation for a member function that is already defined in its base class. This is achieved by using virtual functions in C++ . For example, if a base class has a virtual function draw(), a derived class can override it by providing its own version of draw(). Overriding requires inheritance and allows polymorphism .
Polymorphism is a fundamental concept in object-oriented programming that allows objects to be treated as instances of their parent class, enabling a single function to perform different behaviors based on the object type . In C++, polymorphism is implemented using function overloading and overriding. Function overloading allows multiple functions with the same name to operate on different parameters, whereas overriding allows a subclass to provide a specific implementation of a function already defined in its superclass . Java implements polymorphism through method overriding, where a subclass provides a specific behavior for a method declared in its parent class, and interfaces, which allow classes to implement methods in different ways. Both C++ and Java use virtual functions and dynamic method dispatching to support runtime polymorphism .
A clustered index determines the order in which the data is physically stored in the table. Therefore, a table can have only one clustered index . Non-clustered indexes are separate from the data, containing pointers to the physical rows, and a table can have multiple non-clustered indexes. Clustered indexes improve the performance of retrieval operations that request data in sorted order but can hinder performance on insert and update operations due to the need to maintain data order . Non-clustered indexes, while they slightly improve read operations by providing a quicker lookup path, do not affect the physical storage order of the data and can degrade performance if overused due to the additional space and maintenance requirements .
Normalization in DBMS is a process of organizing data to reduce redundancy and improve data integrity by dividing a database into two or more tables and defining relationships between them . This is achieved by applying a series of rules called normal forms. The primary aim is to minimize duplicate data (redundancy) while ensuring data dependencies make sense to improve data integrity. By forcing tables to adhere to specific patterns, normalization prevents anomalies such as update, insertion, and deletion anomalies, thus ensuring that the database remains consistent and accurate .
Exception handling is a programming construct designed to handle runtime errors, maintaining the normal flow of the program by using try, catch, and throw constructs . In C++, exception handling is implemented using try-catch blocks, where exceptions are thrown using the throw keyword and caught with a catch block. C++ allows any data type to be thrown as an exception . Java also uses try-catch blocks, but its exceptions are objects derived from the Throwable superclass and it enforces a checked exception model for more robust error handling. Only objects that derive from Throwable can be thrown or caught . Java's model encourages developers to handle exceptions more deliberately through its requirement of specifying thrown exceptions in method signatures .
C is a procedural programming language known for its efficiency and control over system resources, making it suitable for system-level programming like operating systems. C++ builds on C by introducing object-oriented programming features such as classes and inheritance, which facilitate complex application development with reuse and abstraction . Python, on the other hand, is an interpreted high-level language known for its readability and simplicity, supporting multiple programming paradigms, including procedural, object-oriented, and functional programming. Its extensive standard library and dynamic typing make it popular for rapid application development, scripting, and data analysis . The choice between these languages depends on project requirements: C is often chosen for performance-critical systems programming, C++ for applications needing complex object hierarchies, and Python for quick prototyping and data-intensive applications .
Cloud computing provides IT companies with scalable resources and economic efficiency by enabling them to access computing power, storage, and applications over the internet without significant upfront investment in hardware . It allows companies to scale resources according to demand, prioritize core business tasks by outsourcing IT infrastructure maintenance, and foster innovation through easy access to new technologies . The primary cloud computing models are Infrastructure-as-a-Service (IaaS), which provides virtualized computing resources; Platform-as-a-Service (PaaS), which offers a platform allowing customers to develop, run, and manage applications without dealing with infrastructure maintenance; and Software-as-a-Service (SaaS), which delivers software applications over the internet on a subscription basis . Each model offers varying levels of control, flexibility, and management for companies, supporting a range of business needs .
The four pillars of Object-Oriented Programming (OOP) are encapsulation, abstraction, inheritance, and polymorphism . Encapsulation involves bundling data with the methods that operate on the data, allowing controlled access and modification, leading to modular design . Abstraction reduces complexity by hiding unnecessary details, allowing developers to focus on high-level functionalities . Inheritance enables a new class to inherit properties and behavior from existing classes, promoting reusability and logical hierarchy . Polymorphism allows multiple classes to be treated as instances of the same class through a common interface, making it easy to scale programs by adding new functionalities with minimal code changes . Together, these principles enhance code reusability and flexibility by allowing developers to build modular programs that can be easily extended and maintained .