TCS
200+ WSP Interview Questions and Answers
Q1. Find the Duplicate Number Problem Statement
Given an integer array 'ARR' of size 'N' containing numbers from 0 to (N - 2). Each number appears at least once, and there is one number that appears twice. Your tas...read more
Given an array of size N containing numbers from 0 to (N-2), find and return the duplicate number.
Iterate through the array and keep track of the frequency of each number using a hashmap.
Return the number with a frequency of 2.
Q2. Find the Second Largest Element
Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.
If a second largest element does not exist, return -1.
Example:
Input:
ARR = [2, 4, 5, 6, ...read more
The task is to find the second largest element in an array of integers.
Iterate through the array and keep track of the largest and second largest elements.
Initialize the largest and second largest variables with the first two elements of the array.
Compare each element with the largest and second largest variables and update them accordingly.
Return the second largest element at the end.
Handle the case where no second largest element exists.
Q3. 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
Q4. Can you describe a challenging technical problem you faced and how you solve it ?
Developing a real-time chat application with high scalability and low latency.
Designing a distributed architecture to handle a large number of concurrent users.
Implementing efficient data synchronization between multiple servers.
Optimizing network communication to minimize latency.
Ensuring data consistency and reliability in a distributed environment.
Q5. 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
Q6. 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
Q7. 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
Chocolate Distribution Problem
Given an array or list of integers called 'CHOCOLATES', representing the number of chocolates in each packet, your task is to distribute these packets among 'M' students so that:
Q9. How do you stay up to date with emerging technologies and programming language ?
I stay up to date with emerging technologies and programming languages through various methods.
I regularly read tech blogs and news websites to stay informed about the latest trends and advancements.
I participate in online forums and communities where developers discuss new technologies and share their experiences.
I attend conferences, workshops, and webinars to learn from industry experts and network with other professionals.
I take online courses and tutorials to enhance my ...read more
Q10. Leap Year Checker
Determine if a given year, represented as an integer 'N', is a leap year.
A leap year is defined as a year with 366 days, unlike a normal year which has 365 days.
Input:
The initial input line...read more
Q11. 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.
Q12. What is digital communication and analogue communication. What's the difference between both of them?
Digital communication is the transmission of data in discrete binary form, while analogue communication uses continuous signals.
Digital communication uses discrete signals represented by 0s and 1s.
Analogue communication uses continuous signals that vary in amplitude, frequency, or phase.
Digital communication is more immune to noise and distortion compared to analogue communication.
Examples of digital communication include email, text messaging, and internet browsing.
Examples ...read more
Q13. 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)
Q14. What is class and object tell the difference
Class is a blueprint for creating objects while object is an instance of a class.
Class defines the properties and behaviors of an object
Object is created from a class and has its own unique state and behavior
Multiple objects can be created from a single class
Class is a static entity while object is a dynamic entity
Example: Class - Car, Object - BMW X5
Q15. What is the difference between runtime and compile time error.
Runtime errors occur during program execution, while compile-time errors occur during compilation.
Compile-time errors are detected by the compiler and prevent the program from running.
Runtime errors occur when the program is running and can cause it to crash or behave unexpectedly.
Examples of compile-time errors include syntax errors and type errors.
Examples of runtime errors include null pointer exceptions and division by zero errors.
Q16. 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
Q17. 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
Q18. 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
Q19. What is rest API and how we achieve it? When we are using spring boot then which annotation first we use during create controller? What is flow of create spring MVC projecf
Explanation of REST API, Spring Boot controller annotation, and Spring MVC project flow.
REST API is a web service that uses HTTP requests to GET, POST, PUT, and DELETE data.
To achieve it, we need to define endpoints, HTTP methods, and data formats.
In Spring Boot, we use the @RestController annotation to create a controller.
The @RequestMapping annotation is used to map HTTP requests to methods.
The flow of creating a Spring MVC project involves defining a model, view, and contr...read more
Q20. How C++ makes coding easy in comparison to C programming ?
C++ provides object-oriented programming and better memory management than C.
C++ supports classes and objects which makes code modular and reusable.
C++ has better memory management with features like constructors and destructors.
C++ supports function overloading and operator overloading which makes code more readable.
C++ has a rich library of built-in functions and data types.
C++ supports exception handling which makes code more robust.
Example: In C, memory allocation and dea...read more
Q21. What is difference between micro-processor and micro controller ? What is 555 IC ? (Because, I am form E&C field)
Micro-processor and micro-controller differ in their architecture and usage. 555 IC is a timer IC used in electronic circuits.
Micro-processor is a CPU with minimal peripherals while micro-controller has CPU, memory, and peripherals on a single chip.
Micro-processor is used in applications that require high processing power while micro-controller is used in embedded systems.
555 IC is a timer IC that can be used in various electronic circuits like oscillators, pulse generators, ...read more
Q22. What is difference between C and C++ programming ?
C++ is an extension of C programming language with added features like object-oriented programming.
C++ supports object-oriented programming while C does not.
C++ has classes and objects while C does not.
C++ has function overloading and operator overloading while C does not.
C++ has exception handling while C does not.
C++ supports namespaces while C does not.
Q23. what is flat map? and what is intermediate operations
Flat map is a method in Java 8 streams that maps each element to a stream and flattens the result into a single stream.
Flat map is used to transform a stream of collections or arrays into a single stream of elements.
It is an intermediate operation that can be used with other intermediate operations like filter and map.
Example: Stream
- > stream = Stream.of(Arrays.asList(1, 2), Arrays.asList(3, 4)); stream.flatMap(Collection::stream).forEach(System.out::println);
Intermediate oper...read more
Q24. 1 cake has to cut in 8 pieces by three cuts
Cut a cake into 8 pieces with 3 cuts.
Make two perpendicular cuts through the center of the cake, dividing it into quarters.
Make a third cut horizontally through the middle of the cake, dividing each quarter into two pieces.
Each quarter will now be divided into two pieces, resulting in 8 total pieces.
Q25. 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
Q26. what is difference between method overloading and method overriding?
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a subclass method with the same name and parameters as a superclass method.
Method overloading is used to provide different ways of calling the same method with different parameters.
Method overriding is used to provide a specific implementation of a method in a subclass that is already defined in a superclass.
Method overloading is resolved at compile-time base...read more
Q27. Use 3l contaner 2 times and pour the milk in 5l container now you have 1l milk afyer that empty 5l container and put 1l milk in 5l container and add 3l milk by using 3l container and gove him 4 l milk
Transfer milk between containers to get 4l in 5l container using 3l container twice.
Use 3l container to fill 5l container with 1l milk
Empty 5l container and put 1l milk in it
Use 3l container to fill 5l container with 3l milk
Total milk in 5l container is now 4l
Q28. 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
Q29. 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
Q30. 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
Q31. if length of rectangle increases by 20% then increased in area?
If length of rectangle increases by 20%, the area increases by 44%.
Calculate the new length and width using the percentage increase formula
Calculate the new area using the formula: new area = (new length) * (new width)
Example: If length = 10 and width = 5, new length = 12 and new width = 5, new area = 60 * 1.2 = 72
Q32. How would you rate your C programming skill on a level of 0-5?
4
Extensive experience in C programming
Proficient in writing efficient and optimized code
Familiar with memory management and pointers
Comfortable with low-level programming and system-level development
Q33. fibonaci series, how to find the even and odd numbers from given numbers?
To find even and odd numbers from a given series, iterate through the series and check if each number is divisible by 2.
Iterate through the given series of numbers
For each number, check if it is divisible by 2
If the number is divisible by 2, it is even; otherwise, it is odd
Q34. Write the program how you can implement basic concepts of oops
Program implementing basic OOP concepts
Create classes with properties and methods
Encapsulate data to restrict access
Inherit properties and methods from parent classes
Polymorphism to allow objects to take on multiple forms
Q35. You have 2 containers one is 5l capacity and second one is 3l capacity by using this you have to give 4 liter milk
Use the 5l container to fill the 3l container, then pour it out and fill it again. Pour the excess into the 3l container and repeat.
Fill 5l container and pour into 3l container
Empty 3l container and pour remaining 2l from 5l container
Fill 5l container again and pour 1l into 3l container to get 4l
Final state: 5l container has 4l, 3l container has 0l
Q36. What is java and database management system?
Java is a programming language and DBMS is a software for managing databases.
Java is an object-oriented language used for developing applications and software.
DBMS is a software system used for creating, managing, and maintaining databases.
Java can be used to interact with DBMS to perform database operations.
Popular DBMS include MySQL, Oracle, and Microsoft SQL Server.
Q37. what is javascript?why we need it ?whats the functionality u used in that
JavaScript is a programming language commonly used for web development to add interactivity and dynamic content to websites.
JavaScript is a client-side scripting language used to create interactive web pages.
It can be used to validate form data, create animations, and dynamically update content without reloading the page.
Common functionalities include event handling, DOM manipulation, and AJAX requests.
Example: document.getElementById('demo').innerHTML = 'Hello World';
Q38. 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
Q39. What is angular . What is the use?
Angular is a JavaScript framework for building web applications.
Angular is used for creating dynamic, single-page web applications.
It provides a structure for organizing code and a set of tools for building complex UIs.
Angular uses declarative templates, dependency injection, and two-way data binding to simplify development.
Examples of popular websites built with Angular include Gmail, PayPal, and Upwork.
Q40. What is it field? It field is nothing but industrial field What is testing Testing is nothing but testing the software
IT field refers to the industrial field of technology and software development.
IT field encompasses a wide range of industries including software development, hardware engineering, and network administration.
IT professionals work to design, develop, and maintain technology systems and software applications.
IT is a rapidly growing field with high demand for skilled professionals.
Examples of IT jobs include software engineer, network administrator, and cybersecurity analyst.
Q41. What is the difference between SQL drop and truncate?
SQL drop is used to delete a table or a database, while truncate is used to delete all the data in a table.
DROP command removes the table structure and its data, while TRUNCATE command only removes the data
DROP command cannot be rolled back, while TRUNCATE command can be rolled back
DROP command is DDL (Data Definition Language), while TRUNCATE command is DML (Data Manipulation Language)
DROP command is slower than TRUNCATE command as it involves more operations
Q42. What are hooks? name some. Explain useState vs useReducer
Hooks are functions that allow you to use state and other React features in functional components. useState and useReducer are two popular hooks.
useState is a hook that allows you to add state to a functional component. It returns an array with two values: the current state and a function to update the state.
useReducer is a hook that allows you to manage more complex state in a functional component. It returns an array with two values: the current state and a dispatch functio...read more
Q43. What is the difference between an interface and an abstract class in Java?
Interface is a contract specifying methods that a class must implement, while abstract class can have both implemented and abstract methods.
Interface cannot have method implementations, while abstract class can have both implemented and abstract methods.
A class can implement multiple interfaces but can only extend one abstract class.
Interfaces are used to achieve multiple inheritance in Java.
Abstract classes can have constructors, while interfaces cannot.
Example: interface An...read more
Q44. How do you implement a stack in Java using an array?
Implement a stack in Java using an array
Create an array to store the elements of the stack
Keep track of the top of the stack using an index variable
Implement push() to add elements to the stack
Implement pop() to remove elements from the stack
Example: String[] stackArray = new String[10];
Q45. What is the difference between a HashMap and a TreeMap in Java?
HashMap is unordered and uses hashing to store key-value pairs, while TreeMap is ordered and uses a red-black tree to store key-value pairs.
HashMap uses hashing to store key-value pairs, allowing for O(1) time complexity for get and put operations.
TreeMap uses a red-black tree to store key-value pairs, maintaining order based on the keys.
HashMap does not guarantee any specific order of elements, while TreeMap maintains elements in sorted order based on keys.
Example: HashMap<S...read more
Q46. 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
Q47. Explain constraints , index ,triggers , standalone procedure and stored procedure
Explanation of constraints, indexes, triggers, standalone and stored procedures.
Constraints are rules that limit the type of data that can be inserted into a table.
Indexes are used to speed up data retrieval by creating a pointer to the data.
Triggers are used to automatically execute a set of instructions when a specific event occurs.
Standalone procedures are independent procedures that can be executed on their own.
Stored procedures are precompiled procedures that can be call...read more
Q48. Using MAT Lab , write a program for signal transmission
A MATLAB program for signal transmission.
Use the 'transmit' function in MATLAB to send signals.
Specify the signal to be transmitted and the transmission parameters.
Handle any errors or exceptions that may occur during transmission.
Test the program with different signals and transmission scenarios.
Q49. Self intro Certifications Features of python Why python is dynamic. Pass keyword in python . List and tuple difference.
Answering questions related to Python and its features.
Python is a high-level programming language known for its simplicity and readability.
It supports multiple programming paradigms like object-oriented, functional, and procedural.
Python is dynamically typed, which means the data type of a variable is determined at runtime.
The 'pass' keyword in Python is used as a placeholder for empty code blocks.
Lists and tuples are both used to store collections of data, but lists are mut...read more
Q50. How would you explain Database to a child
A database is like a big organized collection of information that can be easily accessed and managed.
A database is like a digital filing cabinet where information is stored and organized.
It helps store and retrieve data quickly and efficiently.
Imagine a library where books are organized by categories and you can easily find the book you need.
Examples of databases are online shopping websites, social media platforms, and banking systems.
Q51. **Explain the difference between a stack and a queue. Can you write code to implement both using an array?**
A stack is a Last In First Out (LIFO) data structure, while a queue is a First In First Out (FIFO) data structure.
Stack: elements are added and removed from the top of the stack. Example: function call stack.
Queue: elements are added at the rear and removed from the front of the queue. Example: waiting line at a store.
Code to implement stack using array: push elements to end, pop elements from end.
Code to implement queue using array: enqueue elements to end, dequeue elements ...read more
Q52. What is inheritance in java
Inheritance is a mechanism in Java where a class acquires the properties and methods of another class.
Allows code reusability and saves time
Parent class is called super class and child class is called sub class
Sub class can access all public and protected methods and fields of super class
Keyword used for inheritance is 'extends'
Example: class B extends A {}
Q53. Can You manage IT field as you are from Mechanical Engineering? Explain about Cloud Computing. Latest Trend in Mechanical Engineering
Yes, I can manage IT field as I have relevant skills. Cloud computing is a technology that allows users to access data and applications over the internet.
I have experience in programming languages like Java and Python which are used in IT field
I have knowledge of database management systems which are used in cloud computing
Cloud computing provides on-demand access to shared computing resources like servers, storage, applications, and services
Examples of cloud computing servic...read more
Q54. What are the steps to add a number at the end of a linked list?
To add a number at the end of a linked list, you need to traverse the list to the last node and then create a new node with the number and link it to the last node.
Traverse the linked list to the last node
Create a new node with the number
Link the new node to the last node's next pointer
Q55. Would you like to explore in other technologies except coding like cloud?
Yes, I am open to exploring other technologies like cloud.
I have some experience with cloud technologies like AWS and Azure.
I am interested in learning more about cloud computing and its applications.
I believe that having knowledge of different technologies can make me a more well-rounded engineer.
Q56. What is the round robin algorithim and define the time for it ?
Round robin algorithm is a CPU scheduling technique that assigns equal time slices to each process in a circular order.
Each process is given a fixed time slice called quantum.
After the quantum expires, the process is preempted and added to the end of the ready queue.
The next process in the queue is then given a quantum to execute.
This continues until all processes have executed.
Time complexity is O(n^2) in worst case.
Used in multitasking operating systems.
Example: A CPU with ...read more
Q57. What is scope? What is decorator? Difference between List and Array Difference between List and Tuple How will you manage Memory in python? Explain Namespace. Latest Technology you know.
A set of technical questions related to software engineering.
Scope refers to the visibility of a variable in a program.
A decorator is a function that takes another function and extends its behavior without modifying it.
List is mutable and dynamic, while an array is fixed in size and homogeneous.
List and tuple are both ordered collections, but list is mutable while tuple is immutable.
Memory management in Python is handled automatically by the interpreter's garbage collector.
Na...read more
Q58. What is polymorphism in java
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 is achieved through method overriding and method overloading.
Example: A parent class Animal can have child classes like Dog, Cat, etc. and all of them can have a method called 'makeSound', but each child class can have a different implementation of the method.
Polymorphism helps in achieving code reusability and flexi...read more
Q59. Why React Native and not Flutter?
React Native has a larger community and better support for native modules.
React Native has a larger community and better support for native modules.
React Native is more mature and stable compared to Flutter.
React Native has better performance and faster development time.
React Native is easier to learn for developers who are already familiar with React.
React Native has better integration with third-party libraries and tools.
Q60. how good are you at maths? Reverse your pincode
The question is irrelevant to the job and does not reflect my mathematical abilities.
The question is not related to the job requirements
Reverse pincode can be done by anyone regardless of their math skills
Math skills required for software engineering are different from basic arithmetic
Examples of relevant math skills include algorithms, data structures, and logic
Q61. 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
Q62. What is prpc . And how many years you worked as pega developer
PRPC stands for Pega Rules Process Commander, a software platform for building and managing business applications.
PRPC is a platform used for developing and managing business applications.
It is commonly used in the field of BPM (Business Process Management) and CRM (Customer Relationship Management).
I have worked as a Pega developer for 3 years, specializing in PRPC development.
Q63. what is interface and how it is implemented with selenium java
An interface in Java is a reference type, similar to a class, that can contain only constants, method signatures, default methods, static methods, and nested types.
Interfaces in Java are used to achieve abstraction and multiple inheritance.
In Selenium Java, interfaces can be implemented using the 'implements' keyword.
For example, the WebDriver interface in Selenium Java is implemented by classes like ChromeDriver, FirefoxDriver, etc.
Q64. What is JIT in java and it's importance?
JIT stands for Just-In-Time compiler in Java. It is important for improving the performance of Java applications.
JIT compiles Java bytecode into native machine code at runtime
It optimizes frequently executed code segments for faster execution
JIT reduces the startup time of Java applications
Examples of JIT compilers in Java include HotSpot and JRockit
Q65. What specific topics related to Python were you asked about?
Topics related to Python discussed in the interview
Data structures in Python (lists, dictionaries, tuples)
Object-oriented programming concepts in Python (classes, inheritance, polymorphism)
Exception handling in Python
Python libraries and frameworks (e.g. NumPy, Pandas, Django)
Pythonic coding practices and best practices
Q66. Different between having clause and where clause
Having clause is used with aggregate functions while where clause is used with non-aggregate functions.
Having clause filters the results of aggregate functions based on a condition
Where clause filters the results of non-aggregate functions based on a condition
Having clause is used after the group by clause
Where clause is used before the group by clause
Example: SELECT department, AVG(salary) FROM employees GROUP BY department HAVING AVG(salary) > 50000;
Example: SELECT * FROM e...read more
Q67. what are the datatypes in java
Java has eight primitive datatypes and reference types.
Java has eight primitive datatypes: byte, short, int, long, float, double, char, and boolean.
Reference types include classes, interfaces, arrays, and enums.
Primitive datatypes are passed by value, while reference types are passed by reference.
Autoboxing and unboxing allow primitive datatypes to be used as reference types and vice versa.
Q68. what are the datatypes in python
Python has several built-in datatypes including integers, floats, strings, booleans, lists, tuples, and dictionaries.
Integers are whole numbers without decimals
Floats are numbers with decimals
Strings are sequences of characters
Booleans are either True or False
Lists are ordered collections of items
Tuples are ordered, immutable collections of items
Dictionaries are unordered collections of key-value pairs
Q69. What is Greedy algorithms and what are its types?
Greedy algorithms are algorithms that make the most optimal choice at each step with the hope of finding a global optimum.
Greedy algorithms are used for optimization problems where we need to make a sequence of choices to reach a solution.
Types of greedy algorithms include Prim's algorithm for minimum spanning tree, Dijkstra's algorithm for shortest path, and Huffman coding for data compression.
Greedy algorithms do not always guarantee an optimal solution, but they are often ...read more
Q70. What is the difference between list and tuple?
List is mutable while tuple is immutable.
List can be modified while tuple cannot be modified once created.
List uses square brackets [] while tuple uses parentheses ().
List is slower than tuple in terms of iteration and indexing.
List is used for collections of homogeneous items while tuple is used for heterogeneous items.
Q71. 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'
Q72. 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
Q73. Give me a real life example for multiple inheritance
Multiple inheritance is when a class inherits from more than one parent class.
A real-life example of multiple inheritance is a class that inherits from both a 'Bird' class and a 'Mammal' class to create a 'Bat' class.
Another example is a 'FlyingVehicle' class that inherits from both a 'Vehicle' class and a 'Bird' class to create a 'Helicopter' class.
Multiple inheritance can lead to the diamond problem, where a class inherits from two classes that have a common ancestor, causi...read more
Q74. What is cloud full form?
Cloud full form is 'Clustered Load- Balanced and On-Demand Computing'.
Cloud is a network of remote servers that store, manage, and process data.
It allows users to access data and applications from anywhere with an internet connection.
Examples of cloud services include Amazon Web Services, Microsoft Azure, and Google Cloud Platform.
Q75. If I assign a project what will you do? Builtin functions in python? What is Scope in python?
Answering questions related to project assignment and Python built-in functions and scope.
I would first clarify the project requirements and scope with the assigner.
I would then create a plan and timeline for completing the project.
I would utilize Python's built-in functions to efficiently and effectively complete the project.
Python's built-in functions include print(), len(), range(), and many more.
Scope in Python refers to the accessibility of variables within a program.
Glo...read more
Q76. 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.
Q77. 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
Q78. how to insert null values in database
Null values can be inserted in database by using the keyword NULL or by leaving the field blank.
Use the keyword NULL to insert a null value in a field
Leave the field blank to insert a null value
In SQL, use the IS NULL operator to check for null values
In programming languages, use the null keyword to represent null values
Q79. 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
Q80. Tell me about introduction of python
Python is a high-level programming language known for its simplicity and readability.
Python was created by Guido van Rossum and first released in 1991.
It is an interpreted language, which means it does not need to be compiled before running.
Python has a large standard library and a vast ecosystem of third-party packages.
It supports multiple programming paradigms, including procedural, object-oriented, and functional programming.
Python is widely used in various domains such as...read more
Q81. what is method overloading and method overriding
Method overloading is when multiple methods have the same name but different parameters. Method overriding is when a subclass provides a different implementation of a method that is already defined in its superclass.
Method overloading allows a class to have multiple methods with the same name but different parameters.
Method overriding occurs when a subclass provides a different implementation of a method that is already defined in its superclass.
Method overloading is determin...read more
Q82. 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
Q83. Is cloud computing secure?
Cloud computing can be secure if proper security measures are implemented.
Cloud computing security depends on various factors such as data encryption, access controls, and network security.
Cloud service providers offer security features like firewalls, intrusion detection systems, and data backup.
Organizations must also ensure secure coding practices and regularly update software to mitigate vulnerabilities.
Examples of secure cloud computing platforms include Amazon Web Servi...read more
Q84. What is the complexity of quicksort?
Quicksort has an average and best-case time complexity of O(n log n) and worst-case of O(n^2).
Quicksort is a divide-and-conquer algorithm that recursively partitions an array into two sub-arrays based on a pivot element.
The average and best-case time complexity is O(n log n) because each partition divides the array into roughly equal halves.
The worst-case time complexity is O(n^2) when the pivot element is the smallest or largest element in the array, resulting in unbalanced ...read more
Q85. Software handling situation what will you do
I would analyze the situation and determine the appropriate course of action to resolve the issue.
Identify the problem and its root cause
Determine the impact of the issue on the system and users
Develop a plan to resolve the issue
Implement the plan and test the solution
Document the issue and solution for future reference
Q86. You are ECE, why have you chosen software?
I chose software because of my passion for coding and problem-solving, and the endless opportunities for innovation and growth in the field.
Passion for coding and problem-solving
Endless opportunities for innovation and growth
Interest in technology and software development
Ability to work on diverse projects and industries
Q87. 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.
Q88. 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
Q89. How the database works in Unstructured Stack.?
Unstructured Stack does not have a specific database, but can use various databases for storage.
Unstructured Stack is a collection of various technologies and frameworks that can be used together to build applications.
The choice of database depends on the specific needs of the application.
Some popular databases used in Unstructured Stack include MongoDB, Cassandra, and Couchbase.
Data can be stored in a variety of formats, including JSON, XML, and binary data.
Unstructured Stac...read more
Q90. what are the datatypes in cpp
The datatypes in C++ include fundamental types (int, float, bool), derived types (arrays, pointers, references), and user-defined types (classes, structures, unions).
Fundamental types: int, float, bool
Derived types: arrays, pointers, references
User-defined types: classes, structures, unions
Q91. Which library used for encryption?
The library used for encryption depends on the programming language and framework being used.
In Java, the javax.crypto library is commonly used for encryption
In Python, the cryptography library is a popular choice
In .NET, the System.Security.Cryptography namespace provides encryption functionality
OpenSSL is a widely used encryption library for C/C++
Encryption libraries like bcrypt and scrypt are commonly used for password hashing
Q92. Write C program for palindrome.
A C program to check if a given string is a palindrome or not.
Read the input string from the user.
Initialize two pointers, one pointing to the start of the string and the other to the end.
Compare the characters at the two pointers and move them towards each other until they meet or cross each other.
If all the characters match, the string is a palindrome. Otherwise, it is not.
Q93. What is cloud computing?
Cloud computing is the delivery of computing services over the internet.
Cloud computing allows users to access and use computing resources on-demand, such as storage, processing power, and software applications.
It eliminates the need for users to own and manage physical infrastructure, as everything is hosted and managed by the cloud service provider.
Examples of cloud computing services include Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform.
Q94. What is ethical hacking?
Ethical hacking is the practice of identifying vulnerabilities in computer systems and networks to improve their security.
Ethical hacking involves authorized attempts to bypass security measures and identify weaknesses in order to protect against malicious attacks.
It is performed by skilled professionals who use the same techniques as malicious hackers, but with the permission of the system owner.
The goal of ethical hacking is to uncover vulnerabilities before they can be exp...read more
Q95. Which is your favourite DSA algorithm?
My favorite DSA algorithm is Dijkstra's algorithm.
Dijkstra's algorithm is used to find the shortest path between nodes in a graph.
It is a popular algorithm for solving the single-source shortest path problem.
The algorithm is commonly used in network routing protocols and GPS systems.
Q96. difference between @controller and @ restcontroller
The @Controller annotation is used for MVC web applications, while @RestController is used for RESTful web services.
The @Controller annotation is used to define a class as a controller in a Spring MVC application.
The @RestController annotation is used to define a class as a RESTful web service controller.
The @RestController annotation is a combination of @Controller and @ResponseBody annotations.
The @Controller annotation returns a view while @RestController returns data in J...read more
Q97. 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
Q98. what are constraints? What are OS layers?
Constraints are limitations or restrictions placed on a system or software. OS layers refer to the different levels of an operating system.
Constraints can include limitations on resources such as memory or processing power
Constraints can also refer to design limitations or requirements imposed by stakeholders
OS layers typically include the kernel, device drivers, system libraries, and user interface
Examples of constraints include a maximum file size limit or a minimum support...read more
Q99. Write a function to detect an infinite loop in a program
Function to detect infinite loop in a program
Use a counter to track the number of iterations
Compare the counter value with a threshold to detect infinite loop
Use a timeout mechanism to stop the program if it runs for too long
Q100. 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
More about working at TCS
Top HR Questions asked in WSP
Interview Process at WSP
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month