Add office photos
Employer?
Claim Account for FREE

MAQ Software

1.9
based on 353 Reviews
Filter interviews by

30+ Mehta Stone Export House Interview Questions and Answers

Updated 21 Feb 2025
Popular Designations

Q1. Nth Fibonacci Number Problem Statement

Calculate the Nth term in the Fibonacci sequence, where the sequence is defined as follows: F(n) = F(n-1) + F(n-2), with initial conditions F(1) = F(2) = 1.

Input:

The inp...read more
Ans.

Calculate the Nth Fibonacci number efficiently using dynamic programming.

  • Use dynamic programming to store previously calculated Fibonacci numbers to avoid redundant calculations.

  • Start with base cases F(1) and F(2) as 1, then iterate to calculate F(N) efficiently.

  • Time complexity can be optimized to O(N) using dynamic programming.

  • Example: For N = 5, the 5th Fibonacci number is 5.

Add your answer

Q2. Print Series Problem Statement

Given two positive integers N and K, your task is to generate a series of numbers by subtracting K from N until the result is 0 or negative, then adding K back until it reaches N ...read more

Ans.

Generate a series of numbers by subtracting K from N until 0 or negative, then adding K back to reach N without using loops.

  • Create a recursive function to generate the series.

  • Subtract K from N until N is 0 or negative, then add K back until N is reached.

  • Return the series as an array of integers.

Add your answer

Q3. Unique Element In Sorted Array

Nobita wants to impress Shizuka by correctly guessing her lucky number. Shizuka provides a sorted list where every number appears twice, except for her lucky number, which appears...read more

Ans.

Find the unique element in a sorted array where all other elements appear twice.

  • Iterate through the array and XOR all elements to find the unique element.

  • Use a hash set to keep track of elements and find the unique one.

  • Sort the array and check adjacent elements to find the unique one.

Add your answer

Q4. Remove Invalid Parentheses

Given a string containing only parentheses and letters, your goal is to remove the minimum number of invalid parentheses to make the input string valid and return all possible valid s...read more

Ans.

Given a string with parentheses and letters, remove minimum invalid parentheses to make it valid and return all possible valid strings.

  • Use BFS to explore all possible valid strings by removing parentheses one by one

  • Keep track of visited strings to avoid duplicates

  • Return all unique valid strings obtained after removing minimum number of parentheses

Add your answer
Discover Mehta Stone Export House interview dos and don'ts from real experiences

Q5. Problem: Permutations of a String

Given a string STR consisting of lowercase English letters, your task is to return all permutations of the given string in lexicographically increasing order.

Explanation:

A st...read more

Ans.

Return all permutations of a given string in lexicographically increasing order.

  • Use backtracking to generate all permutations of the string.

  • Sort the permutations in lexicographical order before printing.

  • Ensure the string contains unique characters for correct output.

  • Handle multiple test cases by iterating over each case.

Add your answer

Q6. Rotate Array Problem Statement

The task is to rotate a given array with N elements to the left by K steps, where K is a non-negative integer.

Input:

The first line contains an integer N representing the size of...read more
Ans.

Rotate a given array to the left by K steps.

  • Create a new array to store the rotated elements.

  • Use modular arithmetic to handle cases where K is greater than the array size.

  • Shift elements to the left by K steps and update the new array.

  • Return the rotated array as output.

Add your answer
Are these interview questions helpful?

Q7. Remove String from Linked List Problem

You are provided with a singly linked list where each node contains a single character, along with a string 'STR'. Your task is to remove all occurrences of the string 'ST...read more

Ans.

Remove all occurrences of a specified string from a singly linked list by checking from the end of the list.

  • Traverse the linked list from the end to efficiently remove the specified string occurrences.

  • Update the pointers accordingly after removing the string to maintain the integrity of the linked list.

  • Consider edge cases such as when the entire linked list contains the specified string.

  • Use a temporary buffer to keep track of the nodes that need to be removed.

Add your answer

Q8. MergeSort Linked List Problem Statement

You are given a Singly Linked List of integers. Your task is to sort the list using the 'Merge Sort' algorithm.

Input:

The input consists of a single line containing the ...read more
Ans.

Sort a Singly Linked List using Merge Sort algorithm.

  • Implement the Merge Sort algorithm for linked lists.

  • Divide the list into two halves, sort each half recursively, and then merge them.

  • Make sure to handle the base case of an empty or single-node list.

  • Example: Input: 4 3 2 1 -1, Output: 1 2 3 4

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Sort String with Alternate Lower and Upper Case

Given a string STR containing both lowercase and uppercase letters, the task is to sort the string so that the resulting string contains uppercase and lowercase l...read more

Ans.

Sort a string with alternate lowercase and uppercase letters in sorted order.

  • Create two separate arrays for lowercase and uppercase letters.

  • Sort both arrays individually.

  • Merge the two arrays alternately to form the final sorted string.

Add your answer

Q10. Which data structure inserts and deletes in O(1) time and is it possible to create a data structure with insertion, deletion and search retrieval in O(1) time

Ans.

Hash table. No, it is not possible to create a data structure with all operations in O(1) time.

  • Hash table uses a hash function to map keys to indices in an array.

  • Insertion and deletion can be done in O(1) time on average.

  • Search retrieval can also be done in O(1) time on average.

  • However, worst-case scenarios can result in O(n) time complexity.

  • It is not possible to create a data structure with all operations in O(1) time.

Add your answer

Q11. Factorial Calculation Problem

Given an integer N, determine the factorial value of N. The factorial of a number N is the product of all positive integers from 1 to N.

Input:

First line of input: An integer 'T',...read more
Ans.

Calculate factorial of a given number N.

  • Iterate from 1 to N and multiply each number to get the factorial value.

  • Handle edge cases like N=0 or N=1 separately.

  • Use recursion or iteration to calculate factorial efficiently.

Add your answer

Q12. Find the Second Largest Element

Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.

If a second largest element does not exist, return -1.

Example:

Input:
ARR = [2, 4, 5, 6, ...read more
Ans.

Find the second largest element in an array of integers.

  • Iterate through the array to find the largest and second largest elements.

  • Handle cases where all elements are identical.

  • Return -1 if a second largest element does not exist.

Add your answer

Q13. Find the Kth Row of Pascal's Triangle Problem Statement

Given a non-negative integer 'K', determine the Kth row of Pascal’s Triangle.

Example:

Input:
K = 2
Output:
1 1
Input:
K = 4
Output:
1 4 6 4 1

Constraints...read more

Ans.

To find the Kth row of Pascal's Triangle given a non-negative integer K.

  • Create an array to store the values of the Kth row of Pascal's Triangle

  • Use the formula C(n, k) = C(n-1, k-1) + C(n-1, k) to calculate the values

  • Return the array as the output

Add your answer

Q14. Flip Bits Problem Explanation

Given an array of integers ARR of size N, consisting of 0s and 1s, you need to select a sub-array and flip its bits. Your task is to return the maximum count of 1s that can be obta...read more

Ans.

Given an array of 0s and 1s, find the maximum count of 1s by flipping a sub-array at most once.

  • Iterate through the array and keep track of the maximum count of 1s obtained by flipping a sub-array.

  • Consider flipping a sub-array from index i to j and calculate the count of 1s in the resulting array.

  • Return the maximum count of 1s obtained by flipping a sub-array at most once.

Add your answer

Q15. Number of Islands Problem Statement

You are provided with a 2-dimensional matrix having N rows and M columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more

Ans.

Count the number of islands in a 2D matrix of 1s and 0s.

  • Iterate through the matrix and perform depth-first search (DFS) to find connected 1s.

  • Mark visited cells to avoid redundant traversal.

  • Increment island count whenever a new island is encountered.

Add your answer

Q16. Find the third largest element from array, give the optimized approach using just half traversal of array.

Ans.

Optimized approach to find third largest element from array using half traversal.

  • Sort the array in descending order and return the element at index 2.

  • Use a max heap to keep track of the top 3 elements while traversing the array.

  • Use two variables to keep track of the second and third largest elements while traversing the array.

  • Divide the array into two halves and find the maximum and second maximum in each half, then compare them to find the third largest element.

Add your answer

Q17. What are indexes , example, Is it possible to have more than one clustered index and more than one non clustered index ?

Ans.

Indexes are used to improve query performance. Multiple clustered and non-clustered indexes can be created on a table.

  • Indexes are used to quickly locate data without scanning the entire table.

  • Clustered index determines the physical order of data in a table.

  • Non-clustered index is a separate structure that contains a copy of the indexed columns and a pointer to the actual data.

  • A table can have only one clustered index, but multiple non-clustered indexes.

  • Indexes should be create...read more

Add your answer

Q18. What are acid properties , how two transactions occur simultaneously while maintaining Acid properties

Ans.

ACID properties ensure database transactions are reliable. Two transactions can occur simultaneously using locking and isolation.

  • ACID stands for Atomicity, Consistency, Isolation, and Durability.

  • Atomicity ensures that a transaction is treated as a single unit of work, either all or none of it is executed.

  • Consistency ensures that a transaction brings the database from one valid state to another.

  • Isolation ensures that concurrent transactions do not interfere with each other.

  • Dur...read more

Add your answer

Q19. Print first character of words in a string 1) using one stack and 2)using an array.

Ans.

Answering how to print first character of words in a string using one stack and an array.

  • For using one stack, push each character onto the stack and pop when a space is encountered. Print the popped character.

  • For using an array, split the string into words and print the first character of each word.

  • In both cases, handle edge cases like empty string and string with only one word.

View 1 answer

Q20. Given a array and a number , find whether number can be generated using sum of array members if yes output those numbers

Ans.

Given an array and a number, find if the number can be generated using sum of array members and output those numbers.

  • Iterate through the array and check if the number can be generated using the sum of array members

  • Use a hash table to store the difference between the number and each array element

  • If the difference is found in the hash table, output the corresponding array elements

  • If no such combination is found, output 'Not possible'

Add your answer
Q21. Write a query to find the Nth highest salary along with the employee name.
Ans.

Query to find the Nth highest salary with employee name

  • Use a subquery to rank the salaries in descending order

  • Select the distinct salary from the subquery with LIMIT N-1, 1 to get the Nth highest salary

  • Join the main table with the subquery on the salary column to get the employee name

Add your answer

Q22. Time complexity of various data structure operations

Ans.

Time complexity of data structure operations

  • Arrays: O(1) for access, O(n) for search/insert/delete

  • Linked Lists: O(n) for access/search, O(1) for insert/delete

  • Stacks/Queues: O(1) for access/insert/delete

  • Hash Tables: O(1) for access/insert/delete (average case)

  • Trees: O(log n) for access/search/insert/delete (balanced)

  • Heaps: O(log n) for access/insert/delete

  • Graphs: Varies depending on algorithm used

Add your answer

Q23. Difference between span and div tag

Ans.

Span is an inline element used for styling small portions of text, while div is a block-level element used for grouping and styling larger sections of content.

  • Span is an inline element, div is a block-level element

  • Span is used for styling small portions of text, div is used for grouping larger sections of content

  • Span does not create a new line, div creates a new block-level element

View 1 answer

Q24. -----+all+permutation+of+a+string+geeksforgeeks -----/

Ans.

Generate all permutations of a given string using recursion and backtracking.

  • Use recursion to generate all possible permutations of the string.

  • Use backtracking to backtrack and explore all possible combinations.

  • Store each permutation in an array of strings.

Add your answer

Q25. k nodes reversal of linked list

Ans.

Reversing k nodes in a linked list

  • Iterate through the linked list in groups of k nodes

  • Reverse each group of k nodes

  • Update the pointers accordingly to maintain the reversed order

Add your answer

Q26. what is joins in sql

Ans.

Joins in SQL are used to combine rows from two or more tables based on a related column between them.

  • Joins are used to retrieve data from multiple tables based on a related column

  • Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN

  • Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column

Add your answer

Q27. Normalization and all its forms

Ans.

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization is used to eliminate data redundancy by breaking up tables into smaller, related tables.

  • There are different normal forms such as 1NF, 2NF, 3NF, BCNF, and 4NF, each with specific rules to follow.

  • Normalization helps in reducing data anomalies and ensures data integrity.

  • Example: Breaking up a customer table into separate tables for customer details and orde...read more

Add your answer

Q28. Circular linked list algorithm

Ans.

Circular linked list is a data structure where the last node points back to the first node.

  • In a circular linked list, each node has a pointer to the next node and the last node points back to the first node.

  • Traversal in a circular linked list can start from any node and continue until the starting node is reached again.

  • Insertion and deletion operations in a circular linked list are similar to those in a regular linked list, but special care must be taken to update the pointer...read more

Add your answer

Q29. Index in sql theoretical

Ans.

Indexes in SQL are used to improve the performance of queries by allowing the database to quickly retrieve data.

  • Indexes are created on columns in a table to speed up data retrieval.

  • They work similar to an index in a book, allowing the database to quickly find the relevant data.

  • Primary keys automatically have an index created on them.

  • Indexes can be unique, meaning that each value in the indexed column must be unique.

  • Examples: CREATE INDEX idx_name ON table_name(column_name);

Add your answer

Q30. reverse the array

Ans.

Reverse the array of strings

  • Create a new array and iterate through the original array in reverse order, adding each element to the new array

  • Use built-in array methods like reverse() or spread operator for a more concise solution

  • Ensure to handle edge cases like empty array or array with only one element

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Mehta Stone Export House

based on 24 interviews
3 Interview rounds
Coding Test Round
Technical Round - 1
Technical Round - 2
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

3.8
 • 121 Interview Questions
3.3
 • 79 Interview Questions
4.0
 • 14 Interview Questions
3.1
 • 12 Interview Questions
3.5
 • 11 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter