Tech Mahindra Interview Experience (On-Campus)

Last Updated : 26 Jul, 2023

Tech Mahindra conducted a five-round recruitment process in our college that lasted for seven days

Round 1: Aptitude Test, English, Essay/Story Easy to Medium Level was asked

Round 2: Techincal Round, in which there are a few sections like Programing, DBMS, OOPS, Operating Systems, Basic Coding Question were given.

Here are a few Coding Question

Problem 1: Network Protocol
A network protocol specifies how data is exchanged via transmission media. The protocol converts each message into a stream of 1s and Os. Given a decimal number, write an algorithm to convert the number into a binary form.

Write a Python algorithm/function to convert a given decimal number into its binary representation.

C++

 `#include ` `#include ` ` `  `std::string decimalToBinary(``int` `num) { ` `    ``if` `(num == 0) { ` `        ``return` `"0"``; ` `    ``} ` ` `  `    ``std::string binaryStr = ``""``; ` `    ``while` `(num > 0) { ` `        ``int` `remainder = num % 2; ` `        ``binaryStr = std::to_string(remainder) + binaryStr; ` `        ``num /= 2; ` `    ``} ` ` `  `    ``return` `binaryStr; ` `} ` ` `  `int` `main() { ` `    ``int` `inputNumbers[] = {17, 18, 19, 28, 21, 22, 23, 24}; ` `    ``int` `numInputNumbers = ``sizeof``(inputNumbers) / ``sizeof``(inputNumbers[0]); ` ` `  `    ``for` `(``int` `i = 0; i < numInputNumbers; i++) { ` `        ``int` `num = inputNumbers[i]; ` `        ``std::string binaryRepresentation = decimalToBinary(num); ` `        ``std::cout << num << ``" in binary: "` `<< binaryRepresentation << std::endl; ` `    ``} ` ` `  `    ``return` `0; ` `} `

Problem 2:
Question: A company called Digicomparts manufactures 52 types of unique products for laptop and desktop computers. They produce 10 types of laptop products and 42 types of desktop products. Each product manufactured by the company has a unique productID from a-z and A-Z. The laptop products have productIDs (a, i, e, o, u, A, I, E, O, U) while the rest of the productIDs are assigned to the desktop products.

The company manager wishes to find the sales data for the desktop products.

Task: Given a list of productIDs of the sales of the last N products, write an algorithm to help the manager find the productIDs of the desktop products.

Code:

C++

 `#include ` `#include ` `#include ` ` `  `std::vector<``char``> filter_desktop_products(``const` `std::vector<``char``>& sales_data) { ` `    ``std::unordered_set<``char``> laptop_product_ids = {``'a'``, ``'i'``, ``'e'``, ``'o'``, ``'u'``, ``'A'``, ``'I'``, ``'E'``, ``'O'``, ``'U'``}; ` `    ``std::vector<``char``> desktop_product_ids; ` ` `  `    ``for` `(``char` `product_id : sales_data) { ` `        ``if` `(laptop_product_ids.find(product_id) == laptop_product_ids.end()) { ` `            ``desktop_product_ids.push_back(product_id); ` `        ``} ` `    ``} ` ` `  `    ``return` `desktop_product_ids; ` `} ` ` `  `int` `main() { ` `    ``std::vector<``char``> sales_data = {``'a'``, ``'B'``, ``'c'``, ``'D'``, ``'e'``, ``'F'``, ``'g'``, ``'H'``, ``'I'``, ``'j'``, ``'K'``, ``'L'``, ``'M'``, ``'n'``}; ` `    ``std::vector<``char``> desktop_products = filter_desktop_products(sales_data); ` ` `  `    ``// Display the desktop productIDs ` `    ``for` `(``char` `product_id : desktop_products) { ` `        ``std::cout << product_id << ``" "``; ` `    ``} ` ` `  `    ``return` `0; ` `} `

Problem 3:

Program to Find and Print Nth Fibonacci Numbers
https://www.geeksforgeeks.org/program-for-nth-fibonacci-number/

Problem 4:

In a science research laboratory, combining certain chemicals produces maximum energy that is the product of the energy of the two chemicals. The energy values of the chemicals can be negative or positive. The scientist wishes to calculate the sum of the energies of the two chemicals that produce the maximum energy in the reaction.

Write an algorithm to find the sum of the energy of the two chemicals that produce the maximum energy in the reaction.

C++

 `#include ` `using` `namespace` `std; ` `int32_t main() { ` `    ``// ios_base::sync_with_stdio(0); ` `    ``// cin.tie(0); ` `    ``// solve(); ` `    ``int` `n; ` `    ``cin>>n; ` `    ``vector<``int``>v(n); ` `    ``for``(``int` `i=0;i>v[i]; ` `    ``} ` `    ``int` `idx1=-1; ` `    ``int` `idx2=-1; ` `    ``int` `maxi1=INT_MIN; ` `    ``int` `maxi2=INT_MIN; ` `    ``for``(``int` `i=0;i

Problem 5: Trailing zeros in Factorial
Only 2 Coding Questions were given these were some of my friends

Round 3: Conversational Test:

You are given a few questions like fill in the black with correct articles, errors in the sentence and speak about the topic given like “Describe your best friend”, “Describe a situation in a bus full of people..” These Questions will be displayed on the screen and our recording will be taken

Round 4: Techincal Round

1. Introduction
• Please provide a brief introduction about yourself or the candidate being interviewed.
2. Difference between List and Array
• What are the main differences between a list and an array in programming? Discuss their usage and advantages.
3. Stack and Queue
• Explain what a stack and a queue are in data structures. Compare their functionalities and use cases.
4. Recursion can be achieved using Stack or Queue
• Discuss how recursion can be implemented using a stack or a queue. Provide examples to illustrate the concept.
5. What is RDBMS
• Define RDBMS (Relational Database Management System) and explain its key characteristics. Discuss its importance in modern software development.
6. Call by Value and Reference
• Explain the differences between call by value and call by reference in function parameter passing. Illustrate with examples.
7. Can we include a header file?
• Discuss the purpose of header files in programming and whether we can include a header file within another header file. Explain the potential implications and best practices.
8. What are Macros
• Define macros in programming and discuss their role in code preprocessing. Provide examples of how macros are used in different situations.
9. Questions are asked based on your Resume So Add Skills that you are aware of only and don’t fall in unnecessary troubles by putting the wrong skills

Round 5: HR Round :

The HR Round Questions were basic and as usual, like Self Introduction, Stories like You have a teammate who is inactive How will you handle the situation etc.

Previous
Next