Software Engineer Trainee
90+ Software Engineer Trainee Interview Questions and Answers for Freshers
Q1. Palindromic Linked List Problem Statement
Given a singly linked list of integers, determine if it is a palindrome. Return true if it is a palindrome, otherwise return false.
Example:
Input:
1 -> 2 -> 3 -> 2 -> ...read more
Q2. 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
Q3. Slot Game Problem Statement
You are given a slot machine with four slots, each containing one of the colors Red (R), Yellow (Y), Green (G), or Blue (B). You must guess the colors without prior knowledge. For ea...read more
Q4. Maximum Level Sum in a Binary Tree
Given a Binary Tree with integer nodes, determine the maximum level sum among all the levels in the tree. The sum for a level is defined as the sum of all node values present ...read more
Q5. Left Rotations of an Array
Given an array of size N
and Q
queries, each query requires left rotating the original array by a specified number of elements. Return the modified array for each query.
Input:
The fi...read more
Q6. Reverse Linked List Problem Statement
Given a Singly Linked List of integers, your task is to reverse the Linked List by altering the links between the nodes.
Input:
The first line of input is an integer T, rep...read more
Share interview questions and help millions of jobseekers 🌟
Q7. Palindrome Linked List Problem Statement
You are provided with a singly linked list of integers. Your task is to determine whether the given singly linked list is a palindrome. Return true
if it is a palindrome...read more
Q8. Inversion Count Problem
Given an integer array ARR
of size N
with all distinct values, determine the total number of 'Inversions' that exist.
Explanation:
An inversion is a pair of indices (i, j)
such that:
AR...read more
Software Engineer Trainee Jobs
Q9. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Q10. Power Calculation Problem Statement
Given a number x
and an exponent n
, compute xn
. Accept x
and n
as input from the user, and display the result.
Note:
You can assume that 00 = 1
.
Input:
Two integers separated...read more
Q11. N Queens Problem
Given an integer N
, find all possible placements of N
queens on an N x N
chessboard such that no two queens threaten each other.
Explanation:
A queen can attack another queen if they are in the...read more
Q12. Two complement of a number 1001 what is data structures?, types of data structures ? what is maching learning name diff methods used in machine learning basic Java concepts from OOPs as per my interview experie...
read moreThe question covers topics like two's complement, data structures, machine learning, and OOPs concepts in Java.
Two's complement of a number 1001 is -0111.
Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently. Examples include arrays, linked lists, stacks, queues, trees, and graphs.
Machine learning is a subset of artificial intelligence that involves training algorithms to make predictions or decisions based on da...read more
Q14. Develope "To Do List" full fledged Application with modern design including header footer and also implement functionality like 'Add' , 'Edit', 'Delete' and 'View List' within ½ hour of time span of Interview '...
read moreDevelop a 'To Do List' application with modern design and functionality like 'Add', 'Edit', 'Delete', and 'View List' within ½ hour.
Use HTML, CSS, and JavaScript for front-end development
Implement CRUD operations for tasks (Create, Read, Update, Delete)
Design a user-friendly interface with header and footer
Utilize localStorage or backend server for data storage
Q15. What are Hooks in ReactJs and Explain useState, useRef, useEffect Hooks with their usecases?
Hooks are functions that allow us to use state and other React features in functional components.
useState is a hook that allows us to add state to functional components.
useRef is a hook that allows us to create a mutable reference that persists across renders.
useEffect is a hook that allows us to perform side effects in functional components.
useState example: const [count, setCount] = useState(0);
useRef example: const inputRef = useRef(null);
useEffect example: useEffect(() =>...read more
Q18. Software process models? differentiating the waterfall model and the incremental model.
Waterfall model is a linear sequential approach, while incremental model divides the project into small increments.
Waterfall model follows a linear and sequential approach, where each phase must be completed before moving on to the next.
Incremental model divides the project into small increments, with each increment building upon the previous one.
Waterfall model is less flexible to changes, as requirements are finalized early in the process.
Incremental model allows for change...read more
Q21. Write Typescript code from scratch of "Finding maximum length of palindromic substring from the given Strings". Do this question in ½ hour live coding interview.
Finding the maximum length of palindromic substring from an array of strings using Typescript.
Iterate through each string in the array
For each string, iterate through all possible substrings and check if it is a palindrome
Keep track of the maximum length palindrome found
Q22. How can you compose multiple HOCs with render props in a React component
Compose multiple HOCs with render props in a React component
Create a render prop component that accepts a function as a prop
Wrap the render prop component with HOCs
Pass the function as a prop to the HOCs
Use the function to render the component's content
Example: withAuth(withTheme(RenderPropComponent))
Q23. Why is java called the partial OOP concept?
Java is not called the partial OOP concept.
Java is a fully object-oriented programming language.
It supports all the principles of OOP such as encapsulation, inheritance, and polymorphism.
Java allows the creation of classes, objects, and methods to implement OOP concepts.
It provides features like abstraction and encapsulation to achieve data hiding and modularity.
Java also supports interfaces, which are a key component of OOP.
The misconception of Java being a partial OOP conce...read more
Q25. Write a program to print the length of number of permutations if the given input is "123"
Program to print the length of number of permutations of a given input
Use recursion to generate all permutations
Count the number of permutations and print the length
Q26. Swap 2 integers without using 3rd integer
Swap 2 integers without using 3rd integer
Use XOR operator
Addition and subtraction can also be used
Bitwise operations can be used
Q27. > Given an array of n-1 numbers 1<=a[i]<=n. We need to find the number that was missing from the array.
Given an array of n-1 numbers 1<=a[i]<=n, find the missing number.
Calculate the sum of all numbers from 1 to n using the formula n*(n+1)/2
Calculate the sum of all elements in the array
Subtract the sum of array elements from the sum of all numbers to get the missing number
Q28. What are Components and state in ReactJs?
Components are reusable UI elements in ReactJs. State is an object that stores data and controls a component's behavior.
Components are like building blocks that can be combined to create complex UIs
State is used to store and manage data within a component
Changes to state trigger a re-render of the component
State should be kept as minimal as possible to avoid performance issues
Example: A button component can have a state that tracks the number of times it has been clicked
Q30. How to find the reverse of a string of a particular order seperated by dots.
To reverse a string of a particular order separated by dots, split the string into an array, reverse the array, and join it back into a string.
Split the string using the dot separator
Reverse the resulting array
Join the array back into a string using the dot separator
Q31. How to find the year is leap or not using single if condition.
To find leap year using single if condition
Check if year is divisible by 4 and not divisible by 100
Or check if year is divisible by 400
If either of the above conditions is true, then it's a leap year
Q32. Concise code to add two strings such as str1="1234" and str2="8765".
Use concatenation operator to add two strings.
Use '+' operator to concatenate two strings.
Example: str1 + str2 will result in '12348765'.
Q33. What is Distinct keyword in SQL ?
Distinct keyword in SQL is used to retrieve unique values from a column in a table.
Distinct keyword eliminates duplicate rows from the result set
It is often used in conjunction with SELECT statement
Example: SELECT DISTINCT column_name FROM table_name
Q34. Built a simple web application to store the data and show it to the browser
I would use a combination of HTML, CSS, and JavaScript to create a simple web application that stores and displays data.
Use HTML to create the structure of the web application
Use CSS to style the elements on the page
Use JavaScript to handle user interactions and store/retrieve data
Consider using a backend server (e.g. Node.js) to handle data storage and retrieval
Utilize AJAX to fetch data from the server asynchronously
Q35. Explain setTimeout, setImmediate and process.nextTick ?
setTimeout, setImmediate and process.nextTick are Node.js functions used for asynchronous programming.
setTimeout is used to execute a function after a specified amount of time has passed.
setImmediate is used to execute a function immediately after the current event loop iteration.
process.nextTick is used to execute a function at the beginning of the next event loop iteration.
setTimeout and setImmediate are similar, but setImmediate has higher priority in the event loop.
proces...read more
Q36. What Algorithm you used in your Project?
I used the Dijkstra's algorithm for finding the shortest path in my project.
Implemented Dijkstra's algorithm to find the shortest path between nodes in a graph
Used priority queue to optimize the algorithm
Considered edge weights and node distances while calculating the shortest path
Q37. What is life cycle in ReactJS ?
ReactJS life cycle refers to the series of methods that are invoked in the process of creating, updating and destroying a component.
ReactJS life cycle consists of three phases: Mounting, Updating and Unmounting.
Mounting phase includes methods like constructor, render, componentDidMount.
Updating phase includes methods like shouldComponentUpdate, render, componentDidUpdate.
Unmounting phase includes method componentWillUnmount.
These methods help in managing the state and props o...read more
Q38. code snippets on note pad. eg reverse string
Reverse a string using array manipulation
Create an array of characters from the input string
Use a loop to iterate through the array in reverse order
Append each character to a new string to form the reversed string
Q39. What is the difference between method overloading and overwriting?
Method overloading involves multiple methods in the same class with the same name but different parameters. Method overriding involves a subclass providing a specific implementation of a method that is already provided by its superclass.
Method overloading is achieved within the same class by having multiple methods with the same name but different parameters.
Method overriding occurs in a subclass that provides a specific implementation of a method that is already provided by ...read more
Q40. Purpose of getDerivedStateFromProps() and getSnapshotBeforeUpdate() Lifecyle method?
getDerivedStateFromProps() updates state based on props changes. getSnapshotBeforeUpdate() captures current state before update.
getDerivedStateFromProps() is called before rendering and updates state based on changes in props.
getSnapshotBeforeUpdate() is called after rendering but before updating the DOM. It captures current state before update.
getDerivedStateFromProps() is a static method and should return an object to update state or null to indicate no update.
getSnapshotBe...read more
Q41. What is Integrity Constraints ?
Integrity constraints are rules that ensure data integrity and consistency in a database.
Integrity constraints are used to enforce business rules or data quality rules in a database.
They can include rules such as unique constraints, foreign key constraints, and check constraints.
Unique constraints ensure that no two rows have the same value in a specified column.
Foreign key constraints enforce referential integrity by ensuring that values in one table match values in another ...read more
Q42. What is inheritance and encapsulation?
Inheritance is a mechanism where a new class is derived from an existing class. Encapsulation is the process of hiding implementation details from the user.
Inheritance allows the new class to inherit properties and methods of the existing class.
Encapsulation helps in achieving data abstraction and security.
Inheritance promotes code reusability while encapsulation promotes data security.
Example of inheritance: class Car extends Vehicle
Example of encapsulation: private variable...read more
Q43. Write code for merging two shorted Arrays.
Code to merge two sorted arrays
Create a new array to store the merged result
Use two pointers to iterate through both arrays and compare elements
Add the smaller element to the new array and move the pointer for that array
Q44. Definitions and example code of OOPS Concepts
OOPS Concepts are fundamental principles of Object-Oriented Programming.
Encapsulation - bundling of data and methods that operate on that data
Inheritance - ability of a class to inherit properties and methods from its parent class
Polymorphism - ability of objects to take on multiple forms
Abstraction - hiding of complex implementation details from the user
Example code: class Car { private String make; public void setMake(String make) { this.make = make; } }
Q45. Explain Local Storage, Session Storage, cache in Web development
Local Storage, Session Storage, and Cache are used to store data in the browser for faster access and better user experience.
Local Storage: stores data with no expiration date and can be accessed across multiple windows and tabs
Session Storage: stores data for a single session and is cleared when the session ends
Cache: stores data temporarily to reduce server load and improve performance
Examples: storing user preferences, caching images and scripts for faster page load
Q46. Why do we need databases?
Databases are essential for storing, organizing, and retrieving large amounts of data efficiently.
Databases provide a structured way to store and manage data.
They allow for efficient retrieval of data through queries.
Databases can handle large amounts of data and ensure data integrity.
They enable multiple users to access and modify data simultaneously.
Examples include MySQL, Oracle, MongoDB, and SQL Server.
Q47. Do you know about GraphQL?
GraphQL is a query language for APIs and a runtime for executing those queries.
GraphQL allows clients to request only the data they need.
It provides a single endpoint for all data fetching.
GraphQL schemas define the types of data that can be queried.
Q48. What are high order functions?
High order functions are functions that can take other functions as arguments or return functions as results.
High order functions can accept functions as parameters.
High order functions can return functions as output.
Examples include map, filter, and reduce functions in JavaScript.
Q49. Are open to sign a bond ?
Yes, I am open to signing a bond.
Signing a bond shows commitment and dedication to the company.
It may involve a financial agreement or a commitment to work for a certain period of time.
Signing a bond can provide opportunities for professional growth and development.
Examples of bonds include training bonds, service bonds, or employment bonds.
Q50. Write one async wait function code.
Async wait function code example
Use async/await keywords in the function declaration
Use setTimeout to simulate asynchronous operation
Return a Promise that resolves after a specified time
Interview Questions of Similar Designations
Top Interview Questions for Software Engineer Trainee 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