Tech Mahindra
70+ Interview Questions and Answers
Q1. Tell me something about yourself. Define encapsulation. What is inheritance. What is constructor. What is method overloading. Can we overload a constructor. What is overriding. Difference between overloading an...
read moreThe interview questions cover topics like encapsulation, inheritance, constructors, method overloading, overriding, exception handling, and hobbies.
Encapsulation is the process of hiding the internal details of an object and providing access through methods.
Inheritance is a mechanism in which one class inherits the properties and behaviors of another class.
A constructor is a special method used to initialize objects.
Method overloading is the ability to define multiple methods...read more
You are given an integer ‘N’. You have to print the value of Factorial of ‘N’. The Factorial of a number ‘N’ is defined as the product of all numbers from 1 to ‘N’.
For Example:
Consi...read more
Given an array of numbers, find the maximum sum of any contiguous subarray of the array.
For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would ...read more
You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.
For example:
If the given string is: STR = "abcde". You hav...read more
What are the features of Java 8?
You are given a string 'S' of length 'N', you need to find the frequency of each of the characters from ‘a’ to ‘z’ in the given string.
Example :
Giv...read more
How do we pass data from one component to another in React?
Difference between malloc and calloc
How does React works in the background when the state changes?
Q11. If you found/ raise a bug on the bug tracking tool and the developer review the bug and sends it back to you on the same day. What is the reason. Explain.
The developer reviewed and sent back the bug on the same day.
The developer may have fixed the bug quickly.
The developer may have found the bug to be invalid or not reproducible.
The developer may have requested more information or clarification.
The developer may have sent the bug back for further testing or verification.
The developer may have sent the bug back for a second opinion or review.
What are the phases of each component of React lifecycle?
Explain the concept of threads.
Q19. How do we pass data from one component to another in React?
Data can be passed from one component to another in React using props.
Create a parent component that renders child components
Pass data as props from parent to child components
Use callback functions to pass data from child to parent components
Use context API to pass data to multiple levels of child components
Use Redux for global state management
Q20. How does React works in the background when the state changes?
React uses a virtual DOM to efficiently update the actual DOM when the state changes.
React creates a new virtual DOM tree when the state changes
It compares the new virtual DOM tree with the previous one to find the differences
It then updates only the necessary parts of the actual DOM to reflect the changes
This process is called reconciliation
React also uses a batching mechanism to group multiple state changes together for better performance
Q21. What are the new trending technologies that the company is working on.
The company is currently working on implementing AI and machine learning technologies.
AI-powered chatbots for customer service
Machine learning algorithms for data analysis
Computer vision for image recognition
Natural language processing for voice assistants
Predictive analytics for business intelligence
Q22. What is oops concepts
OOPs concepts are the principles of Object-Oriented Programming that focus on encapsulation, inheritance, and polymorphism.
Encapsulation: bundling of data and methods that manipulate the data within a single unit
Inheritance: ability of a class to inherit properties and methods from a parent class
Polymorphism: ability of objects to take on multiple forms or behaviors
Abstraction: hiding the implementation details of a class from the outside world
Example: A car is an object that...read more
Q23. How would you differentate the property for dev uat and prod in spring
Properties can be differentiated using Spring profiles for dev, uat, and prod.
Define profiles in application.properties or application.yml
Use @Profile annotation to activate specific profile
Separate property files for each profile
Example: application-dev.properties, application-uat.properties, application-prod.properties
Q24. OOPs concepts, calculate character repetition in a sentence, selenium code to invoke a website and enter login credentials
Interview question for Software Engineer on OOPs concepts, character repetition in a sentence, and Selenium code for login.
OOPs concepts include inheritance, encapsulation, polymorphism, and abstraction
To calculate character repetition in a sentence, iterate through each character and keep a count
Selenium code to invoke a website and enter login credentials involves using the WebDriver API and locating the login elements
Example: driver.get('https://www.example.com'), username...read more
Q25. Write a code that takes a string as an input and gives the characters and their count as output.
Code to count characters in a string and output their count.
Create an empty dictionary to store character counts.
Loop through each character in the string and add it to the dictionary with a count of 1 if it doesn't exist, or increment the count if it does.
Output the dictionary with the character counts.
Q26. what is the difference between java and c++
Java is a high-level, object-oriented programming language, while C++ is a low-level, multi-paradigm language.
Java is platform-independent, while C++ is platform-dependent.
Java uses automatic garbage collection, while C++ requires manual memory management.
Java does not support pointers, while C++ does.
Java has a simpler syntax compared to C++.
Java is more secure due to its strong type checking and exception handling mechanisms.
Q27. What are the lifecycle methods of React?
React has three main lifecycle methods: Mounting, Updating, and Unmounting.
Mounting: constructor(), static getDerivedStateFromProps(), render(), componentDidMount()
Updating: static getDerivedStateFromProps(), shouldComponentUpdate(), render(), getSnapshotBeforeUpdate(), componentDidUpdate()
Unmounting: componentWillUnmount()
Examples: componentDidMount() is used to fetch data from an API, componentWillUnmount() is used to clean up any resources used by the component before it i...read more
Q28. Tell me the what are the features of AWS platform
AWS platform offers a wide range of features for cloud computing services.
Scalability: Easily scale resources up or down based on demand
Flexibility: Choose from a variety of programming languages, databases, and operating systems
Security: Built-in security features to protect data and applications
Cost-effective: Pay only for the resources you use
Reliability: High availability and redundancy to ensure uptime
Storage options: Various storage options like S3, EBS, and Glacier
Comp...read more
Q29. 1. what is a technical interview?
A technical interview is a job interview for positions in the technology industry where candidates are evaluated on their technical skills and knowledge.
Technical interviews typically involve coding challenges, problem-solving exercises, and discussions about technical concepts.
Candidates may be asked to write code on a whiteboard, solve algorithmic problems, or explain their approach to solving a technical challenge.
Interviewers may also ask questions about the candidate's e...read more
Q30. What are the features of Java 8?
Java 8 features include lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow functional programming in Java.
Functional interfaces enable the use of lambda expressions.
Streams provide a concise way to perform operations on collections.
Default methods allow interfaces to have implementation.
Date and Time API improvements.
Nashorn JavaScript engine.
Parallel operations on collections.
Type annotations.
Repeatable annotations.
Method referen...read more
Q31. What are the different Frameworks in Bigdata
Some popular Bigdata frameworks include Apache Hadoop, Apache Spark, and Apache Flink.
Apache Hadoop: Used for distributed storage and processing of large data sets.
Apache Spark: In-memory data processing engine for big data analytics.
Apache Flink: Stream processing framework with high throughput and low latency.
Q32. What are different types of file format in Hadoop
Different types of file formats in Hadoop include Avro, Parquet, ORC, SequenceFile, and TextFile.
Avro
Parquet
ORC
SequenceFile
TextFile
Q33. Diff between single inheritance and multiple inheritance
Single inheritance allows a class to inherit from only one parent class, while multiple inheritance allows a class to inherit from multiple parent classes.
Single inheritance: class A can inherit from class B.
Multiple inheritance: class A can inherit from class B and class C.
Single inheritance is simpler and easier to understand.
Multiple inheritance can lead to ambiguity and complexity, known as the diamond problem.
Languages like Java support single inheritance, while language...read more
Q34. What is method hiding?
Method hiding is a concept in object-oriented programming where a subclass defines a method with the same name as a method in its superclass.
Method hiding is also known as static polymorphism or compile-time polymorphism.
It is achieved by using the 'static' keyword in the subclass method definition.
The subclass method with the same name as the superclass method hides the superclass method.
Method hiding is different from method overriding, where a subclass method replaces the ...read more
Q35. What is ddependency injection in Spring
Dependency injection is a design pattern used in Spring to inject dependencies into an object at runtime.
Dependency injection is used to reduce tight coupling between classes
Spring provides three types of dependency injection: constructor injection, setter injection, and field injection
Constructor injection is the preferred method as it ensures that all dependencies are provided at object creation
Setter injection is used when optional dependencies are needed
Field injection is...read more
Q36. What is sql index and sp vs cte ?
SQL index is used to improve the performance of queries by allowing faster data retrieval. SP and CTE are different ways to organize and execute SQL queries.
SQL index is a data structure that improves the speed of data retrieval operations on a database table.
Stored Procedures (SP) are precompiled SQL queries that can be reused and executed multiple times.
Common Table Expressions (CTE) are temporary result sets that can be referenced within a SELECT, INSERT, UPDATE, or DELETE...read more
Q37. What is OOPS?What are the advantages?
OOPS stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects, which can contain data and code.
Encapsulation: Objects can encapsulate data and behavior within a single unit.
Inheritance: Objects can inherit attributes and methods from other objects.
Polymorphism: Objects can take on multiple forms or have different behaviors based on their data type.
Reusability: Objects and classes can be reused in different parts of a program.
Modular...read more
Q38. Explain about join operations in database
Join operations combine data from two or more tables based on a related column.
Join operations are used to retrieve data from multiple tables in a single query.
Common types of join operations include inner join, left join, right join, and full outer join.
Inner join returns only the matching rows from both tables, while left join returns all rows from the left table and matching rows from the right table.
Right join is similar to left join, but returns all rows from the right t...read more
Q39. How we can implement authentication.
Authentication can be implemented using various methods such as OAuth, JWT, and session-based authentication.
OAuth allows users to authenticate using third-party services such as Google or Facebook.
JWT is a token-based authentication method that allows users to authenticate without the need for a session.
Session-based authentication involves creating a session for the user upon successful login and storing the session ID in a cookie.
Authentication can also be implemented usin...read more
Q40. Python function to remove duplicate rows.
Python function using pandas to remove duplicate rows from a dataframe.
Import pandas library
Use drop_duplicates() method on the dataframe
Specify subset of columns if needed
Example: df.drop_duplicates(subset=['column1', 'column2'])
Q41. Discribe regarding 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 industries including finance, healthcare, and e-commerce
Common SQL commands include SELECT, INSERT, UPDATE, and DELETE
Q42. Difference between regression, sanity and smoke
Regression, sanity, and smoke testing are different types of software testing.
Regression testing is done to ensure that new code changes do not negatively impact existing functionality.
Sanity testing is a narrow and focused testing to quickly determine if a new functionality is working as expected.
Smoke testing is a preliminary testing to check if the software build is stable enough for further testing.
Regression testing is comprehensive and time-consuming, sanity testing is ...read more
Q43. What is spring mvc and ioc
Spring MVC is a framework for building web applications in Java. IOC stands for Inversion of Control, a design pattern used in Spring.
Spring MVC is a part of the Spring Framework that provides a model-view-controller architecture for developing web applications.
It follows the MVC pattern, where the model represents the data, the view represents the user interface, and the controller handles the requests and manages the flow of data.
IOC, or Inversion of Control, is a principle...read more
Q44. What is abstraction and polymorphism
Abstraction is hiding implementation details while polymorphism is using a single interface for multiple types.
Abstraction allows us to focus on the essential features of an object while hiding the implementation details.
Polymorphism allows us to use a single interface to represent multiple types of objects.
Abstraction and polymorphism are closely related and often used together in object-oriented programming.
For example, a car can be abstracted as a vehicle with properties l...read more
Q45. What is collections is JAVA
Collections in Java are classes and interfaces that provide a way to store and manipulate groups of objects.
Collections are used to manage groups of objects in Java.
They provide a way to store, retrieve, and manipulate data in a structured manner.
Some examples of collections in Java include ArrayList, LinkedList, HashSet, and HashMap.
Collections can be used to sort, search, and filter data, among other things.
Q46. What is salary expertatikns
Salary expectations refer to the amount of money a software engineer anticipates earning in a job.
Salary expectations are influenced by factors such as experience, skills, location, and industry.
Software engineers with more experience and in-demand skills may have higher salary expectations.
Location plays a role in salary expectations as cost of living varies across different regions.
The industry in which a software engineer works can also impact salary expectations.
For examp...read more
Q47. SQL code to perform upsert using joins
SQL code to perform upsert using joins
Use the MERGE statement in SQL to perform upsert operations
Join the source table with the target table on the appropriate columns
Specify the conditions for matching records and update the target table accordingly
Insert the non-matching records from the source table into the target table
Q48. Difference between function and procedure
Function returns a value while procedure does not.
Function returns a value, procedure does not
Functions are used for calculations and return a value, procedures are used for executing a sequence of statements
Example: Function to calculate the square of a number, Procedure to display a message
Q49. Write a program on Fibonacci series
A program to generate Fibonacci series using iterative or recursive approach.
Use a loop to generate Fibonacci series iteratively
Use recursion to generate Fibonacci series recursively
Start with 0 and 1 as the first two numbers in the series
Add the previous two numbers to get the next number in the series
Q50. It long form and definition
Long form refers to the complete or expanded version of an acronym or abbreviation.
Long form is used to provide clarity and avoid confusion.
It is commonly used in technical fields and academia.
Examples include NASA (National Aeronautics and Space Administration) and AIDS (Acquired Immune Deficiency Syndrome).
Q51. Write a program for palindrome
Program to check if a given string is a palindrome or not.
Convert the string to lowercase to ignore case sensitivity
Use two pointers, one at the start and one at the end of the string
Compare the characters at both pointers and move them towards each other
If all characters match, the string is a palindrome
Q52. what is string?
A string is a sequence of characters.
Strings are used to represent text in programming languages.
They are enclosed in quotes, either single or double.
Strings can be concatenated using the + operator.
Common string operations include length, substring, and replace.
Q53. Ic555 what is the purpose
IC555 is a popular integrated circuit used in electronic devices for generating accurate and stable timing signals.
IC555 is a timer IC that can be used in various applications such as oscillators, pulse generators, and frequency dividers.
It is commonly used in electronic circuits for controlling the timing of events.
IC555 has three operational modes: monostable, astable, and bistable.
In the monostable mode, it generates a single pulse of a specific duration.
In the astable mod...read more
Q54. What are data structures
Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently.
Data structures are used to manage large amounts of data efficiently
They can be implemented using arrays, linked lists, trees, graphs, and more
Examples include stacks, queues, hash tables, and binary search trees
Q55. What is multi threading
Multi threading is the ability of a program to perform multiple tasks concurrently.
Allows for efficient use of CPU resources
Improves program responsiveness and user experience
Can be used for parallel processing and background tasks
Examples include web servers, video players, and gaming applications
Q56. What is lambda function
Lambda function is an anonymous function that can be passed as an argument or returned as a value.
Lambda functions are also known as anonymous functions.
They are commonly used in functional programming languages.
Lambda functions can be used to create closures.
They can be used to write concise and readable code.
Example: lambda x: x*2 defines a function that doubles its input.
Q57. What is Finally Block
Finally block is used in exception handling to execute code regardless of whether an exception is thrown or not.
Finally block is used in conjunction with try and catch blocks in exception handling.
Code inside the finally block will always be executed, even if an exception is thrown.
Common use cases include closing resources like files or database connections.
Example: try { // code that may throw an exception } catch(Exception e) { // handle exception } finally { // cleanup co...read more
Q58. Find second max number in array
Iterate through array to find second max number
Iterate through the array and keep track of the largest and second largest numbers
Compare each element with the largest and second largest numbers to update them accordingly
Return the second largest number found
Q59. Prepare web API filters, routing
Web API filters and routing are essential for managing and directing traffic to the appropriate endpoints.
Filters can be used to modify or validate incoming requests before they reach the endpoint.
Routing determines which endpoint should handle a particular request based on the URL or other criteria.
Filters and routing can be configured using frameworks like Express.js or ASP.NET.
Examples of filters include authentication middleware, rate limiting, and input validation.
Exampl...read more
Q60. new technologies you know?
I am familiar with technologies such as React, Node.js, Docker, Kubernetes, and AWS.
React
Node.js
Docker
Kubernetes
AWS
Q61. Statue of four lions
The statue of four lions is a famous monument located in India.
The statue is located in the city of Delhi.
It was built in the 16th century by Emperor Ashoka.
The four lions represent power, courage, pride, and confidence.
The statue is a symbol of Indian sovereignty and is featured on the national emblem.
It is also a popular tourist attraction.
Q62. What are sql joins?
SQL joins are used to combine rows from two or more tables based on a related column between them.
SQL joins are used to retrieve data from multiple tables based on a related column between them
Types of SQL joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
INNER JOIN returns rows when there is at least one match in both tables
LEFT JOIN returns all rows from the left table and the matched rows from the right table
RIGHT JOIN returns all rows from the right table and ...read more
Q63. What is foreign key?
Foreign key is a field in a database table that links to a primary key in another table.
Used to establish a relationship between two tables in a database
Ensures referential integrity
Prevents invalid data from being inserted into the foreign key column
Example: CustomerID in Orders table linking to CustomerID in Customers table
Q64. Difference between python and java
Python is dynamically typed, interpreted language while Java is statically typed, compiled language.
Python is easier to learn and write code quickly
Java is more verbose and requires more boilerplate code
Python is better for scripting and data analysis
Java is better for enterprise applications and large-scale projects
Python has a simpler syntax and is more readable
Java has better performance and is more secure
Q65. Difference between Hadoop and Spark
Hadoop is a distributed storage system while Spark is a fast and general-purpose cluster computing system.
Hadoop is primarily used for batch processing of large datasets, while Spark is used for real-time data processing.
Hadoop uses MapReduce for processing data, while Spark uses in-memory processing for faster computation.
Spark is faster than Hadoop due to its ability to store data in-memory and perform multiple operations in memory.
Hadoop is more suitable for processing lar...read more
Q66. What is F1 score?
F1 score is a measure of a test's accuracy that considers both the precision and recall of the test.
F1 score is the harmonic mean of precision and recall.
It is calculated using the formula: 2 * (precision * recall) / (precision + recall)
F1 score ranges from 0 to 1, where 1 is the best possible score.
It is commonly used in binary classification tasks.
Q67. Difference between SQL and plsql
SQL is a standard language for managing relational databases, while PL/SQL is a procedural extension for SQL.
SQL is a standard language used to manage and manipulate data in relational databases.
PL/SQL is a procedural language extension for SQL, allowing for more complex programming capabilities.
SQL is used for querying and updating data, while PL/SQL is used for writing procedural code like loops and conditional statements.
SQL is declarative, while PL/SQL is procedural.
Q68. Difference between Hashmap and Hashtable
Hashmap is not synchronized and allows null values, while Hashtable is synchronized and does not allow null values.
Hashmap is faster than Hashtable due to lack of synchronization.
Hashmap allows null values while Hashtable does not.
Hashtable is thread-safe while Hashmap is not.
Both are used to store key-value pairs.
Hashmap is part of the Java Collections Framework while Hashtable is a legacy class.
Q69. networking concepts in cs
Networking concepts in computer science involve understanding how data is transmitted and communicated between devices on a network.
Understanding of OSI model and TCP/IP protocol suite
Knowledge of IP addressing, subnetting, and routing
Familiarity with network devices such as routers, switches, and firewalls
Understanding of network security concepts like encryption and authentication
Experience with network troubleshooting and monitoring tools
Q70. Let var const and scope
Var, const, and scope are key concepts in JavaScript for declaring variables and managing their scope.
Var is used to declare variables with function scope.
Const is used to declare variables with block scope that cannot be reassigned.
Scope refers to the visibility and accessibility of variables within a program.
Q71. Annotations used in spring
Annotations are used in Spring to provide metadata to the Spring framework.
Annotations are used to configure Spring beans and their dependencies.
Some commonly used annotations in Spring are @Autowired, @Component, @Controller, @Service, and @Repository.
Annotations can also be used for AOP (Aspect-Oriented Programming) in Spring.
Annotations can be used to define transaction boundaries in Spring.
Annotations can be used to handle exceptions in Spring.
Annotations can be used to d...read more
Q72. Explain threads?
Threads are lightweight processes that enable multitasking within a single process.
Threads share the same memory space as the parent process
Threads can communicate with each other through shared memory
Threads can be created and destroyed dynamically
Examples include GUI applications, web servers, and video games
Q73. What is Polymorphism
Polymorphism is the ability of a single function or method to operate on different data types.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
There are two types of polymorphism: compile-time (method overloading) and runtime (method overriding).
Example: Inheritance in object-oriented programming languages like Java allows for polymorphism.
Q74. Explain Method Overriding
Method Overriding is a feature that allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
Occurs in inheritance when a subclass provides a specific implementation of a method that is already provided by its superclass
The method in the subclass must have the same name, return type, and parameters as the method in the superclass
The overridden method in the subclass should have the same or broader access modifier than the m...read more
Q75. All types of test steeps
Types of test steps in software testing
Unit testing - testing individual units or components of the software
Integration testing - testing how different units or components work together
System testing - testing the entire system as a whole
Acceptance testing - testing if the software meets the requirements and is ready for release
Regression testing - testing to ensure that changes or updates to the software did not introduce new bugs
Performance testing - testing the software's ...read more
Q76. DBMS concepts in cs
DBMS concepts in computer science involve understanding database design, management, and querying.
Understanding database design principles such as normalization and denormalization
Knowledge of database management tasks like indexing, transactions, and concurrency control
Familiarity with querying languages like SQL and query optimization techniques
Understanding of data modeling and relationships between entities in a database
Knowledge of different types of database systems lik...read more
Q77. Explain Cross join
Cross join combines each row from the first table with each row from the second table.
Cross join does not require any common columns between the two tables.
It results in a Cartesian product of the two tables.
Useful when you want to combine all rows from one table with all rows from another table.
Q78. Explain operators in
Operators in programming are symbols that perform specific operations on one or more operands.
Operators can be arithmetic (+, -, *, /), assignment (=), comparison (==, !=, <, >), logical (&&, ||, !), bitwise (&, |, ^), etc.
Unary operators operate on a single operand, while binary operators operate on two operands.
Examples: 5 + 3 (addition), x = 10 (assignment), a == b (comparison), true && false (logical)
Top HR Questions asked in null
Interview Process at null
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month