Associate Software Engineer

400+ Associate Software Engineer Interview Questions and Answers for Freshers

Updated 30 Nov 2024

Popular Companies

search-icon
Q1. 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,
Q2. Intersection of Two Arrays II

You have been given two integer arrays/list(ARR1 and ARR2) of size N and M, respectively. You need to print their intersection; An intersection for this problem can be defined when...read more

Q3. Connect N Ropes With Minimum Cost

You have been given 'N' ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. We need to conn...read more

Ans.

The problem is to connect N ropes of different lengths into one rope with minimum cost.

  • Sort the array of rope lengths in ascending order.

  • Initialize a variable to keep track of the total cost.

  • While there are more than one rope remaining, take the two shortest ropes and connect them.

  • Add the cost of connecting the two ropes to the total cost.

  • Replace the two shortest ropes with the connected rope.

  • Repeat the above steps until only one rope remains.

  • Return the total cost as the mini...read more

Q4. Ninja And Alternating Largest

Ninja is given a few numbers, and he is being asked to rearrange the numbers so that every second element is greater than its left and right element.

Suppose the given array is [1, ...read more

Ans.

The task is to rearrange the given array such that every second element is greater than its left and right element.

  • Read the number of test cases

  • For each test case, read the number of elements in the array and the array elements

  • Iterate through the array and swap elements at odd indices with their adjacent elements if necessary

  • Check if the rearranged array satisfies the conditions and print 1 if it does, else print 0

Are these interview questions helpful?
Q5. Smallest Number With At least N Trailing Zeros In Factorial

You are given a positive integer N. Your task is to find the smallest number whose factorial contains at least N trailing zeroes.

Example :
Let N = 1. ...read more
Q6. 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

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. 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,
Q8. Kth Smallest and Largest Element of Array

You are given an array β€˜Arr’ consisting of β€˜N’ distinct integers and a positive integer β€˜K’. Find out Kth smallest and Kth largest element of the array. It is guaranteed...read more

Associate Software Engineer Jobs

Sr. Associate Software Engineer-Claims β€’ 5-9 years
Duck Creek Technologies
β€’
4.5
Mumbai
Associate Software Engineer (.Net) β€’ 3-8 years
Maersk Global Service Centres India Pvt. Ltd.
β€’
4.3
Bangalore / Bengaluru
Associate Software Engineer - Embedded Testing β€’ 1-4 years
Maxim India Integrated Circuit Design Pvt Ltd.
β€’
4.4
Bangalore / Bengaluru
Q9. Reverse Linked List

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked li...read more
Frequently asked in, ,
Q10. Check If The String Is A Palindrome

You are given a string 'S'. Your task is to check whether the string is palindrome or not. For checking palindrome, consider alphabets and numbers only and ignore the symbols ...read more

Q11. Add K Nodes

You are given a Singly Linked List of integers and an integer 'K'.

Your task is to modify the linked list by inserting a new node after every 'K' node in the linked list with the node value being equ...read more

Q12. Longest Common Prefix After Rotation

You are given two strings 'A' and 'B' where string 'A' is fixed. But you can perform left shift operations on string B any number of times.

Your task is to find out the minim...read more

Ans.

The question asks to find the minimum number of left shift operations required to obtain the longest common prefix of two given strings.

  • Perform left shift operations on string B to find the longest common prefix with string A

  • Count the number of left shift operations required to obtain the longest common prefix

  • Return the minimum number of left shift operations for each test case

Q13. Tiling Problem

You have been given a board where there are '2' rows and 'N' columns. You have an infinite supply of 2x1 tiles, and you can place a tile in the following ways:

1. Horizontally as 1x2 tile 2. Verti...read more
Q14. Pair Sum

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

Note:

Each pair shou...read more
Q15. Combination Sum

You have been given three numbers β€˜X’, ’Y’ and β€˜Z’. You have to find the sum of all the numbers formed by the combination of the digits 3, 4 and 5. You can use 3 at most β€˜X’ times, 4 at most β€˜Y’ ...read more

Q16. Equilibrium Index

You are given an array Arr consisting of N integers. You need to find the equilibrium index of the array.

An index is considered as an equilibrium index if the sum of elements of the array to t...read more

Q17. First Repeated Character

You are given a string 'STR' of lowercase English alphabets. You need to find the repeated character present first in the string.

Example:
If the string is: β€œabccba”, then the first repe...read more
Q18. Puzzle Question

Which number would replace the underline marked in the series 20, 40,100, ...., 820?

Q19. Balanced parentheses

Given an integer β€˜N’ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.

Note :

Conditi...read more
Q20. Chocolate Problem

Given an array/list of integer numbers 'CHOCOLATES' of size 'N', where each value of the array/list represents the number of chocolates in the packet. There are β€˜M’ number of students and the t...read more

Q21. Middle Of Linked List

Given the head node of the singly linked list, return a pointer pointing to the middle of the linked list.

If there are an odd number of elements, return the middle element if there are ev...read more

Q22. One of the questions for Critical Reasoning was:- Two cars A and B cross a flyover in 10 minutes and 30 minutes respectively. Find the speed of Car A. Statements: Car B travels at the 50kmph Train A and B are t...

read more
Ans.

Car A's speed is 90kmph

  • Use the formula: Speed = Distance/Time

  • Assume the distance to be the same for both cars

  • Calculate Car A's time using the given information

  • Substitute the values in the formula to get Car A's speed

Q23. Sub Sort

You are given an integer array β€˜ARR’. You have to find the length of the shortest contiguous subarray such that, if you sort this subarray in ascending order, then the whole array will be sorted in asce...read more

Ans.

The question asks to find the length of the shortest contiguous subarray that needs to be sorted in order to sort the whole array.

  • Iterate through the array and find the first element that is out of order from the left side.

  • Iterate through the array and find the first element that is out of order from the right side.

  • Find the minimum and maximum element within the subarray from the above steps.

  • Expand the subarray from both sides until all elements within the subarray are in the...read more

Q24. Longest Path In Directed Graph

You are given a Weighted Directed Acyclic Graph (DAG) consisting of β€˜N’ nodes and β€˜E’ directed edges. Nodes are numbered from 0 to ’N’-1. You are also given a source node β€˜Src’ in ...read more

Q25. Largest BST subtree

You are given a binary tree with 'N' nodes. Your task is to return the size of the largest subtree of the binary tree which is also a BST.

A binary search tree (BST) is a binary tree data str...read more

Q26. Prime time again

You have been given two integers β€˜DAY_HOURS’ and β€˜PARTS’. Where β€˜DAY_HOURS’ is the number of hours in a day and a day can be divided into β€˜PARTS’ equal parts. Your task is to find total instance...read more

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

Q28. Longest Palindromic Substring

Given a string ’S’ consisting of lower case English letters, you are supposed to return the longest palindromic substring of β€˜S’.

Note that in case of more than one longest palindro...read more

Q29. N-th Term Of GP

You are given the first term (A), the common ratio (R) and an integer N. Your task is to find the Nth term of the GP series.

The general form of a GP(Geometric Progression) series is A, A(R), A(R...read more

Q30. Detect and Remove Loop

Given a singly linked list, you have to detect the loop and remove the loop from the linked list, if present. You have to make changes in the given linked list itself and return the update...read more

Q31. Infix To Postfix

You are given a string EXP which is a valid infix expression. Convert the given infix expression to postfix expression.

Infix expression is of the form a op b. Where operator is is between the o...read more

Q32. 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, ,
Q33. 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,
Q34. Decode String

You have been given an encoded string. Your task is to decode it back to the original string.

- An encoded string will be of the form [encoded_string], where the 'encoded_string' inside the square ...read more
Q35. 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

Q36. Longest Increasing Subsequence

For a given array with N elements, you need to find the length of the longest subsequence from the array such that all the elements of the subsequence are sorted in strictly increa...read more

Q37. Ninja and substrings

Ninja has been given a string 'STR' containing only lowercase alphabetic characters. Ninja has to find the number of all the different possible substrings of size two that appear in 'STR' as...read more

Ans.

The task is to find all the different possible substrings of size two that appear in a given string as contiguous substrings.

  • Iterate through the string and extract substrings of size two

  • Store the substrings in an array

  • Return the array of substrings

Q38. Question 2 was, Find the sum of all numbers in range from 1 to m(both inclusive) that are not divisible by n. Return difference between sum of integers not divisible by n with sum of numbers divisible by n.

Ans.

Find sum of numbers in range 1 to m (both inclusive) not divisible by n. Return difference between sum of non-divisible and divisible numbers.

  • Iterate through range 1 to m and check if number is divisible by n.

  • If not divisible, add to sum of non-divisible numbers.

  • If divisible, add to sum of divisible numbers.

  • Return difference between sum of non-divisible and divisible numbers.

Q39. Implement a priority queue

Ninja is given a task to implement a priority queue using Heap data structure. The Ninja is busying preparing for the tournament., So he asked for your help.

Your task is to use the cl...read more

Q40. Bipartite Graph

Given a graph, check whether the graph is bipartite or not. Your function should return true if the given graph's vertices can be divided into two independent sets, β€˜U’ and β€˜V’ such that every ed...read more

Ans.

The function checks whether a given graph is bipartite or not.

  • A bipartite graph can be divided into two independent sets such that every edge connects a vertex from one set to the other.

  • We can use graph coloring algorithm to check if the graph is bipartite.

  • Start by coloring the first vertex with one color and all its neighbors with the other color.

  • Continue coloring the remaining vertices, making sure that no adjacent vertices have the same color.

  • If at any point, we find that ...read more

Q41. Constellation

Given a matrix β€˜UNIVERSE’ with 3 rows and β€˜N’ columns, with the characters { # , * , . } and these characters represent a cluster of stars and galaxies in space. Stars are represented by β€˜*’ symbol...read more

Q42. First unique character in a string

You are given a string S of length N. Your task is to find the index(considering 1-based indexing) of the first unique character present in the string. If there are no unique c...read more

Q43. 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,
Q44. Remove Vowels from a given string

You are given a string STR of length N. Your task is to remove all the vowels present in that string and print the modified string.

English alphabets β€˜a’, β€˜e’, β€˜i’, β€˜o’, β€˜u’ are...read more

Q45. Replace Spaces

You have been given a string 'STR' of words. You need to replace all the spaces between words with β€œ@40”.

Input Format:
The first line contains a single integer β€˜T’ representing the number of test...read more
Q46. Swap Two Numbers

Take two numbers as input and swap them and print the swapped values.

Input Format:
The first line of input contains a single integer 't', representing the total number of test cases. The second...read more
Q47. Stack using queue

Implement a Stack Data Structure specifically to store integer data using two Queues.

There should be two data members, both being Queues to store the data internally. You may use the inbuilt Q...read more

Q48. Colorful Knapsack

You are given 'N' stones labeled from 1 to 'N'. The 'i-th' stone has the weight W[i]. There are 'M' colors labeled by integers from 1 to 'M'. The 'i-th' stone has the color C[i] which is an int...read more

Q49. DFS Traversal

Given an undirected and disconnected graph G(V, E), containing 'V' vertices and 'E' edges, the information about edges is given using 'GRAPH' matrix, where i-th edge is between GRAPH[i][0] and GRAP...read more

Ans.

The question asks to print the DFS traversal of an undirected and disconnected graph.

  • Implement a Depth First Search (DFS) algorithm to traverse the graph.

  • Use a visited array to keep track of visited vertices.

  • For each unvisited vertex, start a DFS traversal and print the connected component.

  • Sort the vertices of each connected component in ascending order before printing.

Q50. Second largest element in the array

You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

Note:
a) Duplicate elements may be present. b) If no...read more
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.8
Β β€’Β 4.6k Interviews
3.6
Β β€’Β 3.7k Interviews
3.7
Β β€’Β 791 Interviews
3.4
Β β€’Β 771 Interviews
3.8
Β β€’Β 513 Interviews
4.0
Β β€’Β 468 Interviews
4.0
Β β€’Β 344 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

Associate 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