Associate Software Engineer
400+ Associate Software Engineer Interview Questions and Answers for Freshers
Popular Companies
Q51. Colorful Knapsack Problem
You are given a set of 'N' stones, each with a specific weight and color. The goal is to fill a knapsack with exactly 'M' stones, choosing one stone of each color, so that the total we...read more
The goal is to fill a knapsack with exactly 'M' stones, one of each color, minimizing unused capacity.
Iterate through stones, keeping track of weights for each color
Sort stones by weight and color, then select one stone of each color
Calculate total weight for each combination and minimize unused capacity
If knapsack cannot be filled, return -1
Q52. Group Anagrams Problem Statement
Given an array or list of strings called inputStr
, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one another.
An...read more
Group anagrams in an array of strings based on their characters.
Iterate through the array of strings and sort each string to create a key for grouping anagrams.
Use a hashmap to store the sorted string as key and the list of anagrams as values.
Return the values of the hashmap as the grouped anagrams.
Q53. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element.
Merge the sorted halves to produce a completely sorted array.
Time complexity of Merge Sort is O(n log n).
Example: Input: [3, 1, 4, 1, 5], Output: [1, 1, 3, 4, 5]
Q54. Rotting Oranges Problem Statement
You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:
- 0 - representing an empty cell
- 1 - representing a fresh orange...read more
Find the minimum time required to rot all fresh oranges in a grid.
Iterate through the grid to find rotten oranges and their adjacent fresh oranges
Use BFS or DFS to simulate the rotting process and track the time taken
Return the minimum time taken to rot all fresh oranges or -1 if not possible
Q55. Postfix Expression Evaluation Problem Statement
Given a postfix expression, your task is to evaluate the expression. The operator will appear in the expression after the operands. The output for each expression...read more
Q56. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
The task is to determine the total number of ways to make change for a specified value using given denominations.
Create a dynamic programming table to store the number of ways to make change for each value up to the target value.
Iterate through each denomination and update the table accordingly.
The final answer will be the value in the table at the target value.
Consider edge cases such as when the target value is 0 or when there are no denominations available.
Share interview questions and help millions of jobseekers 🌟
Q57. 2) Can you call the base class method without creating an instance?
Yes, by using the super() method in the derived class.
super() method calls the base class method
Derived class must inherit from the base class
Example: class Derived(Base): def method(self): super().method()
Q58. Gas Station Tour Problem
You are presented with a circular track consisting of several petrol pumps. Each petrol pump is indexed from 0 to N-1 and offers certain attributes:
- The quantity of petrol available at...read more
The Gas Station Tour Problem involves finding the first petrol pump from which a truck can start its journey and complete a circular track.
Calculate the difference between petrol available and distance to the next pump at each station.
If the total sum of differences is negative, a full circle is not possible.
If the total sum of differences is positive, the starting index is the first station where the cumulative sum becomes positive.
Associate Software Engineer Jobs
Q59. Search in a 2D Matrix
Given a 2D matrix MAT
of size M x N, where M and N represent the number of rows and columns respectively. Each row is sorted in non-decreasing order, and the first element of each row is g...read more
Implement a function to search for a given integer in a 2D matrix with specific properties.
Iterate through each row of the matrix and perform a binary search on each row to find the target integer.
Since the rows are sorted, binary search can be applied efficiently to determine if the target exists in the matrix.
Handle edge cases such as empty matrix or invalid input values.
Return 'TRUE' if the target is found in the matrix, otherwise return 'FALSE'.
Q60. What are interrupts? Explain in detail what happens in 8051 when there is interrupt, What happens when there is an interrupt within an interrupt?
Interrupts are signals that temporarily halt the execution of a program to handle a specific event.
When an interrupt occurs in 8051, the program counter is saved on the stack and the interrupt service routine (ISR) is executed.
The ISR handles the interrupt and then returns control to the main program by restoring the program counter from the stack.
If an interrupt occurs while another interrupt is being serviced, the second interrupt is queued and handled after the first one i...read more
Q61. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Q62. 5) What are access specifiers and what is their significance?
Access specifiers define the level of access to class members. They ensure encapsulation and data hiding in object-oriented programming.
Access specifiers are keywords used in class definitions to specify the access level of class members.
There are three access specifiers in C++: public, private, and protected.
Public members can be accessed from anywhere in the program, while private members can only be accessed within the class.
Protected members can be accessed within the cla...read more
Q63. Concatenate the Largest Digit Problem
You are given three non-zero numbers 'A', 'B', and 'C'. Your task is to determine the number created by concatenating the largest digit found in each number, in the sequenc...read more
Concatenate the largest digit from three numbers in sequence to form a new number.
Find the largest digit in each number 'A', 'B', and 'C'.
Concatenate the largest digits in the sequence 'A', 'B', and 'C' to form a new number.
Return the concatenated number as the output.
Q64. Character Counting Challenge
Create a program that counts and prints the total number of specific character types from user input. Specifically, you need to count lowercase English alphabets, numeric digits (0-...read more
Create a program to count lowercase alphabets, digits, and white spaces in user input until '$' is encountered.
Read characters from input stream until '$' is encountered
Count lowercase alphabets, digits, and white spaces separately
Print the counts of each character type as three integers separated by spaces
Q65. Longest Increasing Subsequence Problem Statement
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more
Find the length of the longest strictly increasing subsequence in an array of integers.
Use dynamic programming to keep track of the length of the longest increasing subsequence ending at each element.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum length found in the dynamic programming array as the result.
Q66. Ninja and Alien Language Order Problem
An alien dropped its dictionary while visiting Earth. The Ninja wants to determine the order of characters used in the alien language, based on the given list of words fro...read more
Determine the order of characters in an alien language based on a list of words from the alien's dictionary.
Create a graph data structure to represent the relationships between characters in the words.
Perform a topological sort on the graph to find the order of characters.
Handle cases where there is no valid order by returning an empty string.
Q67. Find the Second Largest Element
Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.
If a second largest element does not exist, return -1.
Example:
Input:
ARR = [2, 4, 5, 6, ...read more
Find the second largest element in an array of integers.
Iterate through the array to find the largest and second largest elements.
Handle cases where all elements are identical.
Return -1 if a second largest element does not exist.
Q68. Stack using Two Queues Problem Statement
Develop a Stack Data Structure to store integer values using two Queues internally.
Your stack implementation should provide these public functions:
Explanation:
1. Cons...read more
Implement a stack using two queues to store integer values with specified functions.
Use two queues to simulate stack operations efficiently.
Maintain the top element in one of the queues for easy access.
Handle push, pop, top, size, and isEmpty functions as specified.
Ensure proper error handling for empty stack scenarios.
Optimize the implementation to achieve desired time complexity.
Example: Push 42, pop top element (42), push 17, top element is 17.
Q69. Find 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 in the string. If there are no unique ch...read more
Find the index of the first unique character in a given string, return -1 if no unique characters are found.
Iterate through the string to count the frequency of each character
Iterate through the string again to find the first character with frequency 1
Return the index of the first unique character or -1 if none found
Q70. How login page working (as in one of my project) and what is function of java script in your login page describe the process. There was cross question also whatever I was speaking. Also suggested me to attend c...
read moreThe login page uses JavaScript to validate user input and authenticate credentials.
JavaScript is used to validate user input before submitting to the server
The server then checks the credentials against a database
If the credentials are valid, the user is redirected to the home page
If the credentials are invalid, an error message is displayed
Coding challenges can help improve problem-solving skills
Q71. Write a code for the length of string without using strlen() function.
Code to find length of string without using strlen() function.
Use a loop to iterate through each character of the string
Increment a counter variable for each character in the string
Stop the loop when the null character '\0' is encountered
Return the counter variable as the length of the string
Q72. What are Von Neumann and Harvard classifications, which does 8051 belong to?
Von Neumann and Harvard are computer architecture classifications. 8051 belongs to Harvard architecture.
Von Neumann architecture has a single memory space for data and instructions, while Harvard architecture has separate memory spaces for data and instructions.
8051 microcontroller uses Harvard architecture as it has separate memory spaces for program instructions and data.
Harvard architecture allows simultaneous access to both program memory and data memory, which increases ...read more
Q73. What are the advantages of python over other programming languages?
Python is a versatile language with easy syntax, vast libraries, and cross-platform compatibility.
Python has a simple and readable syntax, making it easy to learn and write code quickly.
Python has a vast collection of libraries and frameworks for various purposes, such as web development, data analysis, and machine learning.
Python is cross-platform compatible, meaning that code written on one platform can run on another without modification.
Python has a large and active commu...read more
Join tables on employee ID, filter by balance less than 200, select employee names.
Join tables on employee ID attribute
Filter rows where balance is less than 200
Select employee names from the result
Questions related to teamwork, problem-solving, adaptability, and communication skills can help determine if you fit into our company culture.
How do you handle working in a team environment?
Can you provide an example of a time when you had to solve a complex problem?
How do you adapt to changes in a fast-paced work environment?
Describe a situation where effective communication was crucial in a project.
Q76. Why java is known as platform independent language?
Java is platform independent because it uses the concept of bytecode and virtual machine.
Java code is compiled into bytecode, which is a platform-independent representation of the code.
The bytecode is then executed by the Java Virtual Machine (JVM), which is specific to each platform.
This allows Java programs to run on any platform that has a compatible JVM.
The JVM acts as an interpreter, translating the bytecode into machine code that can be executed by the underlying hardwa...read more
Q77. Where is the location of current line of execution stored when there is an interrupt?
The location of current line of execution is stored in the stack when there is an interrupt.
When an interrupt occurs, the processor saves the current state of execution on the stack.
The location of the current line of execution is stored in the program counter (PC) register.
The PC register is pushed onto the stack along with other registers.
After the interrupt is serviced, the processor pops the saved state from the stack and resumes execution from the PC value.
Design a system similar to Splitwise and suggest three features for improvement.
Implement a real-time notification system for updates on shared expenses
Integrate a feature for automatic currency conversion for international transactions
Enhance the user interface with data visualization tools for better expense tracking
Q79. 3) What is call by value and call hy refarance?
Call by value and call by reference are two ways of passing arguments to a function.
Call by value passes a copy of the argument value to the function.
Call by reference passes a reference to the memory location of the argument.
Call by value is used for simple data types like int, float, etc.
Call by reference is used for complex data types like arrays, structures, etc.
Q80. 4. Difference Between a stack and a queue , what is a linked list.
A stack is a data structure that follows Last-In-First-Out (LIFO) principle, while a queue follows First-In-First-Out (FIFO) principle. A linked list is a linear data structure where each element is a separate object with a pointer to the next element.
Stack is like a stack of plates, where the last plate added is the first one to be removed. Example: undo-redo functionality in a text editor.
Queue is like a queue of people waiting in line, where the first person added is the f...read more
Q81. What are fundamental pillars of OOPS programming. Explain each of them in detail.
The fundamental pillars of OOPS programming are encapsulation, inheritance, and polymorphism.
Encapsulation: It is the process of hiding the internal details of an object and providing a public interface for interacting with it.
Inheritance: It allows creating new classes by inheriting properties and behaviors from existing classes, promoting code reuse.
Polymorphism: It enables objects of different classes to be treated as objects of a common superclass, providing flexibility a...read more
Q82. What is the difference between the list & array in python?
Lists and arrays in Python are both used to store multiple values, but they have some key differences.
Lists can store elements of different data types, while arrays can only store elements of the same data type.
Lists are dynamic in size, meaning they can grow or shrink as needed, while arrays have a fixed size.
Lists have built-in methods for manipulation and iteration, while arrays require the use of external libraries like NumPy for similar functionality.
Q83. Given a list of custom class objects. Write a program to sort that list based on one of its properties.
Sort a list of custom class objects based on one of its properties.
Use a sorting algorithm like bubble sort, insertion sort, or merge sort.
Implement a comparison function to compare the desired property of the objects.
Apply the sorting algorithm to the list of objects using the comparison function.
Q84. Draw the block diagram, and explain all the components of 8051 micro-controller
The 8051 micro-controller consists of CPU, RAM, ROM, Timers, Serial Port, Interrupts, and I/O ports.
The CPU is the main processing unit of the micro-controller.
The RAM is used for storing data temporarily.
The ROM contains the program code that is executed by the CPU.
The Timers are used for generating precise time delays.
The Serial Port is used for communication with other devices.
The Interrupts are used for handling external events.
The I/O ports are used for interfacing with ...read more
Q85. How to maintain relation between the broken tables if at all i require breaking?
Maintain relation between broken tables by using foreign keys and cascading updates/deletes.
Use foreign keys to establish relationships between tables
Use cascading updates/deletes to maintain referential integrity
Avoid breaking tables unnecessarily
Consider using a database management system that supports transactions
Test thoroughly to ensure data consistency
Q86. What are joins in SQL? Explain all the join with their real world application.
Joins in SQL are used to combine data from two or more tables based on a related column.
Inner join returns only the matching rows from both tables.
Left join returns all the rows from the left table and matching rows from the right table.
Right join returns all the rows from the right table and matching rows from the left table.
Full outer join returns all the rows from both tables.
Real world applications include combining customer and order data, employee and salary data, and p...read more
Q87. What are the building blocks of object oriented programming? Explain in detail.
Building blocks of OOP include encapsulation, inheritance, and polymorphism.
Encapsulation: bundling data and methods that operate on that data within a single unit
Inheritance: creating new classes from existing ones, inheriting their properties and methods
Polymorphism: ability of objects to take on many forms, allowing for flexibility and extensibility
Examples: class, object, method, constructor, interface, abstract class
Q88. What are the constructors in python? Explain in detail about their functionality.
Constructors in Python are special methods used to initialize objects. They are called automatically when an object is created.
Constructors have the same name as the class they belong to.
They are defined using the __init__() method.
Constructors can take arguments to initialize instance variables.
If a class does not have a constructor, Python provides a default constructor.
Constructors can also be used to perform any other setup tasks needed for the object.
Q89. Which is the primary key in the table(I had constructed a single table)?
The primary key in a table uniquely identifies each row in the table.
Primary key is a column or a combination of columns that uniquely identifies each row in a table
Primary key values cannot be null or duplicate
Primary key is used to establish relationships between tables
Examples of primary keys are social security number, email address, and employee ID
Q90. 2. You have two gallons of capacity 12 liters and 5 liters. How can you pour exactly 9liters of water into 12 liters gallon.
To pour exactly 9 liters of water into a 12-liter gallon using 5 and 3-liter gallons.
Fill the 5-liter gallon and pour it into the 12-liter gallon.
Fill the 5-liter gallon again and pour it into the 12-liter gallon until it is full, leaving 1 liter in the 5-liter gallon.
Empty the 12-liter gallon and pour the remaining 1 liter from the 5-liter gallon into it.
Fill the 5-liter gallon again and pour it into the 12-liter gallon to get exactly 9 liters.
Q91. Given an input string, remove spaces and give me output string
Remove spaces from input string and return output string
Iterate through each character of the input string
If the character is not a space, add it to the output string
Return the output string
Q92. & at last What is index in SQL? What are their types?
Indexes in SQL are used to improve query performance by allowing faster data retrieval.
Indexes are data structures that provide quick access to data in a table.
They are created on one or more columns of a table.
Types of indexes include clustered, non-clustered, unique, and full-text indexes.
Clustered indexes determine the physical order of data in a table, while non-clustered indexes are separate structures that point to the data.
Unique indexes ensure that each value in the i...read more
Q93. Is there any destructor in python? If yes then what is that destructor?
Yes, Python has a destructor called __del__()
The __del__() method is called when an object is about to be destroyed
It is used to perform cleanup operations before the object is destroyed
The __del__() method is not guaranteed to be called in all cases
Q94. What is meant by slicing the list? What is its syntax?
Slicing a list means extracting a portion of the list. Syntax: list[start:end:step]
Start index is inclusive, end index is exclusive
If start is not specified, it defaults to 0
If end is not specified, it defaults to the end of the list
If step is not specified, it defaults to 1
Negative indices count from the end of the list
Promises in JavaScript represent the eventual completion or failure of an asynchronous operation.
Promises are objects that represent the eventual completion or failure of an asynchronous operation.
They have three states: pending, fulfilled, or rejected.
A pending promise is one that is not yet settled, a fulfilled promise is one that has been resolved successfully, and a rejected promise is one that has encountered an error.
Promises are commonly used for handling asynchronous ...read more
Q96. How many types of values exist in python? Tell me their names.
Python has four types of values: integers, floating-point numbers, strings, and booleans.
Integers are whole numbers, positive or negative, such as 5 or -10.
Floating-point numbers are decimal numbers, such as 3.14 or -2.5.
Strings are sequences of characters, enclosed in single or double quotes, such as 'hello' or "world".
Booleans are either True or False, used for logical operations.
Q97. 4) How does C++ support Polymorphism?
C++ supports polymorphism through virtual functions and inheritance.
Polymorphism allows objects of different classes to be treated as if they were of the same class.
Virtual functions are declared in the base class and overridden in the derived class.
Dynamic binding is used to determine which function to call at runtime.
Examples include function overriding, templates, and operator overloading.
Q98. What is global variable & local variable in python? When it is used?
Global and local variables are used in Python to store values. Global variables can be accessed from anywhere in the code, while local variables are only accessible within a specific function.
Global variables are declared outside of any function and can be accessed from anywhere in the code
Local variables are declared within a function and can only be accessed within that function
Global variables can be modified from within a function using the 'global' keyword
Local variables...read more
Q99. What Split() & Join() method? Why & where it is used?
Split() & Join() are string methods used to split a string into an array and join an array into a string respectively.
Split() method is used to split a string into an array of substrings based on a specified separator.
Join() method is used to join the elements of an array into a string using a specified separator.
Both methods are commonly used in data processing and manipulation tasks.
Example: var str = 'apple,banana,orange'; var arr = str.split(','); // ['apple', 'banana', '...read more
Q100. Why Mphasis? What do you know about us?
Mphasis is a leading IT solutions provider with a focus on digital transformation.
Mphasis has a strong presence in the banking and financial services industry, providing innovative solutions to clients such as Citibank and Standard Chartered.
The company has a focus on digital transformation and offers services such as cloud computing, data analytics, and artificial intelligence.
Mphasis has won several awards for its work in the IT industry, including the NASSCOM Customer Serv...read more
Interview Questions of Similar Designations
Top Interview Questions for Associate 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