Software Engineer Trainee
100+ Software Engineer Trainee Interview Questions and Answers for Freshers

Asked in HSBC Group

Q. 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
Check if a given singly linked list of integers is a palindrome or not.
Traverse the linked list to find the middle element using slow and fast pointers.
Reverse the second half of the linked list.
Compare the first half with the reversed second half to determine if it is a palindrome.
Example: Input: 1 -> 2 -> 3 -> 2 -> 1 -> NULL, Output: true

Asked in HSBC Group

Q. 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 target integer in a 2D matrix with sorted rows.
Iterate through each row of the matrix and perform a binary search on each row to find the target integer.
Start the binary search by considering the entire row as a sorted array.
If the target is found in any row, return 'TRUE'; otherwise, return 'FALSE'.

Asked in GlobalLogic

Q. 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
Calculate total score based on guessing colors in a slot machine.
Iterate through each slot in the original and guess strings to compare colors.
Count perfect hits when color matches in correct slot, and pseudo-hits when color matches in different slot.
Calculate total score by adding perfect hits and pseudo-hits.
Handle edge cases like invalid input strings or exceeding constraints.

Asked in HSBC Group

Q. 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
Find the maximum level sum in a binary tree by calculating the sum of nodes at each level.
Traverse the binary tree level by level and calculate the sum of nodes at each level.
Keep track of the maximum level sum encountered so far.
Return the maximum level sum as the final result.

Asked in Samsung

Q. 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
Reverse a singly linked list by altering the links between nodes.
Iterate through the linked list and reverse the links between nodes.
Keep track of the previous, current, and next nodes while reversing the links.
Update the head of the linked list to the last node after reversal.

Asked in Adobe

Q. 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
Calculate x raised to the power of n. Handle edge case of 0^0 = 1.
Accept x and n as input from user
Compute x^n and display the result
Handle edge case of 0^0 = 1
Ensure x is between 0 and 8, n is between 0 and 9
Software Engineer Trainee Jobs




Asked in Amazon

Q. 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
Count the total number of inversions in an integer array.
Iterate through the array and for each element, check how many elements to its right are smaller than it.
Use a merge sort based approach to efficiently count the inversions.
Keep track of the count of inversions while merging the sorted subarrays.
Example: For input [2, 4, 1, 3, 5], there are 3 inversions: (2, 1), (4, 1), and (4, 3).

Asked in Amazon

Q. 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
Check if a given singly linked list is a palindrome or not.
Traverse the linked list to find the middle element using slow and fast pointers.
Reverse the second half of the linked list.
Compare the first half with the reversed second half to determine if it's a palindrome.
Share interview questions and help millions of jobseekers 🌟

Asked in Tech Vedika

Q. 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
Rotate an array left by a specified number of elements for each query.
Parse input: read number of test cases, array size, queries, and array elements
For each query, left rotate the array by the specified number of elements
Return the modified array for each query

Asked in Amazon

Q. 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
Given an array and a target sum, find pairs of elements that add up to the target sum.
Iterate through the array and for each element, check if the complement (target sum - current element) exists in a hash set.
If the complement exists, add the pair to the result list.
Sort the result list based on the first element of each pair, and then the second element if the first elements are equal.

Asked in Josh Technology Group

Q. 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
The N Queens Problem involves finding all possible placements of N queens on an N x N chessboard where no two queens threaten each other.
Understand the constraints of the problem: N represents the size of the chessboard and the number of queens, and queens can attack each other if they are in the same row, column, or diagonal.
Implement a backtracking algorithm to explore all possible configurations of queen placements without conflicts.
Ensure that each valid configuration is ...read more

Asked in Techwave Consulting

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

Asked in ThinkPalm Technologies

Q. There is a 5L measuring jar and a 3L measuring jar, a bucket full of water, and an empty bucket. How can you measure 7L using the measuring jars?
Use a 5L and a 3L jar to measure exactly 7L of water from a bucket.
Fill the 5L jar completely from the bucket.
Pour water from the 5L jar into the 3L jar until the 3L jar is full.
This leaves you with 2L of water in the 5L jar.
Empty the 3L jar back into the bucket.
Pour the remaining 2L from the 5L jar into the 3L jar.
Fill the 5L jar again from the bucket.
Now pour water from the 5L jar into the 3L jar until the 3L jar is full.
You will have exactly 7L in the bucket.

Asked in Ernst & Young

Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have method implementations, while interface cannot.
A class can implement multiple interfaces, but can only inherit from one abstract class.
Interfaces are used to define contracts for classes to implement, while abstract classes are used to provide a common base for subclasses.
Example: Abstract class 'Shape' with abstract method 'calculateArea' and...read more

Asked in DEVtrust

Q. Develop a fully functional "To Do List" application with a modern design, including header and footer, and implement functionalities like 'Add', 'Edit', 'Delete', and 'View List' within 30 minutes during the li...
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
Asked in DigiBoxx

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

Asked in TCS

Overloading is having multiple methods in the same class with the same name but different parameters. Overriding is implementing a method in a subclass that is already present in the superclass.
Overloading involves multiple methods with the same name but different parameters
Overriding involves implementing a method in a subclass that is already present in the superclass
Overloading is determined at compile time, while overriding is determined at runtime

Asked in Tagit Pte

Q. What advanced Java concepts are you familiar with, such as JDBC, Servlets, Hibernate, Spring, and servers like Apache Tomcat or IBM, as well as any build tools you have experience using?
I am familiar with JDBC, Servlets, Hibernate, Spring, Apache Tomcat, and build tools like Maven.
Experience with JDBC for database connectivity in Java applications
Knowledge of Servlets for handling web requests and responses
Understanding of Hibernate for object-relational mapping in Java
Familiarity with Spring framework for building enterprise Java applications
Experience with Apache Tomcat for deploying Java web applications
Proficiency in build tools like Maven for project ma...read more

Asked in Novac Technology Solutions

Q. You have a cricket team of 15 players. You need to select 11 players to play. Represent the 11 players who will play with a binary value of 1, and the remaining 4 players with a binary value of 0. Write code to...
read moreSelect 11 players from a cricket team of 15 based on binary values indicating their participation.
Use an array of size 15 to represent players, where 1 indicates a player will play and 0 indicates they won't.
Example array: [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0]
Count the number of 1s in the array to ensure only 11 players are selected.
If there are more than 11 players with value 1, you can choose any 11 of them.

Asked in ThinkPalm Technologies

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

Asked in DEVtrust

Q. Write Typescript code to find the maximum length of a palindromic substring from a given string.
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

Asked in Srichid Technologies

Q. Write code in your preferred language.
This code demonstrates a simple implementation of a bubble sort algorithm in Python.
Bubble sort is a simple sorting algorithm that repeatedly steps through the list.
It compares adjacent elements and swaps them if they are in the wrong order.
The process is repeated until the list is sorted.
Example: Sorting the array [5, 3, 8, 4, 2] results in [2, 3, 4, 5, 8].
Time complexity is O(n^2) in the worst case.

Asked in Enzigma Software

Q. If Room is a class, what are its objects?
In OOP, a class defines a blueprint, while objects are instances of that class, like specific rooms with unique attributes.
Objects of the 'Room' class could be 'LivingRoom', 'Bedroom', 'Kitchen', each with unique properties.
Each room object can have attributes like size, color, and furniture.
Methods for the 'Room' class might include 'clean()', 'paint(color)', or 'addFurniture(furnitureItem)'.
For example, 'LivingRoom' could have a size of 20x15 feet and be painted blue.
Asked in DigiBoxx

Q. 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))

Asked in Infosys

DELETE removes specific rows from a table, while TRUNCATE removes all rows and resets auto-increment values.
DELETE is a DML command, while TRUNCATE is a DDL command.
DELETE can be rolled back, while TRUNCATE cannot be rolled back.
DELETE triggers ON DELETE triggers, while TRUNCATE does not trigger any triggers.
DELETE is slower as it logs individual row deletions, while TRUNCATE is faster as it deallocates data pages.
Example: DELETE FROM table_name WHERE condition; TRUNCATE tabl...read more

Asked in Softsuave

Q. You have a 3-litre and a 5-litre water bottle. You need to measure exactly 4 litres. How will you do it?
Measure exactly 4 litres using a 3-litre and a 5-litre bottle through a series of filling and pouring steps.
Fill the 5-litre bottle completely.
Pour water from the 5-litre bottle into the 3-litre bottle until the 3-litre bottle is full.
This leaves 2 litres in the 5-litre bottle.
Empty the 3-litre bottle.
Pour the remaining 2 litres from the 5-litre bottle into the 3-litre bottle.
Fill the 5-litre bottle again completely.
Pour water from the 5-litre bottle into the 3-litre bottle u...read more

Asked in Amdocs

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. Denormalization is the opposite process.
Normalization involves breaking down data into smaller, more manageable tables to reduce redundancy.
Denormalization involves combining tables to improve query performance.
Normalization helps maintain data integrity by reducing the risk of anomalies.
Denormalization can improve read performance but may lead to data redundancy.
Exa...read more

Asked in Srichid Technologies

Q. Why is Java considered a partially object-oriented programming (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

Asked in Novac Technology Solutions

Q. Design a web page using HTML and CSS. The page should contain a header and footer. The body should contain three cards in a single row.
A simple webpage layout using HTML and CSS with a header, footer, and three cards in a row.
Use <header> and <footer> tags for the header and footer sections.
Create a <div> for the body content and use CSS Flexbox to align the cards.
Each card can be a <div> with a class, styled with padding, margin, and background color.
Example CSS: .card { flex: 1; margin: 10px; padding: 20px; background-color: #f0f0f0; }
Ensure responsive design by using media queries for smaller screens.

Asked in HSBC Group

Static polymorphism refers to the mechanism where the method to be called is determined at compile time.
Method overloading is an example of static polymorphism where the method to be called is resolved at compile time based on the method signature.
Compile-time polymorphism is another term for static polymorphism.
Static polymorphism is achieved through function overloading and operator overloading.
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Software Engineer Trainee 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

