Senior Software Engineer

3500+ Senior Software Engineer Interview Questions and Answers

Updated 15 Dec 2024

Popular Companies

search-icon
Q1. 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

Q2. Find Nth Prime

You are given a number 'N'. Your task is to find Nth prime number.

A prime number is a number greater than 1 that is not a product of two smaller natural numbers. Prime numbers have only two facto...read more

Ans.

The task is to find the Nth prime number given a number N.

  • A prime number is a number greater than 1 that is not a product of two smaller natural numbers.

  • Prime numbers have only two factors - 1 and the number itself.

  • Start with a counter at 0 and a number at 2.

  • Increment the number by 1 and check if it is prime.

  • If it is prime, increment the counter.

  • Repeat until the counter reaches N.

  • Return the last prime number found.

Senior Software Engineer Interview Questions and Answers for Freshers

illustration image
Q3. K Largest Elements You are given with an integer k and an array of integers that contain numbers in random order. Write a program to find k largest numbers from given array. You need to save them in an array an...read more
Ans.

Given an unsorted array, find the K largest elements in non-decreasing order.

  • Sort the array in non-decreasing order.

  • Return the last K elements of the sorted array.

Q4. System Design Question

Create a simple shopping application. They have given the sample project which already has some code. They asked to add the below features. Clicking on each Add To Cart should add the item...read more

Ans.

Create a shopping application with add to cart, increase/decrease quantity, and update functionality.

  • Implement add to cart functionality when clicking on each item

  • Update the product listing component to show increase/decrease quantity buttons and the quantity of the item in the cart

  • Implement functionality to increase the quantity of an item in the cart

  • Implement functionality to decrease the quantity of an item in the cart

  • Handle scenarios when the cart quantity is 1 or greater...read more

Are these interview questions helpful?

Q5. Tell me about yourself. What technology are you using? What is a Collection? What are the different types of collection there? What is the difference between ArrayList and LinkedList What are the basic building...

read more
Ans.

The interview questions cover a wide range of topics including software engineering, technology, design patterns, databases, web development, and more.

  • The questions cover topics such as technology used, collections, streams, design patterns, dependency injection, microservices, database communication, annotations in Spring, React and JavaScript, Redux, API development, SOAP-based web services, Jenkins, Docker, production support, and more.

  • Some specific questions include the d...read more

Q6. Duplicate In Array

You are given an array ‘ARR’ of size ‘N’ containing each number between 1 and ‘N’ - 1 at least once. There is a single integer value that is present in the array twice. Your task is to find th...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Implement Map Sum Pair

Ninja has to implement a data structure called ‘MapSum’. Ninja has to implement two functions and one constructor.

1) MapSum(): Ninja has to initialize the ‘MapSum’. 2) insert(‘KEY’, ‘VAL’...read more
Ans.

The question asks to implement a data structure called 'MapSum' with functions to initialize, insert key-value pairs, and find the sum of values with a given prefix.

  • Implement a class called 'MapSum' with a constructor to initialize the data structure.

  • Implement the 'insert' function to insert key-value pairs into the 'MapSum'. If a key is already present, replace its value with the new one.

  • Implement the 'sum' function to find the sum of values whose key has a prefix equal to t...read more

Q8. Buy and Sell Stock

You are Harshad Mehta’s friend. He told you the price of a particular stock for the next ‘N’ days. You can either buy or sell a stock. Also, you can only complete at most 2-transactions. Find ...read more

Frequently asked in,

Senior Software Engineer Jobs

Sr Software Engineer - C# 3-7 years
Siemens Healthcare
4.4
Bangalore / Bengaluru
Business Analyst/Senior Software Engineer 3-8 years
HSBC electronic data processing india pvt ltd
4.0
Hyderabad / Secunderabad
SAP Payroll and successfactor/Senior Software Engineer 3-7 years
HSBC electronic data processing india pvt ltd
4.2
Hyderabad / Secunderabad
Q9. Digits Decoding

A few days back, Ninja encountered a string containing characters from ‘A’ to ‘Z’ which indicated a secret message. For security purposes he encoded each character of the string to its numeric v...read more

Q10. Reverse the String

You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.

For example:

 If the given string is: STR = "abcde". You h...read more
Ans.

The task is to reverse a given string containing alphanumeric and special characters.

  • Iterate through the string from the last character to the first character

  • Append each character to a new string to get the reversed string

  • Return the reversed string as the output

Q11. Second largest element in the array

A few days back, Ninja encountered a string containing characters from ‘A’ to ‘Z’ which indicated a secret message. For security purposes he encoded each character of the stri...read more

Q12. 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
Q13. Excel Column Number

You have been given a column title as appears in an Excel sheet, return its corresponding column number.

For example:
A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... 
Input Format
The ...read more
Q14. LRU Cache Implementation

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, o...read more
Frequently asked in,
Q15. Count characters

Write a program to count and print the total number of characters (lowercase english alphabets only), digits (0 to 9) and white spaces (single space, tab i.e. '\t' and newline i.e. '\n') entered...read more

Q16. Number of Flips

Ninja is learning the binary representation of the numbers. He wanted to practice the topic, so he picked a question. The problem statement says, two numbers, ‘A’ and ‘B’ are given. Find the numb...read more

Q17. Sum of Digits

Ninja is given an integer ‘N’. One day Ninja decides to do the sum of all digits and replace the ‘N’ with the sum of digits until it becomes less than 10. Ninja wants to find what will be the value...read more

Q18. String Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters.

Palindrome
A palindrome is a word, number, phrase, or other sequences of characters which read the sam...read more
Q19. Search In Rotated Sorted Array

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he to...read more

Q20. Find all anagrams

You have been given a string STR and a non-empty string PTR. Your task is to find all the starting indices of PTR’s anagram in STR.

An anagram of a string is another string which contains the s...read more

Q21. Boundary Traversal

You have been given a binary tree of integers. Your task is to print the boundary nodes of this binary tree in Anti-Clockwise direction starting from the root node.

NOTE:
The boundary nodes of...read more

Q22. How to apply SOLID principle and what is dependency injection and why to use it and scenarios on where to use

Ans.

SOLID principles ensure maintainable and scalable code. Dependency Injection helps in achieving loose coupling and testability.

  • SOLID principles are Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion

  • Dependency Injection is a design pattern that allows objects to be loosely coupled and easily testable

  • Use Dependency Injection to reduce tight coupling between classes and make them more modular

  • Use SOLID principles to ensure mai...read more

Q23. Anagram Substring Search

Given two strings ‘STR’ and ‘PTR’. Find all the starting indices of ‘PTR’ anagram substring in ‘STR’. Two strings are anagram if and only if one string can be converted into another stri...read more

Q24. LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:

1. get(key) - Return the value of the key if the key exists in the cache, otherwise return...read more
Ans.

The question is about designing and implementing a data structure for LRU cache to support get and put operations.

  • LRU cache is a cache replacement policy that removes the least recently used item when the cache reaches its capacity.

  • The cache is initialized with a capacity and supports get(key) and put(key, value) operations.

  • For each get operation, return the value of the key if it exists in the cache, otherwise return -1.

  • For each put operation, insert the value in the cache i...read more

Q25. 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, ,
Q26. Triplets with Given Sum

You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.

An array is said to have a...read more

Frequently asked in,
Q27. Anagram Pairs

Pre-requisites: Anagrams are defined as words or names that can be formed by rearranging letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "...read more

Q28. Given a grid containing 0s and 1s and source row and column, in how many ways, could we reach form source to target. ( 1's represents a blockade and 0's represent accessable points)

Ans.

Count the number of ways to reach target from source in a grid with 0s and 1s.

  • Use dynamic programming to solve the problem efficiently.

  • Traverse the grid using DFS or BFS to count the number of ways.

  • Consider edge cases like when source and target are the same or when there is no path.

  • Example: Given grid = [[0,0,0],[0,1,0],[0,0,0]], source = (0,0), target = (2,2), answer is 2.

  • Example: Given grid = [[0,1],[0,0]], source = (0,0), target = (1,1), answer is 1.

Q29. K-th largest Number BST

You are given a binary search tree of integers with 'N' nodes. Your task is to return the K-th largest element of this BST.

If there is no K-th largest element in the BST, return -1.

A bi...read more

Q30. Reverse List In K Groups

You are given a linked list of 'N' nodes and an integer 'K'. You have to reverse the given linked list in groups of size K i.e if the list contains x nodes numbered from 1 to x, then you...read more

Q31. Trailing Zeros in Factorial

You are given an integer N, you need to find the number of trailing zeroes in N! (N factorial).

Note:

1. Trailing zeros in a number can be defined as the number of continuous suffix z...read more
Q32. Reverse Alternate K nodes

You are given a Singly Linked List of integers and a positive integer 'K'. Modify the linked list by reversing every alternate 'K' nodes of the linked list.

A singly linked list is a ty...read more
Q33. Count Ways To Reach The N-th Stairs

You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair. Each time you can either climb one step or two steps. You are...read more

Frequently asked in, ,
Q34. Find Duplicates In Array

You are given an array/list 'ARR' consisting of N integers, which contains elements only in the range 0 to N - 1. Some of the elements may be repeated in 'ARR'. Your task is to find all ...read more

Frequently asked in,
Q35. Kth Largest Number

You will be given a stream of numbers, and you need to find the kth largest number in the stream at any given time.

As the stream of numbers can not be given during compile time, so you need t...read more

Q36. Reverse string Word Wise

Reverse the given string word wise. That is, the last word in given string should come at 1st place, last second word at 2nd place and so on. Individual words should remain as it is.

In...read more
Q37. 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,

Q38. Write a Program Nth term in a infinite series example: 2,4,8,2,4,8……..n…….infinite

Ans.

Program to find the Nth term in an infinite series

  • The series has a repeating pattern

  • Use modulo operator to find the index of the repeating pattern

  • Calculate the value of Nth term based on the pattern

Q39. Preorder Traversal

You are given the root node of a binary tree consisting of ‘N’ nodes. Your task is to return its preorder traversal. The preorder traversal of a binary tree is defined as a process of traversi...read more

Q40. Count Inversions

For a given integer array/list 'ARR' of size 'N', find the total number of 'Inversions' that may exist.

An inversion is defined for a pair of integers in the array/list when the following two co...read more

Q41. Find Number Of Islands

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to...read more

Q42. Make Unique Array

You are given an array ‘ARR’ of size ‘N,’ and you have to tell the minimum number of elements that need to be removed such that the array contains all distinct elements. More formally, there sh...read more

Q43. Maximum sum of non-adjacent elements

You are given an array/list of ‘N’ integers. You are supposed to return the maximum sum of the subsequence with the constraint that no two elements are adjacent in the given ...read more

Q44. Move Zeroes To End

Given an unsorted array of integers, you have to move the array elements in a way such that all the zeroes are transferred to the end, and all the non-zero elements are moved to the front. The...read more

Q45. All Paths From Source Lead To Destination

There is a directed graph consisting of ‘N’ nodes numbered from 0 to ‘N’-1. You are given a list ‘EDGES’ of size ‘M’, consisting of all the edges of this directed graph,...read more

Q46. Asteroid Collision

You are given an array/list “ASTEROIDS” representing asteroids in a row. For each element of the given array, its absolute value denotes the size of that asteroid and its sign denotes the dire...read more

Q47. String Transformation

Given a string (STR) of length N, you have to create a new string by performing the following operation:

Take the smallest character from the first 'K' characters of STR, remove it from STR...read more

Q48. Reverse String

You are given a string ‘S’. You are also given ‘M’ integers in an array ‘A’. You perform ‘M’ operations on this string. The operations are given in an array ‘A’ of size ‘M’.

You perform the operat...read more

Q49. In azure data factory how would you implement the functionality of tumbling window without actually using that feature already available?

Ans.

Implementing tumbling window in Azure Data Factory without using the feature

  • Create a pipeline with a trigger that runs at the desired interval

  • Use a lookup activity to retrieve the data for the current window

  • Use a foreach activity to iterate over the retrieved data

  • Perform the required operations on the data within the foreach activity

  • Write the output to the desired destination

Q50. String is immutable but what happens if we assign another value to that string reference

Ans.

Assigning another value to a string reference creates a new string object in memory.

  • Assigning a new value to a string reference creates a new string object in memory

  • The original string object remains unchanged

  • The new value is stored in a different memory location

  • The old value may be garbage collected if there are no other references to it

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.7
 • 5.2k Interviews
3.8
 • 4.6k Interviews
3.6
 • 3.7k Interviews
3.6
 • 3.6k Interviews
3.6
 • 2.3k Interviews
3.4
 • 771 Interviews
3.7
 • 506 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

Senior 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