
MAQ Software

80+ MAQ Software Interview Questions and Answers
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
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.
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
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.
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
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.
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
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
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
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.
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
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.
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
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.
Q8. 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
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.
Q9. 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
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
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
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.
Q11. 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
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
Q12. 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
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.
Q13. 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
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.
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
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.
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
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.
Q16. Nth Element Of Modified Fibonacci Series
Given two integers X
and Y
as the first two numbers of a series, and an integer N
, determine the Nth element of the series following the Fibonacci rule: f(x) = f(x - 1) ...read more
Calculate the Nth element of a modified Fibonacci series given the first two numbers and N, with the result modulo 10^9 + 7.
Implement a function to calculate the Nth element of the series using the Fibonacci rule f(x) = f(x - 1) + f(x - 2)
Return the answer modulo 10^9 + 7 due to the possibility of a very large result
The series is 1-based indexed, so the first two numbers are at positions 1 and 2 respectively
Q17. Find the third largest element from array, give the optimized approach using just half traversal of array.
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.
Q18. What are indexes , example, Is it possible to have more than one clustered index and more than one non clustered index ?
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
Q19. What are acid properties , how two transactions occur simultaneously while maintaining Acid properties
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
Q20. Find the Duplicate Number Problem Statement
Given an integer array 'ARR' of size 'N' containing numbers from 0 to (N - 2). Each number appears at least once, and there is one number that appears twice. Your tas...read more
Find the duplicate number in an array of integers from 0 to N-2.
Iterate through the array and keep track of the frequency of each number using a hashmap.
Return the number with a frequency greater than 1 as the duplicate number.
Q21. Character Frequency Problem Statement
You are given a string 'S' of length 'N'. Your task is to find the frequency of each character from 'a' to 'z' in the string.
Example:
Input:
S : abcdg
Output:
1 1 1 1 0 0 ...read more
The task is to find the frequency of each character from 'a' to 'z' in a given string.
Create an array of size 26 to store the frequency of each character from 'a' to 'z'.
Iterate through the string and increment the count of the corresponding character in the array.
Print the array of frequencies as the output for each test case.
Q22. Print first character of words in a string 1) using one stack and 2)using an array.
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.
Q23. N Queens Problem
Given an integer N
, find all possible placements of N
queens on an N x N
chessboard such that no two queens threaten each other.
Explanation:
A queen can attack another queen if they are in the...read more
The N Queens Problem involves finding all possible placements of N queens on an N x N chessboard without threatening each other.
Use backtracking algorithm to explore all possible configurations.
Keep track of rows, columns, and diagonals to ensure queens do not threaten each other.
Generate all valid configurations and print them out.
Q24. Reverse Words in a String: Problem Statement
You are given a string of length N
. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more
Reverse words in a string while handling leading, trailing, and multiple spaces.
Split the input string by spaces to get individual words
Reverse the order of the words
Join the reversed words with a single space in between
Q25. Reverse Array Elements
Given an array containing 'N' elements, the task is to reverse the order of all array elements and display the reversed array.
Explanation:
The elements of the given array need to be rear...read more
Reverse the order of elements in an array and display the reversed array.
Iterate through the array from both ends and swap the elements until the middle is reached.
Use a temporary variable to store the element being swapped.
Print the reversed array after all elements have been swapped.
Q26. Buy and Sell Stock Problem Statement
Imagine you are Harshad Mehta's friend, and you have been given the stock prices of a particular company for the next 'N' days. You can perform up to two buy-and-sell transa...read more
The task is to determine the maximum profit that can be achieved by performing up to two buy-and-sell transactions on a given set of stock prices.
Iterate through the array of stock prices and calculate the maximum profit that can be achieved by buying and selling at different points.
Keep track of the maximum profit after the first transaction and the maximum profit overall by considering different combinations of buy and sell points.
Return the maximum profit obtained after co...read more
Q27. Circular Linked List Detection
You are provided with the head of a linked list containing integers. Your task is to determine if the linked list is circular.
Note:
- A linked list is considered circular if it co...read more
Detect if a given linked list is circular by checking if it forms a closed loop.
Traverse the linked list using two pointers, one moving at double the speed of the other.
If the two pointers meet at any point, the linked list is circular.
If the faster pointer reaches the end of the list (NULL), the linked list is not circular.
Q28. Sum of Digits Problem Statement
Given an integer 'N', continue summing its digits until the result is a single-digit number. Your task is to determine the final value of 'N' after applying this operation iterat...read more
Given an integer, find the final single-digit value after summing its digits iteratively.
Iteratively sum the digits of the given integer until the result is a single-digit number
Output the final single-digit integer for each test case
Handle multiple test cases efficiently
Q29. Given a array and a number , find whether number can be generated using sum of array members if yes output those numbers
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'
Q30. Pancake Sorting Problem Statement
You are given an array of integers 'ARR'. Sort this array using a series of pancake flips. In each pancake flip, you need to:
Choose an integer 'K' where 1 <= 'K' <= ARR.LENGTH...read more
Sort an array using pancake flips and return the sequence of flips made.
Iterate through the array and find the position of the maximum element in each iteration.
Perform pancake flips to move the maximum element to the correct position.
Continue this process until the array is sorted.
Return the sequence of positions from where flips were made.
Q31. Fibonacci Number Verification
Identify if the provided integer 'N' is a Fibonacci number.
A number is termed as a Fibonacci number if it appears in the Fibonacci sequence, where each number is the sum of the tw...read more
Check if a given number is a Fibonacci number or not.
Iterate through the Fibonacci sequence until you find a number greater than or equal to the given number.
Check if the given number matches the Fibonacci number found in the sequence.
If the number matches, output 'YES'; otherwise, output 'NO'.
Q32. Reverse Only Letters Problem Statement
You are given a string S
. The task is to reverse the letters of the string while keeping non-alphabet characters in their original position.
Example:
Input:
S = "a-bcd"
Ou...read more
Reverse the letters of a string while keeping non-alphabet characters in their original position.
Iterate through the string and store the non-alphabet characters in their original positions
Reverse the letters using two pointers technique
Combine the reversed letters with the non-alphabet characters to get the final reversed string
Q33. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of the count of each element using a hashmap.
Return elements with count greater than 1 as duplicates.
Time complexity can be optimized to O(N) using a set to store duplicates.
Example: For input [0, 3, 1, 2, 3], output should be [3].
Q34. Sort 0 1 2 Problem Statement
Given an integer array arr
of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.
Input:
The first line contains an integer 'T' representing the number of...read more
Sort an array of 0s, 1s, and 2s in linear time complexity.
Use three pointers to keep track of 0s, 1s, and 2s while traversing the array.
Swap elements based on the values encountered to sort the array in-place.
Time complexity of the algorithm should be O(N) where N is the size of the array.
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
Q36. Pair Sum Problem Statement
You are provided with an array ARR
consisting of N
distinct integers in ascending order and an integer TARGET
. Your objective is to count all the distinct pairs in ARR
whose sum equal...read more
Count distinct pairs in an array whose sum equals a given target.
Use two pointers approach to iterate through the array and find pairs with sum equal to target.
Keep track of visited pairs to avoid counting duplicates.
Return -1 if no such pair exists with the given target.
Q37. Move Zeros to Left Problem Statement
Your task is to rearrange a given array ARR
such that all zero elements appear at the beginning, followed by non-zero elements, while maintaining the relative order of non-z...read more
Rearrange array to move zeros to the left while maintaining relative order of non-zero elements.
Iterate through the array and maintain two pointers, one for zero elements and one for non-zero elements.
Swap elements at the two pointers until all zeros are moved to the left.
Ensure to maintain the relative order of non-zero elements while rearranging the array.
Q38. Time complexity of various data structure operations
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
Q39. Write a code to find the given linked list is Circular or not ? Then find the node where it is getting circularOther random questions like on: new technologies like clouding , knowledge about different language...
read moreQ40. Maximum Subarray Sum Problem Statement
Given an array arr
of length N
consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.
Explanation:
A sub...read more
Find the sum of the subarray with the maximum sum among all subarrays in an array of integers.
Iterate through the array and keep track of the current sum and maximum sum.
Update the maximum sum whenever a new maximum subarray sum is found.
Handle cases where all elements are negative or the array is empty.
Example: For input arr = [-2, 1, -3, 4, -1], the maximum subarray sum is 4.
Q41. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
Q42. Count Distinct Substrings
You are provided with a string S
. Your task is to determine and return the number of distinct substrings, including the empty substring, of this given string. Implement the solution us...read more
Count distinct substrings of a given string using trie data structure.
Implement a trie data structure to store all substrings of the given string.
Count the number of nodes in the trie to get the distinct substrings count.
Handle empty string case separately.
Example: For 'ab', distinct substrings are: '', 'a', 'b', 'ab'.
Q43. Equilibrium Index Problem Statement
Given an array Arr
consisting of N integers, your task is to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elements of...read more
Find the equilibrium index of an array where sum of elements on left equals sum on right.
Iterate through array to calculate prefix and suffix sums
Compare prefix and suffix sums to find equilibrium index
Return -1 if no equilibrium index is found
Q44. Spiral Matrix Problem Statement
You are given a N x M
matrix of integers. Your task is to return the spiral path of the matrix elements.
Input
The first line contains an integer 'T' which denotes the number of ...read more
The task is to return the spiral path of elements in a given matrix.
Iterate through the matrix in a spiral path by adjusting the boundaries of rows and columns.
Keep track of the direction of traversal (right, down, left, up) to form the spiral path.
Handle edge cases like when the matrix is a single row or column.
Implement a function that takes the matrix dimensions and elements as input and returns the spiral path.
Q45. Difference between span and div tag
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
Q46. Minimum Travel Time Problem Statement
Mr. X plans to explore Ninja Land, which consists of N
cities numbered from 1 to N
and M
bidirectional roads connecting these cities. Mr. X needs to select a city as the st...read more
The task is to determine the minimum time required to visit all cities and roads in Ninja Land.
Create a graph representation of the cities and roads.
Use a traversal algorithm to find the minimum time to visit all cities and roads.
Return -1 if it is impossible to visit all roads.
Consider the constraints provided in the problem statement.
Implement the function to calculate the minimum travel time.
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization is a technique used to organize data in a database efficiently.
Third Normal Form (3NF) is a level of normalization that ensures that data is stored in a way that prevents certain types of data anomalies.
In 3NF, every non-prime attribute is fully functionally dependent on the primary key.
For example, if we have a table 'Employees' with columns 'EmployeeID...read more
Q48. -----+all+permutation+of+a+string+geeksforgeeks -----/
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.
SQL query to find the second highest salary from a table
Use the MAX() function to find the highest salary
Use the NOT IN operator to exclude the highest salary from the results
Order the results in descending order and limit the query to return only the second row
Q50. 2nd TR:- 1. How can we reduce page loading time in a website.
Reducing page loading time can be achieved through various techniques.
Optimizing images and videos
Minimizing HTTP requests
Using a content delivery network (CDN)
Enabling browser caching
Minimizing JavaScript and CSS files
Using lazy loading for images and videos
Reducing server response time
Using gzip compression
Minimizing redirects
Using a faster web hosting service
Q51. Write a code to reverse the sequence of words in a sentence . For eg: Input Array: I_AM_A_BOY Output Array: BOY_A_AM_I , you can’t use extra array . Input array is the only array that can be used
Q52. What is the method for rotating an array by k positions in Core Computer Science?
One method to rotate an array by k positions is to reverse the array, then reverse the first k elements, and finally reverse the remaining elements.
Reverse the entire array
Reverse the first k elements
Reverse the remaining elements
Example: Array = ['a', 'b', 'c', 'd', 'e'], k = 2. After rotation: ['d', 'e', 'a', 'b', 'c']
Q53. A circle is inscribed in a square( coordinates top left corner (0,0) ). Coordinates of a point on the circle is given . Calculate the area of circle
To find the area of a circle inscribed in a square, calculate the radius using the given point and then use the formula for the area of a circle.
Calculate the distance from the given point to the center of the square to find the radius of the circle
Use the formula for the area of a circle (A = πr^2) to calculate the area
Remember that the radius of the circle is half the side length of the square
Q54. k nodes reversal of linked list
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
Q55. what is joins in sql
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
Q56. Normalization and all its forms
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
Q57. Write a code to add two numbers without using ‘+’ operator
Q58. program to find nth prime number and then optimise the code
Program to find nth prime number and optimize the code
Use Sieve of Eratosthenes algorithm to generate prime numbers
Implement binary search to find nth prime number
Use memoization to optimize the code
Avoid unnecessary calculations by checking if a number is prime before checking its factors
Q59. Circular linked list algorithm
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
Q60. SQL:- add a column on a table, find max salary of employee
Use ALTER TABLE to add a new column and then use MAX function to find the highest salary.
Use ALTER TABLE statement to add a new column to the table.
Use MAX function in SQL to find the maximum salary of employees.
Q61. find the occurrence of each element in an array
Count the occurrence of each element in an array of strings
Iterate through the array and use a hashmap to store the count of each element
If element already exists in the hashmap, increment its count by 1
Return the hashmap with element counts
Q62. What are cubes. How are they different from Databases
Cubes are multidimensional data structures used for analysis and reporting. They differ from databases in their structure and purpose.
Cubes store data in a multidimensional format, allowing for efficient analysis and reporting.
They are designed to handle large volumes of data and provide fast query performance.
Cubes use dimensions, measures, and hierarchies to organize and analyze data.
Unlike databases, cubes are optimized for analytical processing rather than transactional p...read more
Q63. Index in sql theoretical
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);
Q64. Current Windows and Android OS info with their differences from the past versions.
Windows and Android OS have evolved with new features and improvements compared to past versions.
Windows 10 introduced a new Start menu and Cortana virtual assistant.
Android 11 focused on improved privacy controls and messaging features.
Both OS have enhanced security measures compared to their past versions.
Q65. Write a SQL query to move table from one Schema to other
A SQL query to move a table from one schema to another.
Use the ALTER TABLE statement to rename the table and move it to the new schema.
Specify the new schema name in the ALTER TABLE statement.
Ensure that the user executing the query has the necessary privileges to perform the operation.
Q66. Program to Find Length of String with custom function
Program to find length of string using custom function
Create a custom function that takes an array of strings as input
Iterate through each string in the array and calculate its length
Return the lengths of all strings in an array
Q67. reverse the array
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
Q68. sort a vector according to other other vector ?
Sort a vector based on another vector
Use std::sort with a custom comparator function
The comparator function should compare the indices of the elements in the second vector
The first vector should be sorted based on the order of the indices in the second vector
Q69. How to perform state management in react
State management in React involves managing and updating the state of components efficiently.
Use React's built-in state management with setState() method
Utilize React Context API for managing global state
Implement Redux for complex state management in larger applications
Q70. Write a code for Expression Evaluation (BODMAS)
Q71. What does a Stored Procedure do
A stored procedure is a precompiled set of SQL statements that can be executed on a database server.
Stored procedures are used to encapsulate and execute complex database operations.
They can be used to improve performance by reducing network traffic.
Stored procedures can be parameterized and reused across multiple applications.
They provide a level of security by allowing access to the database only through the procedure.
Examples: Creating a stored procedure to insert data int...read more
Q72. tell the workflow of data preprocessing
Data preprocessing involves cleaning, transforming, and organizing raw data before analysis.
1. Data cleaning: Removing or correcting errors in the data, handling missing values.
2. Data transformation: Normalizing, scaling, encoding categorical variables.
3. Data reduction: Dimensionality reduction techniques like PCA.
4. Data integration: Combining data from multiple sources.
5. Feature engineering: Creating new features from existing data.
6. Splitting data: Dividing data into t...read more
Q73. Write code for Level Order Traversal for Binary Tree
Level Order Traversal for Binary Tree is a method to visit all nodes level by level starting from the root.
Use a queue data structure to keep track of nodes at each level
Start by pushing the root node into the queue
While the queue is not empty, dequeue a node, visit it, and enqueue its children
Q74. Minimum swaps to group all ones together
The minimum number of swaps needed to group all ones together in an array of 0s and 1s.
Iterate through the array to count the total number of ones.
Use a sliding window of size equal to the total number of ones to find the window with the minimum number of zeros.
Calculate the number of swaps needed to move all ones to that window.
Q75. What is the role of a project manager
A project manager is responsible for planning, executing, and closing projects within a specific timeframe and budget.
Developing project plans and timelines
Assigning tasks to team members
Monitoring progress and adjusting plans as needed
Communicating with stakeholders
Ensuring project goals are met within constraints
Q76. what are the components of DevOps?
DevOps components include culture, automation, measurement, and sharing.
Culture: Encouraging collaboration and communication between development and operations teams.
Automation: Implementing tools for continuous integration, continuous delivery, and infrastructure as code.
Measurement: Monitoring and analyzing performance metrics to improve processes and identify areas for optimization.
Sharing: Facilitating knowledge sharing and feedback loops to foster continuous improvement.
Q77. SUM OF DIGITS OF A NUMBER(DSA)
Calculate the sum of digits of a given number.
Iterate through each digit of the number and add them together.
Use modulo operator to extract each digit.
Repeat until all digits are processed.
Example: For number 123, sum of digits = 1 + 2 + 3 = 6.
Q78. Alternative character replacement in a string
Replace alternative characters in a string with a specified character
Iterate through the string and replace characters at odd indices with the specified character
Use a loop to go through each character and check if its index is odd or even before replacing
Example: Input string 'hello' and replacement character '*', output 'h*l*'
Q79. Difference between left join and right join
Left join includes all records from the left table and matching records from the right table, while right join includes all records from the right table and matching records from the left table.
Left join keeps all records from the left table, even if there are no matches in the right table.
Right join keeps all records from the right table, even if there are no matches in the left table.
Example: If we have a table of employees and a table of departments, a left join will inclu...read more
Q80. Zigzag traversal of binary tree
Zigzag traversal of binary tree involves alternating the direction of traversal at each level.
Use a queue to perform level order traversal of the binary tree.
For each level, alternate between adding nodes to the result list from left to right and right to left.
Continue this process until all levels have been traversed.
Q81. Difference between SSMS, SSIS and SSAS
SSMS is a management tool for SQL Server, SSIS is an ETL tool, and SSAS is a BI tool for analyzing data.
SSMS (SQL Server Management Studio) is a graphical management tool for SQL Server.
SSIS (SQL Server Integration Services) is an ETL (Extract, Transform, Load) tool used for data integration and workflow applications.
SSAS (SQL Server Analysis Services) is a BI (Business Intelligence) tool used for analyzing and reporting data.
SSMS is used for managing databases, creating and ...read more
Q82. 2. ATM Working Principles.
ATM (Automated Teller Machine) is an electronic banking outlet that allows customers to complete basic transactions without the aid of a branch representative.
ATMs allow customers to withdraw cash, deposit checks, transfer money between accounts, and check account balances.
ATMs communicate with the bank's computer system to verify account information and process transactions.
ATMs use a magnetic stripe or chip on the customer's debit or credit card to identify the account and ...read more
Q83. plane flying between two poins puzzle
Plane flying between two points puzzle
The plane is flying between two points on the globe
The shortest path between two points on a sphere is a great circle route
Factors like wind speed and direction can affect the plane's route
Q84. Normalisation and keys from dbms
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. Keys are used to uniquely identify records in a table.
Normalization involves breaking down data into smaller, more manageable parts to reduce redundancy.
Keys are used to uniquely identify records in a table. Examples include primary keys, foreign keys, and candidate keys.
Normalization helps in maintaining data integrity and reducing anomalies such as insertion, updat...read more
Q85. Sort 0,1,2 array
Sort an array of strings containing '0', '1', and '2'.
Use counting sort algorithm to count the occurrences of '0', '1', and '2'.
Create a new array with the sorted counts of '0', '1', and '2'.
Join the sorted array back into a single array of strings.
Q86. Oops concepts in detail
Oops concepts refer to Object-Oriented Programming principles like Inheritance, Polymorphism, Encapsulation, and Abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class.
Polymorphism: Ability of objects to take on multiple forms.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Abstraction: Hiding the complex implementation details and showing only the necessary features.
Q87. Sum of two digit code
Q88. Two Sum Of leetcode
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
Use a hashmap to store the difference between the target and current element
Iterate through the array and check if the current element's complement exists in the hashmap
Return the indices of the two numbers if found
Top HR Questions asked in MAQ Software
Interview Process at MAQ Software

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

