Think Future Technologies
20+ HEM Motors Interview Questions and Answers
Q1. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Use Divide and Conquer approach to recursively divide the input array into two halves.
Merge the sorted halves to produce a completely sorted array.
Ensure the implementation handles the constraints specified in the problem statement.
Example: For input [3, 1, 4, 1, 5], the output should be [1, 1, 3, 4, 5].
Q2. Candies Distribution Problem Statement
Prateek is a kindergarten teacher with a mission to distribute candies to students based on their performance. Each student must get at least one candy, and if two student...read more
The task is to distribute candies to students based on their performance while minimizing the total candies distributed.
Create an array to store the minimum candies required for each student.
Iterate through the students' ratings array to determine the minimum candies needed based on the adjacent ratings.
Consider both left-to-right and right-to-left passes to ensure fair distribution.
Keep track of the total candies distributed and return the final count.
Q3. Count Subarrays with Given XOR Problem Statement
You are given an array of integers ARR
and an integer X
. Your task is to determine the number of subarrays of ARR
whose bitwise XOR is equal to X
.
Example:
Input...read more
Count the number of subarrays in an array whose XOR is equal to a given value.
Iterate through the array and keep track of XOR values and their frequencies using a hashmap.
For each element in the array, calculate the XOR value with all previous elements and check if it equals the given XOR value.
Use the concept of XOR to efficiently solve the problem.
Handle edge cases like XOR value being 0 separately.
Time complexity can be optimized to O(N) using a hashmap to store XOR values...read more
Q4. Distinct Characters Problem Statement
Given a string STR
, return all possible non-empty subsequences with distinct characters. The order of the strings returned is not important.
Example:
Input:
STR = "cbc"
Out...read more
Return all possible non-empty subsequences with distinct characters from a given string.
Iterate through all possible subsequences of the input string
Check for distinct characters in each subsequence
Return the distinct character subsequences as an array of strings
Q5. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Given an array and a target sum, find pairs of elements that add up to the target sum.
Iterate through the array and for each element, check if the complement (target sum - current element) exists in a hash set.
If the complement exists, add the pair to the result list. Otherwise, add the current element to the hash set.
Sort the pairs based on the first element and then the second element to meet the required output format.
Q6. Split Array with Equal Sums Problem Statement
Given an array 'ARR' of size 'N', determine if there exists a triplet (i, j, k) satisfying the conditions: 0 < i , i + 1 < j , j + 1 < k and k < N - 1, such that th...read more
The problem involves determining if there exists a triplet in an array such that the sums of specific subarrays are equal.
Iterate through all possible triplets (i, j, k) within the array.
Calculate the sums of the subarrays [0, i - 1], [i + 1, j - 1], [j + 1, k - 1], [k + 1, N - 1] for each triplet.
Check if any triplet satisfies the condition of having equal sums for the subarrays.
Return 'True' if such a triplet exists, otherwise return 'False'.
Pointers in C/C++ are variables that store memory addresses. They are used to manipulate memory directly and improve performance.
Pointers are declared using an asterisk (*) before the variable name.
Pointers can be used to dynamically allocate memory using functions like malloc() and free().
Pointers can be used to pass variables by reference to functions.
Q8. Lazy and Eagar loading N+1 problem
Lazy loading delays loading of related data until it is specifically requested, while eager loading loads all related data upfront. N+1 problem occurs when lazy loading results in multiple additional queries being made.
Lazy loading is used to improve performance by only loading related data when needed
Eager loading loads all related data upfront to reduce the number of queries made
N+1 problem occurs in lazy loading when each entity requires an additional query to fetch relate...read more
Q9. Roles and Responsibilities of ETLand Data Tester
ETL and Data Testers are responsible for testing the Extract, Transform, Load process and ensuring data quality and integrity.
Develop and execute test cases for ETL processes to ensure data accuracy and completeness
Identify and troubleshoot data quality issues and work with developers to resolve them
Validate data transformations and mappings to ensure they meet business requirements
Perform regression testing to ensure changes do not impact existing ETL processes
Document test ...read more
Q10. Add 1 in last array element and make it 10 and add carry to second index element
Increment last element of array by 1 and carry over to second last element
Iterate through the array in reverse order
Increment the last element by 1 and check if it becomes 10
If last element becomes 10, set it to 0 and carry over 1 to the second last element
Q11. Foreign key in relational database
Foreign key is a field in a relational database table that links to a primary key in another table.
Ensures referential integrity between tables
Used to establish relationships between tables
Prevents orphan records
Can be used to enforce constraints
Q12. Mid point of a linked list
To find the mid point of a linked list, use two pointers - one moving at double the speed of the other.
Initialize two pointers, slow and fast, at the head of the linked list.
Move the slow pointer by one node and the fast pointer by two nodes until the fast pointer reaches the end of the list.
The node at which the slow pointer is currently pointing is the mid point of the linked list.
Q13. Max sum subarray problem
Max sum subarray problem involves finding the subarray with the largest sum within an array.
Iterate through the array and keep track of the current sum and maximum sum seen so far.
If the current sum becomes negative, reset it to 0 as it won't contribute to the maximum sum.
Return the maximum sum found.
Example: For array [-2, 1, -3, 4, -1, 2, 1, -5, 4], the max sum subarray is [4, -1, 2, 1] with sum 6.
Q14. what is ai ? tell me the usecases
AI stands for Artificial Intelligence, which is the simulation of human intelligence processes by machines.
AI is used in healthcare for diagnosing diseases and recommending treatment plans.
AI is used in autonomous vehicles for navigation and decision-making.
AI is used in customer service for chatbots and virtual assistants.
AI is used in finance for fraud detection and algorithmic trading.
Q15. ACID Properties
ACID properties are a set of properties that guarantee database transactions are processed reliably.
Atomicity: Ensures that all operations in a transaction are completed successfully or none at all.
Consistency: Ensures that the database remains in a consistent state before and after the transaction.
Isolation: Ensures that the execution of multiple transactions concurrently does not interfere with each other.
Durability: Ensures that once a transaction is committed, the changes...read more
Q16. Merge Sort Algorithm
Merge Sort is a divide and conquer algorithm that divides the input array into two halves, sorts them separately, and then merges them.
Divide the array into two halves recursively
Sort each half separately
Merge the sorted halves back together
Q17. negative scenarios of pen,
Negative scenarios of pen include ink leakage, broken tip, running out of ink, smudging, and losing cap.
Ink leakage can ruin documents or clothing
Broken tip can make writing difficult
Running out of ink can be frustrating in the middle of an important task
Smudging can make writing illegible
Losing cap can cause ink to dry out
Q18. test plan vs test statergy
Test plan outlines the scope, approach, resources, and schedule of testing, while test strategy defines the overall testing approach.
Test plan details the specific test cases, test objectives, and test environment.
Test strategy defines the testing methods, tools, and techniques to be used.
Test plan is more detailed and focuses on individual test cases, while test strategy is high-level and focuses on overall testing approach.
Test plan is created by test engineers, while test ...read more
Q19. CRUD commands in API
CRUD commands in API refer to Create, Read, Update, and Delete operations for interacting with data.
Create - POST request to add new data
Read - GET request to retrieve data
Update - PUT or PATCH request to modify existing data
Delete - DELETE request to remove data
Q20. Second largest no of array
The second largest number in an array of strings
Convert the array of strings to an array of integers
Sort the array in descending order
Return the second element in the sorted array
Interview Process at HEM Motors
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month