Software Engineer

6500+ Software Engineer Interview Questions and Answers

Updated 16 Dec 2024

Popular Companies

search-icon
Q51. Greatest Common Divisor

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

Q52. Merge Two Sorted Linked Lists

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?

Ans.

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

Q54. Bubble Sort

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

Are these interview questions helpful?
Q55. Check If Given Words Are Present In A String

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

Q56. Compress the String

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 🌟

man-with-laptop
Q57. Merge two sorted arrays

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

Q58. Painting Fences

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

Software Engineer 6-12 years
Maersk Global Service Centres India Pvt. Ltd.
4.3
Bangalore / Bengaluru
Software Engineer 1-6 years
IBM India Pvt. Limited
4.1
Hyderabad / Secunderabad
Software Engineer (Dot Net & React) 6-12 years
Maersk Global Service Centres India Pvt. Ltd.
4.3
Pune
Q59. Longest Common Subsequence

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

Q60. Merge K Sorted Arrays

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

Q61. Row Of A Matrix With Maximum Ones

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?

Ans.

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

Q63. Merge Sort

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
Q64. Ways To Make Coin Change

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

Frequently asked in,
Q65. Reverse Words in a String

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

Q66. Left View Of Binary Tree

Given a binary tree. Print the Left View of the Tree.

Example :
If the input tree is as depicted in the picture: 

alt text

The Left View of the tree will be: 2 35 2 
Input format :
Elements in t...read more
Q67. Break The Integer

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

Q68. Find duplicates in a string

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
Q69. Implement next_permutation function.

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

Q70. Wildcard Pattern Matching

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

Ans.

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

Ans.

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)

Q72. Idempotent Matrix

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?

Ans.

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%.

Q74. Missing Number

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

Q75. Nth Fibonacci Number

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

Frequently asked in, ,
Q76. All prime numbers

Given an integer N, print all the prime numbers that lie in the range 2 to N (both inclusive).

Input Format :
Integer N 
Output Format :
Prime number...read more
Q77. Intersection of Linked List

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

Frequently asked in,
Q78. Pascal's Triangle

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

Q79. Remove character

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

Q80. Topological Sort

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

Q81. Water Jug Problem

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

Q82. Print Permutations

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
Q83. Berth of railway seat number

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

Q84. Boolean Matrix

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

Q85. Cycle Detection in a Singly Linked List

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

Frequently asked in,
Q86. SQL Questions

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

Q87. Trapping Rain Water

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

Frequently asked in,
Q88. Arithmetic Operators

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

Q89. Armstrong Number

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

Q90. Integer To Roman Numeral

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
Q91. Minimum Number of Platform Needed

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

Q92. Pythagorean Triplets

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

Q93. Swap Kth Elements

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 more
Ans.

To 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

Q95. Left Rotations of An Array

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

Q96. Matrix Multiplication

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

Q97. Sudoku

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

Q98. Interleaving Two Strings

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

Q99. Java Question

What are the features of Java 8?

Q100. Cube of Matrix

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

Previous
1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.2k Interviews
3.8
 • 4.6k Interviews
3.6
 • 3.7k Interviews
3.6
 • 3.6k Interviews
3.6
 • 2.3k Interviews
View all

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

Software Engineer Interview Questions
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
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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