TCS
60+ Patanjali Parivahan Interview Questions and Answers
Q1. What is the reason that the Iterative Waterfall model was introduced?
Iterative Waterfall model was introduced to address the limitations of the traditional Waterfall model.
Iterative Waterfall model allows for feedback and changes during the development process.
It breaks down the development process into smaller, more manageable stages.
It reduces the risk of project failure by identifying and addressing issues early on.
It allows for better collaboration between developers and stakeholders.
Examples include Rational Unified Process (RUP) and Agil...read more
Q2. Water Jug Problem Statement
You have two water jugs with capacities X
and Y
liters respectively, both initially empty. You also have an infinite water supply. The goal is to determine if it is possible to measu...read more
The Water Jug Problem involves determining if a specific amount of water can be measured using two jugs of different capacities.
Start by considering the constraints and limitations of the problem.
Think about how the operations allowed can be used to reach the target measurement.
Consider different scenarios and test cases to come up with a solution.
Implement a function that takes the capacities of the jugs and the target measurement as input and returns True or False based on ...read more
Q3. Write a program for Fibonacci series for n terms where n is the user input.
Program for Fibonacci series for n terms with user input.
Take user input for n
Initialize variables for first two terms of Fibonacci series
Use a loop to generate the series up to n terms
Print the series
Q4. Matrix Multiplication Task
Given two sparse matrices MAT1
and MAT2
of integers with dimensions 'N' x 'M' and 'M' x 'P' respectively, the goal is to determine the resulting matrix produced by their multiplicatio...read more
Implement a function to multiply two sparse matrices and return the resulting matrix.
Create a function that takes two sparse matrices as input and returns the resulting matrix after multiplication.
Iterate through the non-zero elements of the matrices to perform the multiplication efficiently.
Ensure to handle the sparse nature of the matrices to optimize the multiplication process.
Consider the constraints provided to ensure the function works within the specified limits.
Test t...read more
Q5. What are the uses of OOPS?
OOPS is used for creating modular, reusable and maintainable code.
Encapsulation: Hiding implementation details and exposing only necessary information.
Inheritance: Reusing code and creating a hierarchy of classes.
Polymorphism: Using a single interface to represent multiple types of objects.
Abstraction: Simplifying complex systems by breaking them down into smaller, more manageable parts.
Examples: Java, C++, Python, Ruby, etc.
Q6. What is an Agile Model?
Agile Model is an iterative approach to software development that emphasizes flexibility and customer satisfaction.
Agile Model involves continuous collaboration between cross-functional teams and customers
It prioritizes working software over comprehensive documentation
It allows for changes and adjustments to be made throughout the development process
Examples of Agile methodologies include Scrum, Kanban, and Extreme Programming (XP)
Q7. What set in java and what is difference between hash set and map
Set is a collection interface in Java. HashSet and HashMap are two different implementations of Set.
Set is an interface that extends Collection interface.
HashSet is an implementation of Set that uses a hash table to store elements.
HashMap is an implementation of Map that uses a hash table to store key-value pairs.
HashSet does not allow duplicate elements while HashMap allows duplicate values but not duplicate keys.
HashSet uses only one object to store elements while HashMap u...read more
Q8. Write a program to swap two numbers without using third variable
Program to swap two numbers without using third variable
Use the XOR operation to swap the numbers
Assign the first number to the second number using XOR
Assign the second number to the first number using XOR
Q9. What is a Waterfall Model?
Waterfall Model is a linear sequential approach to software development.
It follows a sequential process where each phase must be completed before moving to the next.
It is a rigid model and changes cannot be made once a phase is completed.
It is suitable for projects with well-defined requirements and a stable scope.
Examples of industries that use this model are construction and manufacturing.
Phases include requirements gathering, design, implementation, testing, deployment, an...read more
Q10. Write a program for palindromes of a number.
Program to check if a number is a palindrome or not.
Convert the number to a string
Reverse the string
Compare the original string with the reversed string
If they are equal, the number is a palindrome
Q11. Hashmap duplicate values allowed or not how to store value
Hashmap allows duplicate values and stores them using separate chaining or open addressing.
Duplicate values are allowed in Hashmap as long as they have different keys.
Hashmap stores values using separate chaining or open addressing.
In separate chaining, values with the same hash code are stored in a linked list.
In open addressing, values are stored in the next available slot in the array.
To retrieve a value, the key is hashed and the corresponding slot is checked for the valu...read more
Q12. Why joins needed what is criteria to join two tables
Joins are used to combine data from two or more tables based on a common column.
Joins are used to retrieve data from multiple tables in a single query.
The criteria to join two tables is a common column or key between them.
Types of joins include inner join, left join, right join, and full outer join.
Inner join returns only the matching rows from both tables.
Left join returns all the rows from the left table and matching rows from the right table.
Right join returns all the rows...read more
Q13. Differentiate between Cl & SI Engine? Which one of them is More efficient?
Cl engine uses spark plugs while SI engine uses compression to ignite fuel. SI engine is more efficient.
Cl engine uses spark plugs to ignite fuel while SI engine uses compression
SI engine is more efficient due to higher compression ratio
Examples of Cl engines include diesel engines while SI engines include gasoline engines
Q14. Explain the difference between ArrayList and LinkedList in Java. When would you choose one over the other?
ArrayList and LinkedList are both classes in Java used to store and manipulate collections of data. ArrayList uses an array to store elements, while LinkedList uses a doubly linked list.
ArrayList is faster for accessing elements by index, while LinkedList is faster for adding or removing elements in the middle of the list.
ArrayList uses more memory as it needs to allocate space for the entire list upfront, while LinkedList only needs memory for each element and the pointers t...read more
Q15. What is a Java Stream, and how does it differ from an Iterator? Explain how Streams can be used to process collections efficiently.
Java Stream is a sequence of elements that supports functional-style operations. It differs from Iterator by allowing for more concise and declarative code.
Streams are designed to allow for functional-style operations on collections, such as map, filter, and reduce.
Streams do not store elements, they operate on the source data structure (e.g., List) directly.
Iterators are used to sequentially access elements in a collection, while Streams allow for parallel processing.
Streams...read more
Q16. Explain the concept of immutability in Java. How does the String class achieve immutability, and what are the advantages of immutable objects?
Immutability in Java means objects cannot be modified after creation. String class achieves immutability by not allowing changes to its value.
String class in Java is immutable because once a String object is created, its value cannot be changed.
Any operation that appears to modify a String actually creates a new String object with the modified value.
Advantages of immutable objects include thread safety, caching, and easier debugging.
Q17. What is the difference between final, finally, and finalize in Java? Provide examples to illustrate their usage.
final, finally, and finalize have different meanings in Java.
final is a keyword used to declare constants, prevent method overriding, and prevent inheritance.
finally is a block used in exception handling to execute code after try-catch block.
finalize is a method used for cleanup operations before an object is garbage collected.
Q18. Explain the Singleton design pattern in Java. How can you implement it safely to ensure thread safety?
Singleton design pattern ensures a class has only one instance and provides a global point of access to it.
Create a private static instance of the class.
Make the constructor private to prevent instantiation from outside the class.
Provide a public static method to access the instance, creating it if necessary.
Use synchronized keyword or double-checked locking to ensure thread safety.
Q19. Can you explain the difference between method overloading and method overriding in Java? Provide examples where each should be used.
Method overloading involves creating multiple methods in the same class with the same name but different parameters. Method overriding involves creating a new implementation of a method in a subclass.
Method overloading is used to provide different implementations of a method based on the number or type of parameters. Example: public void print(int num) and public void print(String str)
Method overriding is used to provide a specific implementation of a method in a subclass tha...read more
Q20. What are Java annotations, and how are they used in frameworks like Spring? Explain the difference between built-in and custom annotations.
Java annotations are metadata that provide data about a program but do not affect the program itself. They are used in frameworks like Spring to configure and customize behavior.
Java annotations are used to provide metadata about a program, such as information about classes, methods, or fields.
In frameworks like Spring, annotations are used to configure various aspects of the application, such as dependency injection, transaction management, and request mapping.
Built-in annot...read more
Q21. What are the advantages and disadvantages of using Java’s synchronized keyword for thread synchronization? Can you explain how the ReentrantLock compares to synchronized?
Using Java's synchronized keyword for thread synchronization has advantages like simplicity and disadvantages like potential for deadlock. ReentrantLock offers more flexibility and control.
Advantages of synchronized keyword: simplicity, built-in support in Java
Disadvantages of synchronized keyword: potential for deadlock, lack of flexibility
ReentrantLock advantages: more flexibility, ability to try and lock with timeout
ReentrantLock disadvantages: more verbose syntax, need to...read more
Q22. How does the Java garbage collector work? Can you describe the different types of garbage collection algorithms available in Java?
The Java garbage collector automatically manages memory by reclaiming unused objects.
The garbage collector in Java runs in the background, periodically checking for objects that are no longer needed.
There are different types of garbage collection algorithms in Java, such as Serial, Parallel, CMS, G1, and ZGC.
Each algorithm has its own strengths and weaknesses, and is suited for different types of applications and workloads.
Q23. What is the Java Memory Model, and how does it affect multithreading and synchronization? How does volatile help ensure memory visibility?
The Java Memory Model defines how threads interact through memory and how changes made by one thread are visible to others.
Java Memory Model ensures that changes made by one thread are visible to other threads.
It defines the behavior of threads in terms of reading and writing to memory.
Synchronization in Java ensures that only one thread can access a shared resource at a time.
Volatile keyword in Java ensures visibility of changes made by one thread to other threads.
Volatile k...read more
Q24. How do Java Streams handle parallel processing? What are the potential pitfalls of using parallel streams, and how can they be mitigated?
Java Streams can handle parallel processing using parallel streams. Pitfalls include increased complexity and potential for race conditions.
Java Streams can be processed in parallel by calling the parallel() method on a stream.
Potential pitfalls of using parallel streams include increased complexity, potential for race conditions, and performance overhead.
To mitigate these pitfalls, ensure that the operations performed on the stream are stateless and do not have side effects....read more
Q25. What is the difference between == and .equals() in Java? When should each be used, and what issues can arise from improper usage?
In Java, == compares memory addresses while .equals() compares object contents.
Use == to compare primitive data types and object references.
Use .equals() to compare object contents, such as strings or custom objects.
Improper usage can lead to unexpected results, as == may not always work as expected with objects.
Q26. What are the main features of Java 8? Can you explain how lambdas and the Stream API have changed the way Java applications are written?
Java 8 introduced features like lambdas and Stream API which have revolutionized the way Java applications are written.
Lambdas allow for more concise and readable code by enabling functional programming paradigms.
Stream API provides a way to process collections of objects in a functional style, allowing for easier parallel processing and improved performance.
Java 8 also introduced default methods in interfaces, allowing for backward compatibility with existing code while stil...read more
Q27. What are functional interfaces in Java? How do they work with lambda expressions? Provide an example of a custom functional interface.
Functional interfaces in Java are interfaces with a single abstract method. They can be used with lambda expressions for functional programming.
Functional interfaces have only one abstract method, but can have multiple default or static methods.
Lambda expressions can be used to implement the single abstract method of a functional interface concisely.
An example of a custom functional interface is 'Calculator' with a single abstract method 'calculate'.
Q28. What is a circular queue?
A circular queue is a data structure that follows the FIFO (First In First Out) principle, but the last element is connected to the first element.
It is also known as a ring buffer.
It is useful in situations where the data needs to be accessed in a circular manner.
It has a fixed size and can be implemented using an array or a linked list.
Insertion and deletion operations are performed at the rear and front ends respectively.
Example: CPU scheduling, traffic management, and audi...read more
Q29. Describe the differences between checked and unchecked exceptions in Java. Provide examples and explain how to handle them properly.
Checked exceptions are checked at compile time, while unchecked exceptions are not. Proper handling involves either catching or declaring the exception.
Checked exceptions must be either caught or declared in the method signature using the 'throws' keyword.
Unchecked exceptions do not need to be caught or declared, but can still be handled using try-catch blocks.
Examples of checked exceptions include IOException and SQLException, while examples of unchecked exceptions include N...read more
Q30. What is group discussion
Group discussion is a collaborative conversation among a group of individuals to exchange ideas, opinions, and perspectives on a specific topic.
Group discussion involves multiple participants who actively contribute to the conversation.
It encourages open communication, active listening, and respectful debate.
The goal is to explore different viewpoints, reach consensus, or gain deeper insights.
Group discussions can be structured or unstructured, moderated or unmoderated.
Exampl...read more
Q31. What is arraylist and linkedlist in java
ArrayList and LinkedList are two types of collections in Java used to store and manipulate data.
ArrayList is a resizable array implementation that allows fast random access and iteration.
LinkedList is a doubly linked list implementation that allows fast insertion and deletion at any position.
ArrayList is better for accessing elements frequently, while LinkedList is better for frequent insertion and deletion.
Both implement the List interface and allow duplicates and null value...read more
Q32. Reverse a sentence in java and reverse a word
Answering how to reverse a sentence and a word in Java.
To reverse a sentence, split the sentence into words and then reverse the order of the words.
To reverse a word, convert the word to a character array and then swap the characters from start to end.
Use StringBuilder or StringBuffer for efficient string manipulation.
Example: 'Hello World' -> 'World Hello', 'Java' -> 'avaJ'
Q33. How we build saml trust between sp and idp dsso using iwa agents oidc with multiple grant types
SAML trust between SP and IDP can be built using IWA agents for DSSO and OIDC with multiple grant types.
For SAML trust using IWA agents, the SP and IDP must be in the same Active Directory domain.
For OIDC with multiple grant types, the SP must be registered with the IDP and the grant types must be configured.
Examples of grant types include authorization code, implicit, client credentials, and refresh token.
SAML trust can also be established using certificate-based authenticat...read more
Q34. What do you understand by oop?
OOP stands for Object-Oriented Programming, a programming paradigm based on the concept of objects.
OOP focuses on creating objects that contain both data and methods to manipulate that data.
Encapsulation, inheritance, and polymorphism are key principles of OOP.
Examples of OOP languages include Java, C++, and Python.
Q35. What is constructor?, and its types
Constructor is a special method that initializes an object when it is created.
Constructors have the same name as the class they belong to.
Types of constructors include default, parameterized, copy, and static.
Default constructor has no parameters and initializes instance variables to default values.
Parameterized constructor takes arguments and initializes instance variables to specified values.
Copy constructor creates a new object by copying the values of an existing object.
S...read more
Q36. What are the types of normalization ?
Normalization is a process of organizing data in a database to reduce redundancy and dependency.
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
Fourth Normal Form (4NF)
Fifth Normal Form (5NF) or Project-Join Normal Form (PJNF)
Normalization helps in improving database performance and reducing data redundancy.
Example: Splitting a customer's name into first name and last name to avoid repeating the customer's name in multiple re...read more
Q37. Explain Stress vs Strain Curve and Points?
Stress vs Strain Curve describes the relationship between stress and strain in a material.
Stress vs Strain Curve shows how a material deforms under applied stress.
It helps in understanding the mechanical properties of a material.
The curve typically consists of three regions: elastic, plastic, and fracture.
In the elastic region, the material returns to its original shape after the stress is removed.
In the plastic region, the material undergoes permanent deformation.
The fractur...read more
Q38. Your comfortable language is?
My comfortable language is Java.
I have extensive experience in Java programming.
I am familiar with Java frameworks and libraries.
I have worked on various Java projects, including web development and mobile app development.
Q39. What is PLSQL and Explain the Database planning?
PLSQL is a procedural language designed specifically for Oracle Database. Database planning involves designing, implementing, and maintaining a database system.
PLSQL is used to create stored procedures, functions, and triggers in Oracle Database.
Database planning involves identifying the data to be stored, designing the schema, and optimizing performance.
Normalization is an important aspect of database planning to ensure data integrity and reduce redundancy.
Backup and recover...read more
Q40. SQL join query write down left join
Left join in SQL combines all rows from left table with matching rows from right table.
Syntax: SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name
Left table's all rows are included in the result set, even if there is no match in the right table.
Example: SELECT customers.name, orders.order_id FROM customers LEFT JOIN orders ON customers.customer_id = orders.customer_id;
Result set will contain all customers and their orders if any, else...read more
Q41. What is normalization ?
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization involves breaking down a database into smaller, more manageable tables.
Each table should have a primary key and only contain data that is related to that key.
Normalization helps to prevent data inconsistencies and anomalies.
There are different levels of normalization, with each level building on the previous one.
Examples of normalization include converti...read more
Q42. What you seeing as future in Cloud?
Cloud will continue to grow and evolve, with increased focus on security, AI/ML, and hybrid/multi-cloud solutions.
Security will remain a top priority, with increased adoption of zero-trust architecture and cloud-native security tools
AI/ML will be integrated into cloud services to enable more intelligent and automated decision-making
Hybrid and multi-cloud solutions will become more prevalent as organizations seek to balance cost, performance, and flexibility
Serverless computin...read more
Q43. What is mem mapped functions lambda expressions
Mem mapped functions are functions that are mapped to a memory address for faster access. Lambda expressions are anonymous functions.
Mem mapped functions are used for faster access to frequently used functions.
Lambda expressions are anonymous functions that can be used as arguments or return values.
Combining mem mapped functions with lambda expressions can lead to even faster code execution.
Example: Using a mem mapped function to access a lambda expression that performs a com...read more
Q44. Which computer language you like most?
I like Python the most.
Python is a versatile and easy-to-learn language.
It has a simple syntax and emphasizes readability.
Python has a vast ecosystem of libraries and frameworks.
It is widely used in various domains like web development, data analysis, and artificial intelligence.
Python's popularity is due to its flexibility and community support.
Q45. Why you choose python rather than java
Python's simplicity, readability, and versatility make it a better choice for rapid development and data analysis compared to Java.
Python is known for its simplicity and readability, making it easier to write and maintain code.
Python has a vast ecosystem of libraries and frameworks for various purposes, such as data analysis (e.g. pandas, numpy) and web development (e.g. Django, Flask).
Python's dynamic typing and automatic memory management reduce the amount of code needed, l...read more
Q46. What is SQL ?
SQL is a programming language used to manage and manipulate relational databases.
SQL stands for Structured Query Language.
It is used to create, modify, and query databases.
SQL is used in various applications such as web development, data analysis, and business intelligence.
Examples of SQL-based databases include MySQL, Oracle, and Microsoft SQL Server.
Q47. Spring life cycle explain it
Spring life cycle refers to the series of steps that occur during the creation and destruction of a Spring bean.
The life cycle includes bean instantiation, initialization, use, and destruction.
During instantiation, the bean is created and its dependencies are injected.
During initialization, any necessary setup is performed, such as calling init methods or setting properties.
During use, the bean is available for use by other components in the application.
During destruction, an...read more
Q48. Explain about procedures,packages and triggers?
Procedures, packages, and triggers are database objects used to automate tasks and improve performance.
Procedures are a set of SQL statements that can be executed repeatedly.
Packages are a collection of related procedures, functions, and variables that can be used together.
Triggers are special types of procedures that are automatically executed in response to certain events, such as inserting or updating data in a table.
Procedures and packages can be used to encapsulate compl...read more
Q49. Any idea about overloaded concept
Overloading is the ability to define multiple methods with the same name but different parameters.
Overloading allows a method to perform different tasks based on the input parameters.
The overloaded methods must have different parameter types or number of parameters.
Example: void print(int x), void print(String s), void print(int x, String s)
Overloading is compile-time polymorphism.
Q50. What is inheritance
Inheritance is a mechanism in object-oriented programming where a new class is created by inheriting properties of an existing class.
Inheritance allows code reuse and promotes code organization.
The existing class is called the parent or superclass, and the new class is called the child or subclass.
The child class inherits all the properties and methods of the parent class, and can also add new properties and methods.
For example, a class Animal can be a parent class, and class...read more
Q51. What are methods in java
Methods in Java are blocks of code that perform specific tasks and can be called by other parts of the program.
Methods are declared using the 'public' keyword followed by the return type, name, and parameters.
They can be called by other parts of the program using the method name and passing in any required arguments.
Methods can have a return type or be void (no return value).
They can also have access modifiers such as public, private, or protected.
Examples of built-in methods...read more
Q52. Swapping of two numbers program
Swapping of two numbers program
Declare two variables to store the numbers
Assign values to the variables
Print the values before swapping
Swap the values using a temporary variable
Print the values after swapping
Q53. What is hashtags used for
Hashtags are used to categorize and organize content on social media platforms.
Hashtags make it easier to find and follow specific topics or conversations
They can be used to increase the visibility of a post or to join a larger conversation
Hashtags are commonly used on platforms like Twitter, Instagram, and TikTok
Q54. What is static and use
Static is a keyword used in programming to define a variable or method that belongs to a class rather than an instance of the class.
Static variables are shared across all instances of a class
Static methods can be called without creating an instance of the class
Static keyword can also be used to define a class as final or to create a static block of code
Use keyword is used to import a package or class into a program
Q55. what is dbms
DBMS stands for Database Management System. It is a software system that allows users to define, create, maintain and control access to databases.
DBMS is used to manage large amounts of data efficiently.
It provides a way to store, retrieve and manipulate data in a structured way.
Examples of DBMS include MySQL, Oracle, and Microsoft SQL Server.
Q56. What is an array
An array is a collection of elements of the same data type, stored in contiguous memory locations.
Arrays can be of any data type, including integers, floats, and objects.
Elements in an array are accessed using an index, starting from 0.
Arrays have a fixed size, which is determined at the time of declaration.
Arrays can be initialized with values at the time of declaration, or later using a loop or individual assignments.
Example: string[] names = {"John", "Jane", "Bob"};
Q57. Bubble sort program
Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
Bubble sort is not efficient for large data sets
It has a time complexity of O(n^2)
It works by repeatedly swapping adjacent elements if they are in the wrong order
Example: ['apple', 'banana', 'cherry', 'date'] can be sorted using bubble sort as follows: ['apple', 'banana', 'cherry', 'date'] -> ['apple', 'banana', 'date', 'ch...read more
Q58. What is polymorphism
Polymorphism is the ability of an object to take on many forms.
Polymorphism allows objects of different classes to be treated as if they are of the same class.
It can be achieved through method overloading or method overriding.
Example: A parent class Animal can have child classes like Dog, Cat, etc. which can have their own unique implementation of the method 'makeSound'.
Polymorphism helps in achieving code reusability and flexibility.
Q59. How
Can you explain how you would approach solving a complex coding problem?
Break down the problem into smaller sub-problems
Identify the key requirements and constraints
Consider different algorithms and data structures
Write clear and concise code with good documentation
Test and debug thoroughly
Q60. Reverse the string
Reverse a given string
Create an empty string to store the reversed string
Iterate through the original string from end to start and append each character to the new string
Return the reversed string
Q61. ADSSO using kerberos
ADSSO using Kerberos is a single sign-on authentication protocol for networked systems.
ADSSO stands for Active Directory Single Sign-On
Kerberos is a network authentication protocol
ADSSO using Kerberos allows users to authenticate once and access multiple resources without re-entering credentials
It uses tickets to authenticate users and encrypts communication between systems
More about working at TCS
Top HR Questions asked in Patanjali Parivahan
Interview Process at Patanjali Parivahan
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month