Senior Software Engineer
4500+ Senior Software Engineer Interview Questions and Answers

Asked in Avalon Information Systems

Q. Reverse String Word-Wise Problem Statement
Reverse the given string so that the last word appears first, the second last word appears second, and so on, while keeping the individual words unchanged.
Explanation...read more
Reverse the given string word-wise while keeping the individual words unchanged.
Split the input string by space to get individual words
Reverse the array of words
Join the reversed array of words back into a single string

Asked in Tech Mahindra

Q. In Azure Data Factory, how would you implement the functionality of a tumbling window without using the built-in tumbling window feature?
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

Asked in Capgemini

Q. Kth Largest Number Problem Statement
You are given a continuous stream of numbers, and the task is to determine the kth largest number at any moment during the stream.
Explanation:
A specialized data structure ...read more
Design a data structure to find the kth largest number in a continuous stream of integers.
Design a specialized data structure to handle an indefinite number of integers from the stream.
Implement 'add(DATA)' to incorporate integers into the stream's pool.
Implement 'getKthLargest()' to retrieve the kth largest number from the pool.
Maintain the pool of numbers and return the kth largest number for each query.
Ensure efficient implementation to handle large input sizes.

Asked in Cognizant

Q. 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 subsequent Fibonacci numbers.
Optimize the solution to have a time complexity of O(N) by storing and reusing calculated values.

Asked in Amazon

Q. Reverse Linked List in Groups of K
You are provided with a linked list containing 'N' nodes and an integer 'K'. The task is to reverse the linked list in groups of size K, which means reversing the nodes in eac...read more
Reverse a linked list in groups of size K by reversing nodes in each group.
Iterate through the linked list in groups of size K
Reverse each group of nodes
Handle cases where the number of elements in the last group is less than K

Asked in Capgemini

Q. Trailing Zeros in Factorial Problem
Find the number of trailing zeroes in the factorial of a given number N
.
Input:
The first line contains an integer T
representing the number of test cases.
Each of the followi...read more
Count the number of trailing zeros in the factorial of a given number.
Calculate the number of 5's in the prime factorization of N to find the number of trailing zeros.
Divide N by 5, then by 25, then by 125, and so on, and sum up the quotients to get the answer.
Example: For N=10, 10/5=2, so there are 2 trailing zeros in 10!.
Senior Software Engineer Jobs




Asked in Nagarro

Q. Reverse Alternate K Nodes Problem Statement
You are given a singly linked list of integers along with a positive integer 'K'. The task is to modify the linked list by reversing every alternate 'K' nodes of the ...read more
The task is to modify a singly linked list by reversing every alternate 'K' nodes of the linked list.
Iterate through the linked list in groups of size K, reverse every alternate group
Handle cases where the number of remaining nodes is less than K
Update the pointers accordingly to reverse the nodes in the linked list

Asked in Amazon

Q. 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 calculations.
Increment island count whenever a new island is encountered.
Share interview questions and help millions of jobseekers 🌟

Asked in Xoriant

Q. Strings are immutable. What happens if we assign another value to a string reference?
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

Asked in Tredence

Q. All Paths From Source Lead To Destination Problem Statement
In a directed graph with 'N' nodes numbered from 0 to N-1, determine whether every possible path starting from a given source node (SRC) eventually le...read more
Determine if all paths from a given source node lead to a specified destination node in a directed graph.
Check if there is at least one path from source to destination.
Ensure that nodes with no outgoing edges from source are the destination.
Verify that the number of paths from source to destination is finite.
Return True if all paths from source lead to destination, otherwise False.

Asked in Dunzo

Q. Asteroid Collision Problem Description
Given an array/list ASTEROIDS
representing asteroids aligned in a row, each element's absolute value identifies the asteroid's size, while its sign indicates the direction...read more
Determine the state of asteroids after collisions occur in a row.
Iterate through the array of asteroids and simulate collisions between adjacent asteroids moving in opposite directions.
If two asteroids collide, the larger one survives while the smaller one is destroyed.
Continue this process until no more collisions can occur.
Return the array of remaining asteroids after all collisions have been resolved.

Asked in Nagarro

Q. Preorder Traversal Problem Statement
You are provided with the root node of a binary tree comprising N
nodes. Your objective is to output its preorder traversal. Preorder traversal of a binary tree is performed...read more
Implement a function to perform preorder traversal on a binary tree given the root node.
Create a recursive function to traverse the tree in preorder fashion.
Visit the root node, then recursively traverse left subtree, followed by right subtree.
Store the visited nodes in an array and return the array as the result.
Example: For the input tree [1, 2, 3, 4, -1, 5, 6, -1, 7, -1, -1, -1, -1, -1, -1], the preorder traversal output should be [1, 2, 4, 7, 3, 5, 6].

Asked in Amazon

Q. Anagram Pairs Verification
In this task, you need to verify if two provided strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the oth...read more
Verify if two strings are anagrams of each other by rearranging their letters.
Create character frequency maps for both strings.
Compare the frequency of characters in both maps to check if they are anagrams.
Return 'True' if the frequencies match, else return 'False'.

Asked in Josh Technology Group

Q. Maximum Non-Adjacent Subsequence Sum
Given an array of integers, determine the maximum sum of a subsequence without choosing adjacent elements in the original array.
Input:
The first line consists of an integer...read more
Find the maximum sum of a subsequence without choosing adjacent elements in an array.
Use dynamic programming to keep track of the maximum sum at each index, considering whether to include the current element or not.
At each index, the maximum sum can be either the sum of the current element and the element two positions back, or the maximum sum at the previous index.
Iterate through the array and update the maximum sum accordingly.
Example: For the input [3, 2, 7, 10], the maxim...read more

Asked in Amazon

Q. String Transformation Problem
Given a string (STR
) of length N
, you are tasked to create a new string through the following method:
Select the smallest character from the first K
characters of STR
, remove it fr...read more
The task is to transform a given string by selecting the smallest character from the first K characters and appending it to a new string until the original string becomes empty.
Iterate through the string while there are characters remaining
For each iteration, select the smallest character from the first K characters
Remove the selected character from the original string and append it to the new string
Repeat until the original string is empty
Return the final new string

Asked in BlueStacks

Q. Move Zeroes to End
Given an unsorted array of integers, rearrange the elements such that all the zeroes are moved to the end, while maintaining the order of non-zero elements.
Input:
The first line contains an ...read more
Given an unsorted array of integers, move all zeroes to the end while maintaining the order of non-zero elements.
Iterate through the array and maintain two pointers, one for the current position and one for the position to swap with.
If the current element is non-zero, swap it with the element at the swap pointer and increment the swap pointer.
After iterating through the array, fill the remaining positions with zeroes.
Example: Input array [0, 1, -2, 3, 4, 0, 5, -27, 9, 0] shou...read more

Asked in Tredence

Q. Reverse String Operations Problem Statement
You are provided with a string S
and an array of integers A
of size M
. Your task is to perform M
operations on the string as specified by the indices in array A
.
The ...read more
Given a string and an array of indices, reverse substrings based on the indices to obtain the final string.
Iterate through the array of indices and reverse the substrings accordingly
Ensure the range specified by each index is non-empty
Return the final string after all operations are completed

Asked in Q3 Technologies

Q. What is difference between Abstract and Interface, give me some example of your project in which you have used Abstract class and Interface.
Abstract class and Interface are both used for abstraction, but with some differences.
Abstract class can have both abstract and non-abstract methods, while Interface can only have abstract methods.
A class can implement multiple interfaces, but can only inherit from one abstract class.
Abstract class can have instance variables, while Interface cannot.
Abstract class provides partial implementation, while Interface provides full abstraction.
Example of using Abstract class: Creat...read more

Asked in Amazon

Q. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the inversion condition is met.
Use a nested loop to compare each pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.

Asked in Capita

An interface in OOP defines a contract for classes to implement, specifying methods that must be included.
An interface contains method signatures but no implementation details.
Classes can implement multiple interfaces in Java.
Interfaces allow for polymorphism and loose coupling in software design.

Asked in Wells Fargo

Q. How have you implemented dependency injection in your .NET Core projects? How have you used the Razor engine to build dynamic views in your ASP.NET Core projects? Can you explain how you have used Angular to bu...
read moreAnswering questions on .NET Core, Razor engine, and Angular
Implemented dependency injection in .NET Core using built-in DI container or third-party libraries like Autofac or Ninject
Used Razor engine to build dynamic views by creating Razor views with HTML and C# code to generate dynamic content
Built single-page applications using Angular by creating components, services, and modules to manage data and UI

Asked in Amazon

Q. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
The task is to find all pairs of elements in an array that add up to a given target.
Iterate through the array and for each element, check if the target minus the element exists in a hashmap.
If it exists, print the pair (current element, target - current element).
If no pair is found, print (-1, -1).

Asked in Walmart

Q. Kth Largest Element Problem Statement
Ninja enjoys working with numbers, and Alice challenges him to find the Kth largest value from a given list of numbers.
Input:
The first line contains an integer 'T', repre...read more
The task is to find the Kth largest element in a given list of numbers for each test case.
Read the number of test cases 'T'
For each test case, read the number of elements 'N' and the value of 'K'
Sort the array in descending order and output the Kth element

Asked in Amazon

Q. Next Greater Element Problem Statement
Given a list of integers of size N
, your task is to determine the Next Greater Element (NGE) for every element. The Next Greater Element for an element X
is the first elem...read more
The task is to find the Next Greater Element for each element in a list of integers.
Iterate through the list of integers from right to left
Use a stack to keep track of elements for which the Next Greater Element is not yet found
Pop elements from the stack until a greater element is found or the stack is empty

Asked in GlobalLogic

Q. Find Terms of Series Problem
Ayush is tasked with determining the first 'X' terms of the series defined by 3 * N + 2, ensuring that no term is a multiple of 4.
Input:
The first line contains a single integer 'T...read more
Generate the first 'X' terms of a series 3 * N + 2, excluding multiples of 4.
Iterate through numbers starting from 1 and check if 3 * N + 2 is not a multiple of 4.
Keep track of the count of terms generated and stop when 'X' terms are found.
Return the list of terms that meet the criteria for each test case.

Asked in EPAM Systems

Q. Implementation of hashmap in Java 8, Bean lifecycle, difference between @Component and @Service, Front Controller, difference between PUT & PATCH, Authentication in REST APIs, how to disable junit test cases in...
read moreThe interview question covers topics like hashmap implementation in Java 8, bean lifecycle, annotations in Spring framework, HTTP methods, REST API authentication, and disabling junit test cases during deployment.
HashMap in Java 8 uses an array of linked lists to store key-value pairs, with the hash code of the key determining the index in the array.
Bean lifecycle in Spring framework involves initialization and destruction phases, managed by the container.
@Component and @Serv...read more

Asked in TCS

Q. 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.
Handle edge cases like empty array or no duplicates found.
Example: For input [0, 3, 1, 2, 3], output should be [3].

Asked in Global Edge Software

Q. 1) What is volatile? 2) What is constant? 3) Can we use volatile and const at a time?4) What is ISR how it works?
Answers to questions related to software engineering concepts.
Volatile is a keyword used to indicate that a variable's value can be changed unexpectedly.
Constant is a keyword used to indicate that a variable's value cannot be changed once it is assigned.
Volatile and const can be used together to indicate that a variable's value cannot be changed and that it may change unexpectedly.
ISR stands for Interrupt Service Routine and is a function that is called when an interrupt occu...read more

Asked in Nagarro

Q. Make Unique Array Challenge
Your task is to determine the minimum number of elements that need to be removed from an array 'ARR' of size 'N' such that all the remaining elements are distinct. In simpler terms, ...read more
Find the minimum number of elements to remove from an array to make all elements distinct.
Iterate through the array and keep track of the frequency of each element using a hashmap.
Count the number of elements that have a frequency greater than 1, as those need to be removed.
Return the count of elements to be removed.

Asked in Tech Mahindra

Q. Given an array a = Array(1,2,1,3,4), how would you output the following pairs: (1,2), (2,1), (1,3), (3,4)?
Print pairs of adjacent elements in an array
Loop through the array and print each pair of adjacent elements
Use a for loop and access the elements using their indices
Example: for i in 0 until a.length-1 print (a[i], a[i+1])
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Senior Software Engineer Related Skills

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

