MAQ Software
80+ JBM Group 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
Q2. 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
Q3. 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
Q4. 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
Q5. 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
Q6. 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
Q7. 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
Q8. 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
Q9. 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
Q10. 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
Q11. 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
Q12. 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
Q13. 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
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
Q15. 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
Q16. 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.
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. 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
Q19. 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
Q20. 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
Q21. 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
Q22. 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
Q23. 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
Q24. 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
Q25. 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
Q26. 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.
Q27. 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
Q28. 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
Q29. 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
Q30. 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
Q31. 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'
Q32. 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
Q33. 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
Q34. 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
Q35. 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
Q36. 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
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
Q38. 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
Q39. 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
Q40. 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
Q41. 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
Q42. 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 moreQ43. 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
Q44. 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
Q46. 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
Q47. -----+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.
Q49. 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
Q50. 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. 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.
Q60. 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
Q61. 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
Q62. 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);
Q63. 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.
Q64. 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.
Q65. 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
Q66. 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
Q67. 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
Q68. 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
Q69. Write a code for Expression Evaluation (BODMAS)
Q70. 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
Q71. 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
Q72. 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
Q73. 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.
Q74. 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
Q75. 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.
Q76. 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.
Q77. 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*'
Q78. 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
Q79. 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.
Q80. 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
Q81. 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
Q82. 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
Q83. 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
Q84. 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.
Q85. 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.
Q86. Sum of two digit code
Q87. 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
Q88. 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
Top HR Questions asked in JBM Group
Interview Process at JBM Group
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month