MindTree Interview Questions | MindTree Recruitment (2021) - InterviewBit

Before you go!

Take this "MindTree Interview Questions" interview guide with you

Welcome to Interviewbit, help us create the best experience for you!

Currently, You are a:

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your career...

Current Company *
Enter company name
Experience *

You're all set!

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

MindTree Interview Questions

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

About  MindTree

Mindtree Ltd, located in Bangalore, India, is an Indian multinational information technology and outsourcing company. It is a subsidiary of Larsen & Toubro. The company, which was founded in 1999, employs roughly 23,814 people and has an annual revenue of 7839.9 crores (US$1.1 billion). With more than 307 active clients and 43 offices in over 18 countries as of March 31, 2019, the company specialises in e-commerce, mobile applications, cloud computing, digital transformation, data analytics, testing, enterprise application integration, and enterprise resource planning. Retail CPG and Manufacturing (RCM), Banking Financial Services and Insurance (BFSI), Technology Media and Services (TMS), and Travel and Hospitality (TH) are the company's four industry verticals. To tackle consumer difficulties, Mindtree combines strong abilities and a forward-thinking approach.

Mindtree is an excellent place to work since you gain exposure to new things, the management is very pleasant, and you can always have a work-life balance. Mindtree is dedicated to developing tomorrow's engineers. Its training programme involves studying the most up-to-date IT sector technology, making it a fun place to work.

MindTree Recruitment Process

Interview Process

Candidates are normally needed to go through a thorough recruitment procedure at MindTree. The candidate's technical knowledge, as well as their analytical ability, are assessed in these three rounds. The following is a list of them:

  • Online Assessment
  • Technical Interviews
  • HR interviews

These rounds are all elimination rounds. To be considered for a job at MindTree, you must pass all of the aforementioned rounds.

Interview Rounds

  • Online Assessment: The online assessment round at MindTree usually consists of four sections. The different sections are as follows :
    • Written English Ability: This section assesses the candidate’s English writing skills. Questions in this section generally include filling in the blanks with the correct tense, filling in the blanks with the correct preposition, choosing the correct synonym and correct antonym and so on. It can also include paragraph based questions wherein a passage will be given and you need to answer 3 to 4 questions based on that passage. This section will be a piece of cake for you if you have good English writing skills.
    • Quantitative Ability: This section assesses the candidate’s quantitative and mathematics ability. Questions in this section involve questions on mathematics. You need to be fast and accurate in this section. Avoid making silly mistakes and go through the question thoroughly.
    • Logical Ability: This section assesses the candidate’s logical reasoning. Questions in this section generally involve finding the next term of a given series, matching the pattern, finding the odd one out and so on. Try to solve as many questions as possible correctly in this section.
    • Coding Problems: This section generally consists of 2 coding problems of easy to medium difficulty. Try to pass all the test cases of both the problems. You will have the option to write code in any of the modern programming languages which include C, C++, Java, Python etc. Practice data structures and algorithms thoroughly and you will be fine for this section. To practice such questions, you can visit the programming section of our site through this link.
  • Technical Interviews: Candidates who pass the online test will be invited to an in-person technical interview. Technical interviews are intended to assess your technical abilities, which are usually specific to the position you're seeking, as well as to learn how you think, solve problems, and handle stressful situations. Your problem-solving talents will also be evaluated by the interviewer. You'll be questioned about your previous projects and professional experiences, as well as what you did and how you employed technology, as well as your level of success. Learn the fundamentals of computer science to prepare yourself. At least one of the latest programming languages, such as C, C++, Java, or Python, should be mastered by the candidate. You can also be asked about computer fundamentals like Object-Oriented Programming Systems (OOPs), DataBase Management Systems (DBMS), Computer Networks (CN), Computer Organization and Architecture (CoA), and Operating Systems (OS) etc.
    The number of technical interviews you have will be influenced by your performance in previous rounds, your job profile, your experience, and the firm's requirements. Each candidate will typically go through only one round of technical interviews.
  • HR Interviews: The next round of assessment after the technical interviews is the HR interviews. The company wants to assess whether or not you will be a cultural fit for the company. MindTree lays great stress on the HR interviews. Make sure to go through the vision of the company and its leadership principles before you appear for an HR interview. Try to knit your answers accordingly. It is really important to be well prepared for the HR interviews. This round should not be taken lightly.
    Make sure that you are well prepared for any questions that the interviewer may ask based on things that you have mentioned in your resume. So it is important to make sure that you mention things that are true to the best of your knowledge in the resume. 
    Following is a list of the most frequently asked questions in an HR Interview:
    • Tell me about yourself in a few words.
    • Would you consider relocating to another part of India?
    • What do you hope to get out of this job?
    • What drew you to MindTree in the first place?
    • In five years, where do you see yourself?
    • Tell me about your internships and projects.
    • What prompted you to look for a new job? (Many seasoned professionals on the lookout for a new job ask this question.)
    • Tell me about a moment when you faced a challenge and how you dealt with it.
    • Let's pretend you're in charge of a group. One of your team members is underperforming and, despite many warnings, refuses to modify his or her attitude. What will you do if you find yourself in this situation?
    • Describe a circumstance in which you tried your hardest but failed.

MindTree Technical Interview Questions: Freshers and Experienced

1. Explain HTTP and HTTPS protocol in the context of computer networks.

  • HTTP: HTTP stands for Hypertext Transfer Protocol. HTTP is a set of rules and standards that regulate how information can be sent across the Internet. HTTP establishes communication standards for web browsers and servers. HTTP is a network protocol that runs on top of TCP at the application layer. HTTP employs hypertext structured text to create a logical link between text-containing nodes. It's also known as the "stateless protocol" since each command is conducted separately, without using the last run command as a reference.
  • HTTPS: HTTPS is the acronym for HyperText Transfer Protocol Secure. It is a highly advanced and secure HTTP version. For data communication, it uses port 443. Encrypting all communication using SSL, it provides for secure transactions. It's a hybrid of the SSL/TLS and HTTP protocols. It allows a network server to be identified in an encrypted and safe manner. HTTPS also enables the server and browser to establish a secure encrypted connection. It provides data security in both directions. This assists you in preventing the theft of potentially sensitive information.

2. Differentiate between Multiprogramming vs Multitasking.

Following are the differences between Multiprogramming and Multitasking:

Multiprogramming Multitasking
Multiprogramming is primarily used to maximise CPU efficiency by arranging applications so that only one programme is running at any given time. Multitasking, on the other hand, tries to improve reaction time by sharing computing resources among multiple users.
The goal of multiprogramming is to make the CPU work harder. The programs are designed in such a way that the CPU is never idle; each program is executed one after the other. Multitasking, on the other hand, aims to enhance CPU reaction time.
Multiprogramming is based on the concept of context switching, which is a common operation that allows a single processor machine's CPU to switch from one task to another. The Process Control Block (PCB) keeps track of an active process's state so that the CPU can resume from the same point.  Multitasking, on the other hand, is based on time-sharing, which means that each activity or process is completed in the same amount of time.
Multiprogramming relies on a computer's ability to store programs for longer periods of time in order to reduce CPU idle time. Processes are allocated using the scheduling mechanism. The operating system executes a portion of one program at a time, then another program, and so on. The CPU, on the other hand, allows multiple processes to run at the same time using time-sharing and executes them properly under a multitasking operating system.
Multiprogramming can be done on a computer with a modest amount of RAM or ROM memory; a large quantity of memory is not required. Multitasking, on the other hand, demands a large quantity of memory storage in order to complete all jobs or processes at the same time.

3. What do you understand about Object Oriented Programming? Explain the major features of object oriented programming.

Object-oriented programming (OOP) is a programming paradigm that organises software design around data, rather than functions and logic. An object is a data field with its own set of properties and behaviour. Object-oriented programming (OOP) focuses on the objects that developers desire to handle rather than the logic that is required to manipulate them. This kind of programming is ideally suited to big, complicated, and frequently updated or maintained projects. Inheritance, hiding, polymorphism, and other real-world concepts are all part of object-oriented programming. The basic goal of OOP is to connect data and the functions that operate on it so that no other part of the code may access it except that function.

Following are the major features of Object-Oriented Programming:

  • Encapsulation: The word "encapsulate" refers to the act of enclosing something. Encapsulation works in OOP in a similar fashion to how a pill "encapsulates" or contains the medication under its coating: by building a protective barrier around the information contained within a class from the rest of the code. In OOP, we encapsulate data and methods that operate on it by combining them into a single unit, the class. We can hide the private information of a class from the outside world and only disclose functionality that is needed to interact with it this way. We say a class is properly enclosed when it prevents calling code from accessing its private data directly.
    • For example, consider a multinational company. There are various sectors in a firm, such as the accounts, finance, and sales departments. The finance department is in charge of all financial transactions and keeps track of all financial data. Similarly, the sales department is in charge of all sales-related activities and keeps track of all sales. Now and then, a circumstance may arise in which a finance official requires complete sales data for a specific month for some reason. In this instance, he is not permitted to view the sales section's data directly. He must first contact another officer in the sales department and request that he provide the requested information. Encapsulation is what it is. The data from the sales area, as well as the employees who can change it, are grouped together under the heading "sales section."
  • Abstraction: Abstraction is the technique of hiding unnecessary details and displaying only the necessary details. The practice of identifying only the required attributes of an object while discarding the irrelevant information is known as data abstraction. The features and behaviours of an object assist to distinguish it from other things of the same sort, as well as classifying and grouping them.
    • For example, consider an ATM machine. In our daily lives, we all utilise an ATM machine for cash withdrawals, money transfers, retrieving minimum statements, and so on. However, we have no idea what happens inside an ATM machine when you insert an ATM card to execute any type of transaction.
  • Inheritance: Inheritance is the technique in Object-Oriented Programming by which one class can acquire all the properties of another class and can even add more properties to its definition. Inheritance, therefore, enforces code reusability. The class whose properties are being inherited is referred to as a base or parent class while the class which inherits the properties of another class is referred to as sub or child class.
    • For example, A child inherits a lot of physical features from his/ her parents. People often compare whether a particular feature is the same as that of the father or the mother. There are different types of vehicles such as cars, buses, trucks and so on. All of these different types of vehicles can be believed to have inherited all the basic properties of a Vehicle which includes an accelerator, brake and so on.
  • Polymorphism: Polymorphism is the technique of using one thing in more than one form. Polymorphism, in other terms, allows you to specify a single interface with various implementations.
    • For example, a person can have different relations with different people around them. A person may be a father to a son, a brother to a sister, a son to a mother and so on. Similarly, a person may behave differently depending on the situation. For example, two people in an office are considered colleagues during work hours, but they can be friends after office hours. When you're in class, you act like a student; when you're in the store, you act like a customer; when you're at home, you act like a son or daughter; here, one person exhibits a variety of behaviours.

4. What are the advantages of Object Oriented Programming?

Following are the advantages of Object-Oriented Programming:

  • Instead of needing to start writing code from scratch, we can build programs from standard functioning modules that communicate with one another, saving time and increasing productivity.
  • The Object-Oriented Programming language allows us to divide the program down into small-sized problems that can be solved quickly (one object at a time).
  • The Object-Oriented Programming Language increases programmer efficiency, improves software quality, and reduces maintenance costs.
  • OOPs, concepts can be applied from tiny to large systems.
  • It is possible for numerous instances of objects to coexist without interfering with one other
  • The data hiding principle aids programmers in creating secure programs that are not vulnerable to code in other areas of the program.
  • We can minimise duplicate code and increase the use of existing classes by using inheritance.

5. Differentiate between interface and abstract class in the context of Java.

The following table lists the differences between an interface and abstract class:

Interface Abstract class
Only abstract methods are allowed in an interface. It can also contain default and static methods with Java 8. There are abstract and non-abstract methods in an abstract class.
We cannot implement the concept of multiple inheritances using interfaces. We cannot implement the concept of multiple inheritances using abstract classes.
The implementation of an abstract class cannot be provided by an interface. An abstract class can provide interface implementation.
Only static and final variables are used in the interface. Variables in an abstract class can be final, non-final, static, or non-static.
To declare an interface, we use the interface keyword. To declare an abstract class, we use the abstract keyword.
Only another Java interface can be extended by an interface. An abstract class can implement numerous Java interfaces by extending another Java class.
The keyword "implements" can be used to create an interface. The keyword "extends" can be used to extend an abstract class.
By default, members of a Java interface are public. Private, protected, and other class members can be found in a Java abstract class.

6. Does Java allow a class to inherit from multiple classes? If not, how can a class achieve the properties of more than one class (i.e., multiple inheritance)?

Multiple inheritances are not allowed by Java using classes. This is because dealing with the complexity that multiple inheritances produce is quite difficult. For example, 

 import java.io.*;

class Base1 {
 
  void fun() {
    System.out.println("Parent1");
  }
}
 

class Base2 {
   
  void fun() {
    System.out.println("Parent2");
  }
}
 

class Child extends Base1, Base2 {
 
  public static void main(String args[]) {
 
    Child obj = new Child(); // object creation of the child class
    obj.fun(); // it leads to compilation error since fun() is defined in both Base1 and Base2 and the compiler gets in an ambiguous situation as to which fun() is being referred to.
  }
}

In the above code, a compilation error is thrown. This is because both the classes Base1 and Base2 contain a definition for the function fun(). This confuses the compiler as to which fun() is being referred to.

Multiple Inheritance causes issues during operations such as casting, constructor chaining, and so on, and the main reason is that we only need multiple inheritances in a few cases, thus it's best to leave it out to keep things simple and easy.

However, the main objective of multiple inheritances to inherit from multiple classes can be obtained via interfaces in Java. An interface, like a class, has variables and methods, however, unlike a class, the methods in an interface are abstract by default. The class that implements an interface needs to define the member functions. If a class implements multiple interfaces, or if an interface extends multiple interfaces, multiple inheritances via interface happen. 

For example, the code for the above example using interfaces would be like this:

 interface Base1
{
   public void fun();
}
interface Base2
{
   public void fun();
}
class Child implements Interface1, Interface2
{
   public void fun()
   {
       System.out.println("Implementing the fun() of the interface.");
   }
   public static void main(String args[]){
    Child obj = new Child();
    obj.fun();
   }
}

In the above code, the fun() is not defined in the interfaces Base1 and Base2. They are defined by the classes which implement the interfaces. This leads to no ambiguity and the purpose of multiple inheritances has been solved.

7. Write a program to calculate the Least Common Multiple (LCM) of two numbers. Example : Input : a = 10, b =15 Output : 30 a = 5, b = 7 Output : 35

Input :
a = 10, b =15
Output :
30
a = 5, b = 7
Output :
35

Approach:

Let us assume the two numbers are a and b. Then, the two numbers have the following relationship :

 a * b = LCM(a, b) * GCD(a, b)

or,

 LCM(a, b) = (a * b) / GCD(a, b) 

Let us take an example to understand better. For a = 10 and b = 15, a * b = 150, LCM(10, 15) = 30, GCD(10, 15) = 5. So, a * b = LCM(a, b) * GCD(a, b).

Code :

 #include <iostream>
using namespace std;
 
//Function to find the greatest common divisor of the two numbers
int findGCD(int a,int b)
{
  if (b == 0)
    return a;
  return findGCD(b, a % b);
}
 
// Function to return LCM of two numbers
int findLCM(int a, int b)
{
    return (a * b) / findGCD(a, b);
}
  
int main()
{
    int a = 10, b = 15;
    cout <<"The Least Common Multiple of the two numbers " << a << " and " << b << " is : " << findLCM(a, b);
    return 0;
}

Output:

 The Least Common Multiple of the two numbers 10 and 15 is : 30

Explanation: 

In the above code, the function findGCD() finds the greatest common divisor of the two numbers a and b. We use the Euclidean algorithm to find the greatest common divisor of the two numbers. The function findLCM() finds the least common multiple of the two numbers.

8. Write a program to sort a given array of numbers. The sorting algorithm should give best performance in every case (best, worst and average). Example : Input : arr = {3, 5, 7, 1, 2, 4, 6} Output : {1, 2, 3, 4, 5, 6, 7}

Example:
Input :
arr = {3, 5, 7, 1, 2, 4, 6}
Output :
{1, 2, 3, 4, 5, 6, 7}

Approach:

Since we want the sorting algorithm to give the best time complexity in all three cases (that is, best, worst and average), we will implement merge sort to sort the given array of numbers. In merge sort, we divide an array into two halves recursively, sort each half and then merge them.

Code:

 #include<bits/stdc++.h>
using namespace std;

//function to merge the two sorted halves of the array
void merge(int *arr, int start, int mid, int end) {
    int temp[end - start + 1];// creating a temporary array to store the sorted array

    int i = start; 
    int j = mid+1;
    int  k = 0;

    while(i <= mid && j <= end) {
        if(arr[i] <= arr[j]) {
            temp[k] = arr[i];
            i = i + 1;
        }
        else {
            temp[k] = arr[j];
            j = j + 1;
        }
        k = k + 1; 
    }

    //If the first half still has elements, we add them to the temporary array
    while(i <= mid) {
        temp[k ++] = arr[i ++];
    }

    //If the second half still has elements, we add them to the temporary array 
    while(j <= end) {
        temp[k ++] = arr[j ++];
    }

    // We store the sorted order of elements in the original array
    for(i = start; i <= end; i ++) {
        arr[i] = temp[i - start]
    }
}


// function to sort an array of elements
void mergeSort(int *arr, int start, int end) {

    if(start < end) {
        int mid = (start + end) / 2;// finding the mid index
        mergeSort(arr, start, mid);// sorting the left side of the array
        mergeSort(arr, mid+1, end);// sorting the right side of the array
        merge(arr, start, mid, end);// merging the left and right halves of the array
    }
}

int main()
{
    int arr[] = {3, 5, 7, 1, 2, 4, 6};
    int n = sizeof(arr)/ sizeof(arr[0]);
    mergeSort(arr, 0, n);
    cout << "The sorted array is : ";
    for(int i = 0; i < n; i ++)
    cout << arr[i];
    cout << "\n";
    return 0;
}

Output:

 The sorted array is : 1 2 3 4 5 6 7

Explanation:

In the above code, the function merge() merges the two sorted halves of the array. The function mergeSort() recursively breaks the problem into subproblems, sorts each half and then merges the sorted halves by calling the merge() function. 

9. You have 15 rupees on you. You enter a shop and the shopkeeper informs you that each chocolate costs one rupee. He also informs you that in exchange for three wrappers, you will receive a chocolate. How many chocolates can you eat in total?

We can eat a total of 22 chocolates for Rs. 15. First, we will buy 15 chocolates for 15 rupees since each chocolate costs Re. 1. Now, we have 15 wrappers. We return all the 15 wrappers to the shopkeeper which gives us 5 chocolates (15 / 3 = 5). We eat those five chocolates and return 3 wrappers to the shopkeeper and get 1 chocolate. We eat that chocolate and again give 3 wrappers which give us one chocolate. So, in total, we can have 15 + 5 + 1 + 1 chocolates. 

10. What do you understand by super key, candidate key, primary key and foreign key in the context of database management systems?

  • Super key: Super Key is a set of attributes that can be used to uniquely identify a tuple. The super key is created by adding zero or more attributes to the candidate key. A candidate key is a super key, but not the other way around.
  • Candidate key: A candidate key is the smallest set of attributes that can uniquely identify a tuple. For each tuple, the Candidate Key value is unique and non-null. In relation, there can be more than one candidate key. The candidate key might be simple (only having one attribute) or composite (containing multiple attributes).
  • Primary key: In relation, there may be more than one candidate key, with one being chosen as the primary key. This primary key is chosen by the database administrator based on the requirements amongst the candidate keys.
  • Foreign key: A foreign key is a column or set of columns in a relational database table that connects data from two other tables. It serves as a cross-reference between tables by referencing the primary key of another table and therefore creating a relationship between them.

For example, let us consider tables with the following schema :

Teacher

teacher_id (primary key), teacher_name, teacher_phone_number, teacher_aadhar, teacher_department_id

Department

department_id (primary key), department_name

Here, for the Teacher table, the following are the different types of keys present :

  • The candidate keys can be teacher_id, teacher_phone_number and teacher_aadhar since they all can uniquely identify a record of the table.
  • Out of the above three candidate keys, any one of them can be chosen as the primary key. We generally choose teacher_id as the primary key.
  • Any of the above candidate keys when grouped with any other key form the super key. For example, teacher_id, teacher_name can together form a super key.
  • Teacher_department_id is a foreign key for the Teacher table since it is a primary key in the Department table and it links the two tables.

11. What are the different types of SQL commands?

Following are the different types of SQL commands :

  • Data Definition Language (DDL): DDL commands are those commands that modify the table's structure, such as by adding, deleting, or changing a table. All DDL commands are auto-committed, which means they store all database changes permanently. Example - Create, Drop, Truncate, Alter.
  • Data Manipulation Language (DML): The database is modified using DML commands. It is in charge of all database modifications of any kind. The DML command is not auto-committed, which means it cannot preserve all database modifications permanently. They have the potential to be rolled back.  Example - Insert, Update, Delete.
  • Data Control Language: Any database user can be granted or revoked authority using DCL commands. Example - Grant, Revoke.
  • Transaction Control Language (TCL): Transaction Control Language commands are commands that are used to manage transactions in a database. Only DML commands like INSERT, DELETE, and UPDATE can be used with TCL commands. Because these activities are automatically committed to the database, they can't be used while creating or dropping tables. Example - Commit, Rollback, Savepoint.
  • Data Query Language (DQL): DQL commands are used to fetch data from the database. Example - Select.

12. Differentiate between Delete and Truncate SQL commands.

The following table lists the differences between Delete and Truncate SQL commands:

Delete Truncate 
The DELETE command is used to remove specific rows from a table (one or more). This command is used to delete all of the rows in a table.
It is a Data Manipulation Language (DML) command. It is a Data Definition Language (DDL) command.
In order to filter the records, the DELETE command may include a WHERE clause. The TRUNCATE command may not use a WHERE clause.
The DELETE statement deletes rows one by one and records each deleted row in the transaction log. TRUNCATE TABLE deletes data by relocating the data pages that were used to hold the table data, and only the page deallocations are recorded in the transaction log.
A tuple is locked before being deleted with the DELETE statement. Before removing the table data, the data page is locked in this command.
DELETE permission on the table is required to use Delete.  To use Truncate on a table, the table must have at least ALTER permission.
The DELETE command is more time consuming than the TRUNCATE command. The TRUNCATE command, on the other hand, is faster than the DELETE command.
With indexed views, the delete command can be used. Truncate isn't compatible with indexed views.
After performing the DELETE Statement on the table, the identity of the column is preserved. If the table contains an identity column, the column's identity is reset to its seed value.

13. Differentiate between new and malloc() in the context of C++.

The following table lists the differences between new and malloc():

new malloc()
new is an operator. malloc() is a function.
When we use a new operator, it calls the constructor. Usage of the malloc() function does not involve invoking constructors.
It returns the data type specified while using the new operator.  It returns a void * type which needs to be typecasted manually to the required data type.
When the new operator fails, it throws an error of bad_alloc exception. When the malloc() command fails, it returns NULL.
Here, the size of memory required is computed automatically by the compiler. Here, the size of memory required needs to be computed manually and provided at the time of using malloc().

14. Explain the Open Systems Interconnection (OSI) model in the context of computer networks.

Following are the different layers in the OSI model:

Physical Layer: The physical layer is the lowest layer in the OSI reference model. It is in charge of establishing a physical connection between the devices. Bits of information are stored in the physical layer. Following are the responsibilities of the physical layer :

  • Bit synchronisation: A clock is provided by the physical layer, which allows the bits to be synchronised. This clock controls both the sender and the receiver, ensuring bit-level synchronisation.
  • The transmission rate, or the number of bits transferred per second, is likewise defined by the Physical layer.
  • Physical topologies: The physical layer defines the arrangement of devices/nodes in a network, such as bus, star, or mesh topologies.
  • Transmission mode: The physical layer also specifies how data is passed between the two linked devices. Simplex, half-duplex, and full-duplex transmission modes are available.

Data Link Layer (DLL): The data link layer is in charge of message transport from node to node. The major purpose of this layer is to ensure that data transfers from one node to another through the physical layer are error-free. Following are the responsibilities of data link layer :

  • Framing: The data link layer is responsible for framing. It allows a sender to deliver a set of bits to a receiver that are relevant to the receiver. This can be done by attaching unique bit patterns to the frame's beginning and end.
  • Physical addressing: After producing frames, the Data link layer adds the sender and/or receiver's physical addresses (MAC addresses) to the header of each frame.
  • Error control: The data link layer implements error control by detecting and retransmitting broken or lost frames.
  • Flow Control: Because the data rate on both sides must be consistent or the data would be corrupted, flow control coordinates the amount of data that can be transferred before acknowledgment.
  • When many devices share a single communication channel, the MAC sub-layer of the data link layer assists in determining which device has control over the channel at any particular time.

Network Layer: The network layer is responsible for data transmission between hosts on different networks. Following are the responsibilities of the network layer :

  • Routing: From source to destination, the network layer protocols determine which path is best. Routing is the name for this network layer function.
  • The network layer defines an addressing scheme in order to uniquely identify each device on the internetwork. The network layer places the IP addresses of the sender and receiver in the header. An address like this recognises each gadget in a unique and universal way.

Transport Layer: The transport layer delivers services to the application layer while also receiving services from the network layer. Segments are the units of data in the transport layer. Following are the responsibilities of the Transport layer :

  • This layer accepts the message from the (session) layer and splits it down into smaller parts. A header is attached to each of the segments created. The message is reassembled by the transport layer at the destination station.
  • The transport layer header provides a form of address called service point address or port address in order to deliver the message to the relevant process. The transport layer ensures that the message is delivered to the relevant process by supplying this address.

Session Layer: The Session Layer is in charge of establishing connections, maintaining sessions, authenticating users, and ensuring security. Following are the responsibilities of session layer :

  • Establishing, maintaining, and terminating a session: The layer enables the two processes to create, use, and terminate a connection.
  • Synchronization: This layer allows a process to insert checkpoints into the data that serve as synchronisation points. These synchronisation points aid in the detection of errors so that data may be correctly resynchronized, message ends are not severed prematurely, and data loss is avoided.
  • Dialog Controller: The session layer enables two systems to communicate in half-duplex or full-duplex mode.

Presentation Layer: The Presentation Layer is often referred to as the Translation Layer. The data from the application layer is retrieved and processed here so that it may be transmitted across the network in the proper format. Following are the responsibilities of the presentation layer :

  • It is responsible for translations such as ASCII to EBCDIC.
  • Encryption/decryption: Data encryption is the process of converting data into a different form or coding. The ciphertext is the encrypted data, and the plain text is the decoded data. When encrypting and decrypting data, a key-value is used.
  • Compression: This technique reduces the amount of data that must be transmitted over the network.

Application Layer: The Application layer, which is implemented by network applications, is at the very top of the OSI Reference Model stack of levels. Following are the responsibilities of the application layer :

  • This layer also acts as a window for application services to connect to the network and show the information they receive to the user.
  • It is also responsible for file transfer access and management.
  • It is responsible for mail services.
  • It is also responsible for directory services.

15. Differentiate between WHERE clause and HAVING clause in SQL.

The following table lists the differences between the WHERE clause and the HAVING clause:

WHERE HAVING
The WHERE Clause is used to filter records from a table depending on a condition that is given. The HAVING Clause is used to filter records from groups based on a condition that is given.
You can use the WHERE Clause without the GROUP BY Clause. The HAVING Clause is ineffective without the GROUP BY Clause.
The WHERE Clause is used in row operations. The HAVING Clause is used to implement column operations.
The WHERE clause can be used in conjunction with the SELECT, UPDATE, and DELETE statements. Only the SELECT statement can employ the HAVING Clause.
The aggregate function cannot be used in the WHERE Clause. The HAVING Clause is capable of containing aggregate functions.
With single-row functions such as UPPER, LOWER, and so on, the WHERE Clause is used. With multiple-row functions like SUM, COUNT, and others, the HAVING Clause is employed.
The WHERE Clause comes before the GROUP BY Clause. After the GROUP BY Clause, the HAVING Clause is used.

16. Write a query in SQL to find the details of an employee having the nth highest salary from a given table Employee. The value of n needs to be taken as user input. Assume that the table Employee has the following schema.

name - denoting the name of the employee
salary - denoting the salary of the employee 

Approach:

We use the dense_rank() function to display the details of the employee having the nth highest salary. The function DENSE_RANK returns the rank of a row in an ordered collection of rows as a NUMBER. The ranks are in ascending order, starting with 1. Based on the values of the value exprs in the order by clause, DENSE RANK computes the rank of each row returned from a query in relation to the other rows as an analytic function.

Query:

select name, salary from(
select name, salary, dense_rank() 
over(order by salary desc)input from Employee) 
where input = &n;

Explanation:

In the above query, we first sort the data according to the descending order of the salary and assign a rank to each of the employees starting from 1. In case of an event where the salary of two employees is the same, they both are assigned the same rank. Then we display the data whose rank is equal to the given input.

17. What do you understand by subnetting in the context of computer networks?

Subnetting is the process of dividing a larger network into smaller networks in order to preserve security. As a result, smaller networks are easier to maintain. To divide a network into two pieces, select one bit from the host ID part for each Subnet. To divide a network into four subnets, two bits from the host id component must be chosen for each subnet and so on.

In the above image, we can see that we have divided the network 20.0.0.0/24 into two subnets 20.0.1.0/24 and 20.0.3.0/24.

18. What are the advantages and disadvantages of subnetting?

Following are the advantages of subnetting :

  • It protects one network from the intrusion of another. For example, in an organisation, the Developer department's code must not be accessible by any other department.
  • It's possible that some subnets will require higher network priority than others. A sales department, for example, may need to host webcasts or video conferences. Subnetting makes it possible to treat networks with different priorities differently.
  • Maintenance is simple in the case of small networks.

Following are the disadvantages of subnetting :

  • To reach a Process in the case of a single network, only three steps are required: Source Host to Destination Network, Destination Network to Destination Host, and lastly Destination Host to Process. Subnetting, on the other hand, necessitates four phases for Inter-Network Communication. Source Host to Destination Network, Destination Network to appropriate Subnet, Subnet to Host, and lastly Host to Process are the steps. As a result, Time complexity rises. More time is necessary for communication or data transfer in the case of Subnet.
  • Only two IP addresses are spent for Network Id and Broadcast address in a single network, while two IP addresses are wasted for each Subnet in subnetting.
  • The total Network's cost rises as well. Subnetting necessitates the purchase of expensive internal routers, switches, hubs, and bridges.

19. Differentiate between preemptive and non-preemptive scheduling algorithms.

 Following are the differences between preemptive and non-preemptive scheduling algorithms:

Preemptive Scheduling Non-Preemptive Scheduling
The CPU is assigned to the processes in preemptive scheduling for a limited time In non-preemptive scheduling, the CPU is allocated to the processes until they terminate or switch to the waiting state.
In Preemptive scheduling, when a higher priority task arrives, the executing process in preemptive scheduling is halted in the middle of its execution. In non-preemptive scheduling, the executing process is not disturbed in the middle of its execution and waits until it is completed.
The overhead of transitioning a process from the ready state to the running state, and vice versa, as well as maintaining the ready queue, exists in Preemptive Scheduling. Non-preemptive scheduling, on the other hand, has no overhead of transitioning the process from running to ready state.
In the case of preemptive scheduling, if a high-priority process repeatedly appears in the ready queue, the low-priority process will have to wait for a long time, and it may have to starve. If CPU is allotted to a process with a long burst time in non-preemptive scheduling, processes with shorter burst times may be forced to starve.
Preemptive scheduling achieves flexibility by granting important processes access to the CPU as soon as they enter the ready queue, regardless of what task is already running. Non-preemptive scheduling is referred to as stiff because even if a crucial process joins the ready queue, the process's CPU is unaffected.
Preemptive Scheduling is cost associative because it must maintain the integrity of shared data Non-Preemptive scheduling is not cost associative.

20. Differentiate between SQL and NoSQL databases.

Following are the differences between SQL and NoSQL databases:

 

SQL Database NoSQL Database
SQL databases are referred to as Relational Database Management Systems (RDBMS). NoSQL databases are referred to as non-relational or distributed databases.
SQL databases have fixed and static predefined schema. NoSQL databases can have dynamic schema.
SQL databases are vertically scalable in almost all cases. This means that by boosting RAM, CPU, or SSD, you may increase the demand on a single server. NoSQL databases, on the other hand, are horizontally scalable. By sharding, or adding multiple servers to your NoSQL database, you can handle greater traffic. It's the difference between adding more storeys to a single building and adding more buildings to a neighbourhood. NoSQL databases can grow in size and power, making them the best solution for huge or constantly changing data sets.
SQL databases are table-based. As a result, relational SQL databases are a preferable choice for applications that require multi-row transactions, such as accounting systems, or for legacy systems that were designed with a relational structure in mind. Key-value pairs, document-based, graph databases, and wide-column stores are all types of NoSQL databases.
The ACID characteristics (Atomicity, Consistency, Isolation, and Durability) are followed by SQL databases. The Brewers CAP theorem is followed by NoSQL databases (Consistency, Availability and Partition tolerance).

21. Given two unsorted arrays. Check if the second array is a subarray of the first array.

Example:
Input :
arr1 = {2, 3, 0, 5, 1, 1, 2}
arr2 = {3, 0, 5, 1}
Output :
True

Input :
arr1 = {3, 4, 5, 1, 2, 7}
arr2 = {4, 1, 2}
Output :
False

Approach:

We use two pointers to explore both the array and the subarray. We maintain the pointer of array arr2[] and increase the pointer of both arrays if any element of arr1[] matches the first element of arr2[], otherwise set the pointer of arr1 to the next element of the previous starting point and reset the pointer of arr2 to 0. If all of arr2's elements match, print True; otherwise, print False.

The following is how the above strategy is put into action:

Code:

 #include <bits/stdc++.h>
using namespace std;
 
//function to check if the second array is a subarray of the first array
bool checkSubArray(int arr1[], int arr2[], int n, int m)
{
    int i = 0, j = 0;
    while (i < n && j < m) {
 
        // If element matches
        // increment both pointers
        if (arr1[i] == arr2[j]) {
 
            i++;
            j++;
 
            // checking if we have reached the end of the second array
            if (j == m)
                return true;
        }
        else {
            i = i - j + 1;// setting the pointer of the first array to the next element of the previous starting point
            j = 0; // resetting the pointer of the second array to 0.
        }
    }
 
    return false;
}

int main()
{
    int arr1[] = { 2, 3, 0, 5, 1, 1, 2 };
    int arr2[] = { 3, 0, 5, 1 };
    int n = sizeof(arr1) / sizeof(arr1[0]);
    int m = sizeof(arr2) / sizeof(arr2[0]);
    bool res = checkSubArray(arr1, arr2, n, m);
    if (res)
        cout << "True\n";
    else
        cout << "False\n";
 
    return 0;
}

Explanation:

In the above code, the function checkSubArray checks whether the second array is a sub array of the first array or not and returns the output correspondingly. We maintain two pointers, one for the first array and the other for the second array. If the elements match, we increment both the pointers; otherwise, we reset the pointers.

22. Given a string as an input, write a program to reverse the words in the given string and display the new string.

Example:
Input:
str = “InterviewBit is best”
Output :
best is InterviewBit

Approach:

We maintain a vector of strings. We traverse the given string and keep forming the word until a space is encountered. When space is encountered we add the word formed to the vector of strings. In the end, we print the vector of strings in reverse format.

Code :

 #include <bits/stdc++.h>
using namespace std;

// function to reverse the words in an inputted string
void displayModifiedString(string str)
{
     
    // vector to store all the words of the inputted string
    vector<string> arr;
    string temp = ""; // variable to form each word of the string
    for (int i = 0; i < str.length(); i++)
    {
         
        // if space is encountered, we push the formed word to the vector
        if (str[i] == ' ')
        {
            arr.push_back(temp);
            temp = "";// resetting the temp variable
        }
 
        // we keep forming the word
        else
            temp += str[i];
    }
   
    arr.push_back(temp);// we push back the last formed word
 
    // we print the vector in the reverse order
    for (int i = arr.size() - 1; i > 0; i--)
        cout << arr[i] << " ";
    cout << arr[0] << endl;
}
 

int main()
{
    string str = "InterviewBit is best";
    displayModifiedString(str);
    return 0;
}

Output :

 best is InterviewBit

Explanation :

In the above code, the function displayModifiedString takes a string input and displays the modified string with words in reverse order. We keep forming a word until a space character is found. Once space is found, we push back the word to the vector. Lastly, we display the vector in reverse order.

MindTree Interview Preparation

Interview Preparation Tips

  • Make it a practice to solve Data Structure and Algorithm problems on a regular basis. You can visit the programming section of our site through this link. We have curated the list of frequently asked DSA questions for each company topic wise. Solving them will give you an edge in interviews. Also, go through the interview experiences of the company. This will give you an idea of how an actual interview takes place. It's a good idea to prepare answers to common HR and management interview questions ahead of time. You can also find out about the company's accomplishments, organisational structure, vision, work-life balance, and other subjects
  • Take note of the hints. If you get stuck, interviewers are always willing to help and will give you specific advice. It's critical to grab the hint as soon as possible and go on to the next step. It's a significant red flag if you can't figure out what the hint is.
  • Never say you can't accomplish something. Even if you haven't solved a problem previously or it appears that you won't be able to solve it, keep hitting it from different sides; the interviewer will offer you pointers. However, stating that you are unable to tackle the problem is a major red flag, and you may be denied.
  • While doing the interview, the interviewer is primarily concerned with determining whether or not he or she can work with the candidate on a daily basis. So make sure you don't say anything during the interview that would raise a red flag.
  • Learn how to "think aloud." It's strange, but in an interview environment, demonstrating how you arrived at a solution or explaining why you're doing X before Y is the most crucial aspect.
  • Your interviewer is looking for three essential features in your code. It should be quick to load, take up no more memory than necessary, and be stable and simple to maintain. If you can do that, you'll already be ahead of the majority of individuals.
  • Give mock interviews a shot. This will give you an idea of what to expect during the actual interview. For mock interviews, you can use our InterviewBit platform. You'll be partnered with a peer, and the two of you will be able to conduct interviews with each other, making it a win-win situation for both of you. 

Frequently Asked Questions

1. Why do you want to join MindTree?

For such types of questions highlight the core principles of the company and the work culture which motivates you to join the company. Talk about your desire to grow and learn while working in this company as your prime reason. Also, state the reviews of the company which you have heard from your seniors currently working for this company.

2. Is it easy to get placed in MindTree?

With the right preparation and determination, it is easy to get placed in MindTree. The interviews in MindTree focus on the basic computer fundamentals. So make sure that you have your fundamentals clear. Also, practice a lot of Data Structures and Algorithms. That being done, the interview should be a piece of cake for you.

3. Is there any bond in MindTree?

There is no bond, however you are required to sign a service agreement on your first day. There is a service agreement in place for campus hires as well. The service agreement is usually for a period of 24 months and a sum of 2 lakh. You can leave the company without an experience certificate or proof, but you must pay the sum owed if you leave before the end of the service agreement period.

4. What is the salary for freshers in MindTree?

MindTree presently pays trainees an average salary of Rs. 3.2 lakh per year (roughly Rs 26,700 per month).