GlobalLogic
10+ iEnergizer Interview Questions and Answers
Q1. 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.
Q2. 1. What is oops concepts 2. Explain inheritance with example and how to prevent inheritance in Java?. 3. What is sealed, final, static keywords in Java 4. Implement Fibonacci, factorials, prime no. 5. Return al...
read moreThis interview question covers various topics in Java programming, including OOP concepts, inheritance, keywords, and implementing mathematical algorithms.
OOP concepts include encapsulation, inheritance, polymorphism, and abstraction.
Inheritance allows a class to inherit properties and methods from another class.
To prevent inheritance in Java, use the 'final' keyword before the class declaration.
Sealed, final, and static are keywords in Java with different functionalities.
Imp...read more
Q3. 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
Q4. 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.
Q5. 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
Q6. 1.What is primary foreign key 2. Explain ACID properties 3. Return 3 rd maximum salary 4. One SQL query on join 5. IN In SQL 6. Let var const in JS 7. what is proto in JS 8. Explain closure in JS
Answers to interview questions for Software Engineer Trainee
Primary foreign key is a column in a table that is used to link to the primary key of another table
ACID properties are Atomicity, Consistency, Isolation, and Durability which ensure database transactions are reliable
To return 3rd maximum salary, use the LIMIT and OFFSET clauses in SQL
SQL join is used to combine data from two or more tables based on a related column
IN in SQL is used to specify multiple values in a WHE...read more
Q7. 1. Implement Fibonacci using dynamic programming 2. Strength and weakness
Implement Fibonacci using dynamic programming and discuss strengths and weaknesses.
Dynamic programming uses memoization to store previously calculated values
Fibonacci sequence is a classic example of dynamic programming
Strengths: efficient, reduces redundant calculations, improves performance
Weaknesses: requires additional memory, may not be suitable for small problems
Example: fib(n) = fib(n-1) + fib(n-2), with base cases fib(0) = 0 and fib(1) = 1
Q8. 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; } }
Q9. Write a program to add a node to the end of the linkedlist
Program to add a node to the end of a linked list
Create a new node with the data to be added
Traverse the linked list to reach the last node
Update the next pointer of the last node to point to the new node
Q10. Write a program to check if a number is palindrome or not.
Program to check if a number is palindrome or not.
Convert the number to a string for easier comparison
Reverse the string and compare it with the original string
If they are the same, the number is a palindrome
Q11. When is double linked list used.?
Double linked lists are used when there is a need to traverse the list in both directions efficiently.
Allows for traversal in both directions
Insertions and deletions can be done in constant time
Used in implementations of undo functionality in text editors
Q12. Write a program for inheritance and polymorphism?
Inheritance allows a class to inherit properties and methods from another class, while polymorphism allows objects of different classes to be treated as objects of a common superclass.
Create a base class with common properties and methods
Create derived classes that inherit from the base class and add their own unique properties and methods
Use virtual functions in the base class and override them in the derived classes to achieve polymorphism
Q13. Code : string reversal
Code to reverse a given string.
Iterate through the string from end to start and append each character to a new string.
Use built-in functions like reverse() in Python or StringBuilder.reverse() in Java.
Convert the string to an array, reverse the array, and then convert it back to a string.
Q14. reverse the linked list
Reverse a linked list
Iterate through the linked list and reverse the pointers
Use three pointers to keep track of current, previous, and next nodes
Update the next pointer of each node to point to the previous node
Q15. reverse the array
Reverse the array of strings
Create a new array and iterate through the original array in reverse order, adding each element to the new array
Alternatively, you can use the reverse() method on the array itself
Interview Process at iEnergizer
Top Software Engineer Trainee Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month