Software Engineer
6500+ Software Engineer Interview Questions and Answers
You are given two numbers, ‘X’ and ‘Y’. Your task is to find the greatest common divisor of the given two numbers.
The Greatest Common Divisor of any two integers is the largest number th...read more
You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.
Note:
The given linked ...read more
Q53. what are the differences between stored procedure and triggers in SQL?
Stored procedures are precompiled SQL statements that can be executed on demand, while triggers are automatically executed in response to specific events.
Stored procedures are explicitly called by the user, while triggers are automatically invoked by the database system.
Stored procedures can accept parameters and return values, while triggers cannot.
Stored procedures can be executed independently, while triggers are always associated with a specific table or view.
Stored proce...read more
Bubble Sort is one of the sorting algorithms that works by repeatedly swapping the adjacent elements of the array if they are not in sorted order.
You are given an unsorted array consisting of N non-...read more
Given a string 'S' and a list 'wordList' that consists of 'N' distinct words. Let 'Wi' denote word at index 'i' in 'wordList'. For each word 'Wi' in 'wordList', you n...read more
Write a program to do basic string compression. For a character which is consecutively repeated more than once, replace consecutive duplicate occurrences with the count of repetitions.
Exampl...read more
Share interview questions and help millions of jobseekers 🌟
Ninja has been given two sorted integer arrays/lists ‘ARR1’ and ‘ARR2’ of size ‘M’ and ‘N’. Ninja has to merge these sorted arrays/lists into ‘ARR1’ as one sorted array. You may have to a...read more
You are given ‘N’ fences. Your task is to find the total number of ways to paint fences using 2 colors only such that at most 2 adjacent fences are painted with the same color.
As the answer can ...read more
Software Engineer Jobs
Given two strings, 'S' and 'T' with lengths 'M' and 'N', find the length of the 'Longest Common Subsequence'.
For a string 'str'(per se) of length K, the subsequences are the strings c...read more
You have been given ‘K’ different arrays/lists, which are sorted individually (in ascending order). You need to merge all the given arrays/list such that the output array/list should be sor...read more
You are given a 2D matrix (containing either ‘0’ or ‘1’) of size N x M, where each row is in sorted order. Find the 0-based index of the first row that has the maximum number of...read more
Q62. What are seven layers of networking?
The seven layers of networking refer to the OSI model which defines how data is transmitted over a network.
The seven layers are: Physical, Data Link, Network, Transport, Session, Presentation, and Application.
Each layer has a specific function and communicates with the layers above and below it.
For example, the Physical layer deals with the physical transmission of data, while the Application layer deals with user interfaces and applications.
Understanding the OSI model is imp...read more
Given a sequence of numbers ‘ARR’. Your task is to return a sorted sequence of ‘ARR’ in non-descending order with help of the merge sort algorithm.
Example :
Merge Sort Algorithm - Merge sort is a Div...read more
You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more
You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the ou...read more
Given a binary tree. Print the Left View of the Tree.
Example :
If the input tree is as depicted in the picture:
The Left View of the tree will be: 2 35 2
Input format :
Elements in t...read more
Ninja is given an integer ‘N’ . One day Ninja decides to break the integer into K positive parts (K>=2) such that the sum of all parts is equal to ‘N’.Ninja wants to maximize the product of al...read more
You are given a string ‘S’ of length ‘N’. You have to return all the characters in the string that are duplicated and their frequency.
Example:-
N = 5 S = ‘GEEK’ ANSWER:- The answer s...read more
You have been given a permutation of ‘N’ integers. A sequence of ‘N’ integers is called a permutation if it contains all integers from 1 to ‘N’ exactly once. Your task is to ...read more
Given a text and a wildcard pattern of size N and M respectively, implement a wildcard pattern matching algorithm that finds if the wildcard pattern is matched with the text. The matchi...read more
The task is to implement a wildcard pattern matching algorithm that checks if a given wildcard pattern matches a given text.
The wildcard pattern can include the characters '?' and '*'
'?' matches any single character
'*' matches any sequence of characters (sequence can be of length 0 or more)
The matching should cover the entire text, not partial text
Implement a function that takes the wildcard pattern and the text as input and returns True if the text matches the pattern, False...read more
Q71. Given an array A[n], write a C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum
C program to find P and Q (P>Q) such that A[P] - A[Q] is maximum
Iterate through array and keep track of maximum difference and corresponding indices
Initialize P and Q to first two elements and update as necessary
Time complexity: O(n)
Given a N * N matrix and the task is to check matrix is idempotent matrix or not.
See the sample input.
Idempotent matrix M follows the following property :
M*M = M
Input format :
Line 1 : Siz...read more
Q73. If there are 200 fishes in an aquarium. 99% are red. How many fishes have to be removed to make the red fishes 98 % in the aquarium?
To make the red fishes 98%, 50 fishes have to be removed from the aquarium.
Calculate 1% of 200 fishes to find out how many fishes represent 1%.
Multiply the result by 2 to find out how many fishes represent 2%.
Subtract the result from 200 to find out how many fishes represent 98%.
You are given an array/list ‘BINARYNUMS’ that consists of ‘N’ distinct strings which represent all integers from 0 to N in binary representation except one integer. This integer between 0 to ‘N’ w...read more
Nth term of Fibonacci series F(n), where F(n) is a function, is calculated using the following formula -
F(n) = F(n-1) + F(n-2), Where, F(1) = F(2) = 1
Provided N you have to find out the ...read more
Given an integer N, print all the prime numbers that lie in the range 2 to N (both inclusive).
Print the prime numbers in different lines.
Input Format :
Integer N
Output Format :
Prime number...read more
You are given two Singly Linked List of integers, which are merging at some node of a third linked list.
Your task is to find the data of the node at which merging starts. If there is...read more
You are given an integer N. Your task is to return a 2-D ArrayList containing the pascal’s triangle till the row N.
A Pascal's triangle is a triangular array constructed by summing adjacent ele...read more
For a given string(str) and a character X, write a function to remove all the occurrences of X from the given string and return it.
The input string will remain unchanged if the given character(...read more
You are given a directed acyclic graph. Your task is to find any topological sorting of the graph.
A directed acyclic graph is a directed graph with no directed cycles.
Topological sorting for D...read more
You are given two water jugs with capacities X and Y litres respectively. Both the jugs are initially empty. There is an infinite amount of water supply available. The jugs do not have markings...read more
Given an input string (STR), print all possible permutations of the input string.
Note:
The input string may contain the same characters, so there will also be the same permutations. The order...read more
You are given a railway seat number as an integer, your task is to check whether it is a valid seat number or not. Also print its berth type i.e lower berth, middle berth, upper bert...read more
Given a 2-dimensional boolean matrix mat of size N x M, modify the matrix such that if an element is 1, set its entire row and column to 1 i.e. if mat[i][j] = 1, then make all the elements of the ...read more
You have given a Singly Linked List of integers, determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The li...read more
Write a query to find names of the customers who have purchased less than or equal to one product. Order the output by customer name. Given customer table with customer id and customer name , produ...read more
You have been given a long type array/list 'ARR' of size 'N'. It represents an elevation map wherein 'ARR[i]' denotes the elevation of the 'ith' bar. Print the total amount of rainwater that ...read more
Given an arithmetic expression ‘EXP’ containing integer values separated by any of the three operators ‘ + ’, ‘ - ’ and ‘ * ’. You need to place parentheses in the given expression such that...read more
You are given an integer ‘NUM’ . Your task is to find out whether this number is an Armstrong number or not.
A k-digit number ‘NUM’ is an Armstrong number if and only if the k-th power of each d...read more
Given an integer ‘N’, the task is to find its corresponding Roman numeral.
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value I 1 V 5 X 10 L ...read more
You are given the arrival and departure times of N trains at a railway station in a day. You need to find the minimum of platforms required for the railway station such that no ...read more
You are given an array of n integers (a1, a2,....,an), you need to find if the array contains a pythagorean triplet or not.
An array is said to have a pythagorean triplet if there exists thr...read more
Given an array ‘ARR’ of size ‘N,’ swap the Kth element from beginning with the Kth element from the end.
For example:
If ‘N’ = 5 and K = 2 [1, 2, 3, 4, 5] Then the output will be [1, 4, 3, 2, 5...read more
Q94. An API is running slow. Upon investigation it was found that SPROC running behind it is perfectly optimized. How can you debug this behavior of API? (You can neglect the resolve time & connect time of the API r...
read moreTo debug the slow behavior of the API, analyze network latency, check for database issues, monitor server performance, and review code for potential bottlenecks.
Analyze network latency to identify any issues with data transmission.
Check for database issues such as slow queries or insufficient indexing.
Monitor server performance to ensure it has enough resources and is not overloaded.
Review the code for potential bottlenecks, such as inefficient algorithms or excessive databas...read more
You are given an array consisting of 'N' elements and you need to perform 'Q' queries on the given array. Each query consists of an integer which tells the number of elements by which...read more
Ninja has been given two sparse matrices ‘MAT1’ and ‘MAT2’ of integers having size ‘N’ x ‘M’ and ‘M’ x ‘P’, respectively.
A sparse matrix is a matrix that contains very few non-zero element...read more
You are given a 9x9 sudoku. Your task is to solve sudoku and return the solution.
A sudoku is a puzzle in which players insert the numbers one to nine into a grid consisting of nine squares subdivided int...read more
You are given three strings 'A', 'B' and 'C'. Check whether 'C' is formed by an interleaving of 'A' and 'B'.
'C' is said to be interleaving 'A' and 'B', if the length of 'C' is equal to ...read more
What are the features of Java 8?
Given an M x N sized 2D array 'MATRIX', return the (i * i + j * j) value for elements in which the sum of cube of digits of the element is equal to the element itself. Here, 'i' is the row number ...read more
Interview Questions of Similar Designations
Top Interview Questions for Software Engineer Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month