Software Engineer Trainee

100+ Software Engineer Trainee Interview Questions and Answers for Freshers

Updated 13 Jul 2025
search-icon
2w ago

Q. Write a program to print the length of the number of permutations if the given input is "123".

Ans.

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

Asked in Tagit Pte

2w ago

Q. What are the features of Java 8 that you are familiar with?

Ans.

Java 8 features include lambda expressions, functional interfaces, streams, and default methods.

  • Lambda expressions allow you to write code in a more concise and readable way.

  • Functional interfaces are interfaces with a single abstract method, used for lambda expressions.

  • Streams provide a way to work with sequences of elements and perform operations like filter, map, and reduce.

  • Default methods allow interfaces to have method implementations.

  • Example: (1) Lambda expression - (a, ...read more

Asked in Nihilent

1d ago

Q. How can you swap two integers without using a third variable?

Ans.

Swap 2 integers without using 3rd integer

  • Use XOR operator

  • Addition and subtraction can also be used

  • Bitwise operations can be used

Q. Given an array of n-1 numbers where 1<=a[i]<=n, how do you find the missing number from the array?

Ans.

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

Are these interview questions helpful?

Asked in DigiBoxx

5d ago

Q. What are components and state in ReactJS?

Ans.

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

Asked in HSBC Group

1w ago
Q. What are private and special IP addresses?
Ans.

Private and special IP addresses are reserved ranges of IP addresses used for specific purposes.

  • Private IP addresses are used within a private network and are not routable on the internet.

  • Special IP addresses include loopback address (127.0.0.1) and broadcast address (255.255.255.255).

  • Private IP ranges include 10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255, and 192.168.0.0 to 192.168.255.255.

Software Engineer Trainee Jobs

Williams Lea logo
Software Engineer Trainee 0-1 years
Williams Lea
3.6
Chennur
Academian logo
Trainee Software Engineer 3-8 years
Academian
4.1
Pune
Academian logo
Trainee Software Engineer ( A PLUS ) 0-1 years
Academian
4.1
Pune
5d ago

Q. How can you determine if a year is a leap year using a single if condition?

Ans.

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

1w ago

Q. How do you reverse a string with elements separated by dots?

Ans.

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

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in DEVtrust

2w ago

Q. What is the DISTINCT keyword in SQL?

Ans.

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

Asked in Monotype

1w ago

Q. Describe how you would build a simple web application to store data and display it in a browser.

Ans.

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

Asked in Tagit Pte

2d ago

Q. What are the key Object-Oriented Programming (OOP) concepts in Java?

Ans.

Key OOP concepts in Java include classes, objects, inheritance, polymorphism, encapsulation, and abstraction.

  • Classes: Blueprint for creating objects, containing attributes and methods.

  • Objects: Instances of classes that encapsulate data and behavior.

  • Inheritance: Allows a class to inherit attributes and methods from another class.

  • Polymorphism: Ability to present the same interface for different data types.

  • Encapsulation: Bundling data and methods that operate on the data into a ...read more

2w ago
Q. Define the 7 different layers of the OSI Reference Model.
Ans.

The OSI Reference Model defines 7 layers that represent different functions in networking.

  • Physical Layer - deals with physical connections and signals (e.g. cables, hubs)

  • Data Link Layer - manages data transfer between devices on the same network (e.g. Ethernet)

  • Network Layer - handles routing and forwarding of data packets (e.g. IP)

  • Transport Layer - ensures reliable data delivery (e.g. TCP)

  • Session Layer - establishes, maintains, and terminates connections (e.g. SSL)

  • Presentatio...read more

Asked in DigiBoxx

2w ago

Q. Explain setTimeout, setImmediate, and process.nextTick.

Ans.

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

Asked in Locus Elite

2d ago

Q. Write concise code to add two strings, such as str1="1234" and str2="8765".

Ans.

Use concatenation operator to add two strings.

  • Use '+' operator to concatenate two strings.

  • Example: str1 + str2 will result in '12348765'.

Asked in TCS

2w ago

Q. What is the difference between method overloading and method overriding?

Ans.

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

Asked in DigiBoxx

2w ago

Q. What algorithm did you use in your project?

Ans.

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

Asked in DigiBoxx

2w ago

Q. What is the life cycle in ReactJS?

Ans.

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

1w ago

Q. Write code snippets on notepad to, for example, reverse a string.

Ans.

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

Asked in Float Group

1w ago

Q. What is dependency injection and how does Spring Boot support it?

Ans.

Dependency injection is a design pattern that allows for better code modularity and testing by injecting dependencies at runtime.

  • Promotes loose coupling between classes by injecting dependencies rather than hardcoding them.

  • Spring Boot uses annotations like @Autowired, @Component, and @Service to manage dependencies.

  • Example: A service class can be injected into a controller using @Autowired, allowing for easier testing and maintenance.

  • Supports different types of dependency inj...read more

Asked in Float Group

1w ago

Q. What is the purpose of the final, finally, and finalize() keywords?

Ans.

final, finally, and finalize() serve different purposes in Java: controlling variable scope, exception handling, and garbage collection.

  • final: Used to declare constants or prevent method overriding and inheritance. Example: final int x = 10;

  • finally: A block that executes after try-catch, regardless of exceptions. Example: try { ... } catch { ... } finally { ... }

  • finalize(): A method called by the garbage collector before an object is removed. Example: protected void finalize(...read more

Asked in DigiBoxx

1w ago

Q. What is the purpose of the getDerivedStateFromProps() and getSnapshotBeforeUpdate() lifecycle methods?

Ans.

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

Asked in DEVtrust

1w ago

Q. Write code for merging two sorted arrays.

Ans.

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

Asked in DEVtrust

1d ago

Q. What are Integrity Constraints?

Ans.

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

Asked in Tagit Pte

3d ago

Q. What is exception handling in programming?

Ans.

Exception handling is a mechanism to handle runtime errors in a program to prevent it from crashing.

  • Exceptions are unexpected events that occur during the execution of a program.

  • Exception handling allows the programmer to gracefully handle these errors and prevent the program from crashing.

  • Common exception handling constructs include try, catch, and finally blocks.

  • Example: try { // code that may throw an exception } catch(Exception e) { // handle the exception }

  • Example: final...read more

Asked in A To Z

2w ago

Q. What is inheritance and encapsulation?

Ans.

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

Asked in GlobalLogic

2w ago

Q. Definitions and example code of OOPS Concepts

Ans.

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; } }

Asked in DigiBoxx

2w ago

Q. Explain Local Storage, Session Storage, and caching in Web development.

Ans.

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

Q. In SQL Server, how can you combine data from two tables with identical columns without using JOIN clauses?

Ans.

Combine two tables with identical columns in SQL Server without using traditional joins, leveraging UNION or subqueries instead.

  • Use UNION to combine results from both tables: SELECT * FROM Table1 UNION SELECT * FROM Table2;

  • UNION ALL can be used if you want to include duplicate rows: SELECT * FROM Table1 UNION ALL SELECT * FROM Table2;

  • Subqueries can also be utilized: SELECT * FROM (SELECT * FROM Table1) AS T1, (SELECT * FROM Table2) AS T2;

  • Ensure both tables have the same numbe...read more

5d ago

Q. What is the difference between delete, drop, and truncate?

Ans.

Delete, drop, and truncate are SQL commands for removing data, but they differ in scope and performance.

  • DELETE removes specific rows based on a condition. Example: DELETE FROM table WHERE id = 1;

  • DROP removes an entire table or database. Example: DROP TABLE table_name;

  • TRUNCATE removes all rows from a table but keeps its structure. Example: TRUNCATE TABLE table_name;

  • DELETE is slower as it logs each row deletion, while TRUNCATE is faster as it doesn't log individual row deletion...read more

Asked in TCS

2w ago

Q. Why do we need databases?

Ans.

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.

Previous
1
2
3
4
5
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Cognizant Logo
3.7
 • 5.9k Interviews
LTIMindtree Logo
3.7
 • 3k Interviews
GlobalLogic Logo
3.6
 • 629 Interviews
HSBC Group Logo
3.9
 • 512 Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Software Engineer Trainee Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits