
Infosys

4000+ Infosys Interview Questions and Answers
Q1. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
The problem involves determining the number of distinct ways to climb from the 0th to the Nth stair by climbing one or two steps at a time.
Use dynamic programming to solve this problem efficiently.
Define a recursive function to calculate the number of ways to reach each stair based on the number of ways to reach the previous two stairs.
Consider base cases for 0th and 1st stair.
Keep track of the number of ways modulo 10^9+7 to avoid overflow issues.
Q2. Maximum Subarray Sum Problem Statement
Given an array arr
of length N
consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.
Explanation:
A sub...read more
Find the sum of the subarray with the maximum sum among all subarrays in an array of integers.
Iterate through the array and keep track of the maximum sum subarray encountered so far.
Use Kadane's algorithm to efficiently find the maximum subarray sum.
Consider the sum of an empty subarray as 0.
Q3. Distinct Strings With Odd and Even Swapping Allowed Problem Statement
You are provided with an array of strings, and your objective is to determine the number of unique strings within it.
A string is deemed uni...read more
Count the number of unique strings in an array by allowing swapping of characters at odd and even indices.
Iterate through each string in the array and check if it can be transformed into another string by swapping characters at odd and even indices.
Keep track of unique strings using a set data structure.
Return the size of the set as the number of unique strings.
Q4. Valid Parenthesis Problem Statement
Given a string str
composed solely of the characters "{", "}", "(", ")", "[", and "]", determine whether the parentheses are balanced.
Input:
The first line contains an integ...read more
The task is to determine if the given string of parentheses is balanced or not.
Use a stack to keep track of opening parentheses
When encountering a closing parenthesis, check if it matches the top of the stack
If the stack is empty or the parentheses do not match, the string is not balanced
Return 'YES' if all parentheses are balanced, 'NO' otherwise
Q5. Khaled has an array A of N elements. It is guaranteed that N is even. He wants to choose at most N/2 elements from array A. It is not necessary to choose consecutive elements. Khaled is interested in XOR of all...
read moreChoose at most N/2 elements from an array A of N elements and find XOR of all the chosen elements.
Choose the N/2 largest elements to maximize the XOR value.
Use a priority queue to efficiently select the largest elements.
If N is small, brute force all possible combinations of N/2 elements.
Q6. 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
Find pairs of elements in an array that sum up to a given value, sorted in a specific order.
Iterate through the array and for each element, check if the complement (S - 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 criteria mentioned in the question.
Return the sorted list of pairs.
Q7. What are oops concepts?
OOPs concepts are the fundamental principles of Object-Oriented Programming.
Encapsulation: Binding data and functions together in a single unit.
Inheritance: Acquiring properties and behavior of a parent class by a child class.
Polymorphism: Ability of an object to take many forms.
Abstraction: Hiding the implementation details and showing only the necessary information.
Example: A car is an object that encapsulates data like speed, fuel, and functions like start, stop, and accel...read more
Q8. Print All Subsets Challenge
Given an array arr
containing 'N' distinct integers, your task is to generate all possible non-empty subsets of this array.
Note: While the elements within each subset should be in i...read more
Generate all possible non-empty subsets of an array of distinct integers.
Use recursion to generate subsets by including or excluding each element in the array.
Maintain a current subset and add it to the result when reaching the end of the array.
Ensure elements within each subset are in increasing order.
Handle the input and output format as specified in the question.
Consider edge cases like empty array or array with only one element.
Q9. 1. what is the difference between exception and error. How did u solve the errors in the code deployment?
Exception is a runtime error that can be handled, while error is a severe issue that cannot be handled.
Exceptions are caused by the program logic, while errors are caused by external factors like hardware failure or network issues.
Exceptions can be caught and handled using try-catch blocks, while errors require fixing the underlying issue.
Example of exception: NullPointerException. Example of error: Out of Memory Error.
To solve errors in code deployment, identify the root cau...read more
Q10. What is your strong point in terms of technical knowledge? Like JAVA, C, C++. What is inheritance? What are the different types of inheritance? What are any two the differences between C++ and Java? How modular...
read moreMy strong point is Java. I have a good understanding of inheritance, modularity, and abstraction. I also have knowledge of C++.
Inheritance is a mechanism in OOP where a new class is derived from an existing class. Types of inheritance are single, multiple, multilevel, and hierarchical.
C++ is a compiled language while Java is an interpreted language. C++ supports operator overloading while Java does not.
Modularity in C++ is achieved through the use of header files and namespac...read more
String should be preferred for frequent updates due to its immutability.
String is immutable, so every update creates a new instance, leading to memory overhead.
StringBuffer is mutable and allows for efficient updates without creating new instances.
Use StringBuffer when frequent updates are required to avoid unnecessary memory allocation.
Example: StringBuffer is preferred for building dynamic strings in loops.
Q12. Split the String Problem Statement
You are given a string str
consisting of N
lowercase alphabets. Your task is to determine if it is possible to divide the string into three non-empty substrings such that one ...read more
Determine if it is possible to divide a string into three non-empty substrings where one is a substring of the other two.
Check if any substring of the string is a substring of the other two substrings.
Iterate through all possible divisions of the string into three non-empty substrings.
Use two pointers to find all possible substrings efficiently.
Q13. Quick Sort Problem Statement
You are provided with an array of integers. The task is to sort the array in ascending order using the quick sort algorithm.
Quick sort is a divide-and-conquer algorithm. It involve...read more
To achieve NlogN complexity in the worst case, we can implement the randomized version of quicksort algorithm.
Randomly select a pivot element to reduce the chances of worst-case scenarios.
Implement a hybrid sorting algorithm like Introsort which switches to heap sort when the recursion depth exceeds a certain limit.
Use median-of-three partitioning to select a good pivot element for better performance.
Optimize the algorithm by using insertion sort for small subarrays to reduce...read more
Q14. Trie Implementation Task
Create a Trie data structure supporting two operations: inserting words and checking their presence. A Trie organizes data like a tree structure, where each node stores letters of words...read more
Implement a Trie data structure supporting insertion and search operations for words.
Create a TrieNode class with a dictionary to store children nodes.
Implement insert(word) by iterating through each character of the word and creating nodes if necessary.
Implement search(word) by traversing the Trie and checking for the presence of the word.
Use a boolean flag in TrieNode to mark the end of a word.
Handle Type 1 and Type 2 queries accordingly in the main program.
Q15. Merge Sort Linked List Problem Statement
You are given a singly linked list of integers. Your task is to sort the linked list using the merge sort algorithm.
Explanation:
Merge Sort is a divide and conquer algo...read more
Implement the merge sort algorithm to sort a singly linked list of integers.
Divide the linked list into two halves recursively
Merge the sorted halves using the merge() function
Implement the merge() function to merge two sorted subarrays
Ensure the constraints are met for input elements
Return the sorted linked list for each test case
Q16. String Compression Problem Statement
Ninja needs to perform basic string compression. For any character that repeats consecutively more than once, replace the repeated sequence with the character followed by th...read more
Implement a function to compress a string by replacing consecutive characters with the character followed by the count of repetitions.
Iterate through the input string and keep track of consecutive characters and their counts
Replace consecutive characters with the character followed by the count of repetitions if count is greater than 1
Return the compressed string
Q17. 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 a list of strings and return them as separate groups.
Iterate through the list of strings and sort each string to find anagrams.
Use a hashmap to group anagrams together based on their sorted versions.
Return the grouped anagrams as separate lists of strings.
Q18. Number of Islands Problem Statement
Given a non-empty grid of 0s and 1s, determine the number of distinct islands. An island is a collection of '1's (land) connected horizontally, vertically, or diagonally. It ...read more
The task is to determine the number of distinct islands in a grid of 0s and 1s connected horizontally, vertically, or diagonally.
Iterate through the grid and for each '1' encountered, perform a depth-first search to mark all connected '1's as visited.
Use a set to store the unique shapes of islands encountered during the traversal.
Return the size of the set as the total number of distinct islands in the grid.
Q19. 1. Journal entry for Purchase with GST 2. Explain any one Ind AS 3. What is SAP? 4. What is ERP? 5. Why IT industry? 6. What is the use of Flash-Fill in Excel? 7. Any 5 excel features. (Pivot table, macros, fla...
read moreInterview questions for SAP Fico Consultant
Journal entry for Purchase with GST involves debiting the Purchases account and crediting the Input GST account
Ind AS stands for Indian Accounting Standards, one of which is Ind AS 116 on Leases
SAP is a software company that provides enterprise software to manage business operations and customer relations
ERP stands for Enterprise Resource Planning, a software system that integrates business processes and data
IT industry offers opport...read more
Q20. What are the services you have used in AWS? What are the types of storage in S3? How will you troubleshoot if a web server is not responding? Have you come across DNS hosting, in AWS how can we achieve it? What...
read moreAWS services, S3 storage types, troubleshooting web server, DNS hosting, static hosting, IAM policies, load balancers, NAT gateway
Used EC2, S3, RDS, Lambda, CloudFront, etc.
S3 storage types: Standard, Infrequent Access, Glacier
Check server logs, network connectivity, security groups, etc.
DNS hosting can be achieved using Route 53
Static hosting is used to host static websites using S3 and CloudFront
Roles define permissions for AWS resources, service rules define access to spec...read more
INNER JOIN returns only the matching rows between two tables, while OUTER JOIN returns all rows from one table and matching rows from the other.
INNER JOIN is used to retrieve rows from both tables that have matching values based on a specified condition.
OUTER JOIN is used to retrieve all rows from one table and only matching rows from the other table.
Types of OUTER JOIN include LEFT JOIN, RIGHT JOIN, and FULL JOIN.
Example: INNER JOIN would return a list of students who have r...read more
Integrity rules in a DBMS ensure data accuracy, consistency, and reliability.
Constraints like primary key, foreign key, unique key enforce data integrity
Referential integrity ensures relationships between tables are maintained
Entity integrity ensures each row has a unique identifier
Domain integrity enforces valid data types and values
Check constraints validate data before insertion or update
Q23. Generate All Parentheses Combinations
Given an integer N
, your task is to create all possible valid parentheses configurations that are well-formed using N
pairs. A sequence of parentheses is considered well-fo...read more
Generate all valid parentheses combinations for a given number of pairs.
Use backtracking to generate all possible combinations of parentheses.
Keep track of the number of open and close parentheses used.
Add '(' if there are remaining open parentheses, and add ')' if there are remaining close parentheses.
Stop when the length of the generated string is equal to 2*N.
Q24. What is the difference between windows application development and web based development?
Windows app dev is for desktops, web dev is for browsers.
Windows app dev is for desktop operating systems like Windows, macOS, and Linux.
Web dev is for browsers and can be accessed from any device with an internet connection.
Windows app dev uses GUI frameworks like Windows Forms or WPF.
Web dev uses web technologies like HTML, CSS, and JavaScript.
Examples of Windows apps include Microsoft Word and Adobe Photoshop.
Examples of web apps include Facebook and Google Maps.
Q25. Glowing Bulbs Problem Statement
You have an infinite number of electric bulbs, each assigned a unique integer starting from 1. There are 'N' switches, each labeled with a unique prime number. When a switch labe...read more
Given an array of prime numbers representing switches and an integer K, find the Kth glowing bulb when all switches are turned on.
Iterate through each prime number in the array and calculate the number of bulbs that will glow for each prime number.
Keep track of the total number of glowing bulbs as you iterate through the array.
Once the total number of glowing bulbs exceeds or equals K, calculate the Kth glowing bulb based on the last prime number that was considered.
Q26. Flip Bits Problem Explanation
Given an array of integers ARR
of size N, consisting of 0s and 1s, you need to select a sub-array and flip its bits. Your task is to return the maximum count of 1s that can be obta...read more
Given an array of 0s and 1s, find the maximum count of 1s by flipping a sub-array at most once.
Iterate through the array and keep track of the maximum count of 1s seen so far.
If the current element is 0, consider flipping the sub-array from the previous 1 to the current 0.
Update the maximum count of 1s if flipping the sub-array results in a higher count.
Return the maximum count of 1s obtained after considering all possible sub-arrays.
Q27. Ninja And Divisible Array Problem Statement
Ninja is tasked with dividing an array ARR
of even size N
and an integer K
into N/2
pairs such that the sum of each pair is divisible by K
.
Your goal is to determine ...read more
The task is to determine if an array can be divided into pairs such that the sum of each pair is divisible by a given integer.
Iterate through the array and calculate the remainder of each element when divided by K.
Store the remainders in a hashmap with their frequencies.
Check if the frequencies of remainders are even and if the sum of each pair of remainders is divisible by K.
Constructor is a special method used to initialize an object, while a method is a function that performs a specific task within a class.
Constructors are called automatically when an object is created, while methods need to be called explicitly.
Constructors have the same name as the class, while methods have unique names.
Constructors do not have a return type, while methods can have a return type.
Example: Constructor - public ClassName() { // initialization code }, Method - pu...read more
Q29. 1. What is the frame work u have worked and explain the framework with folder structure? 2. purely based on testing, different testing types like functional and non functional tests 3. real time scenarios like...
read moreTest Engineer interview questions on frameworks, testing types, bug tracking, and regression testing.
Worked with Selenium framework with folder structure of test cases, test data, and page objects
Functional testing includes smoke, sanity, and regression testing while non-functional testing includes performance and security testing
Real-time scenario: prioritize and fix critical bugs first, communicate with stakeholders, and perform thorough testing before release
Integration te...read more
Q30. What is SQL? Explain in detail.
SQL is a programming language used to manage and manipulate relational databases.
SQL stands for Structured Query Language.
It is used to create, modify, and query databases.
SQL is used in various industries such as finance, healthcare, and e-commerce.
Examples of SQL commands include SELECT, INSERT, UPDATE, and DELETE.
SQL is used to retrieve specific data from a database using queries.
Q31. Return Subsets Sum to K Problem Statement
Given an integer array 'ARR' of size 'N' and an integer 'K', return all the subsets of 'ARR' which sum to 'K'.
Explanation:
A subset of an array 'ARR' is a tuple that c...read more
Given an array and an integer, return all subsets that sum to the given integer.
Use backtracking to generate all possible subsets of the array.
For each subset, check if the sum equals the given integer 'K'.
Print the subsets that satisfy the condition.
Example: For input [1, 2, 3] and K=3, subsets [1, 2] and [3] have sum 3.
Q32. What do you mean by Git stash? what are the different ways of git merge? Can you differentiate between git pull and git fetch? what is the branching strategy in Git and how will you create a new branch and swit...
read moreGit stash is a feature that allows you to temporarily save changes without committing them.
Different ways of git merge: fast-forward, recursive, octopus
Git pull: fetches and merges changes from a remote branch, Git fetch: only fetches changes
Branching strategy in Git: Gitflow, trunk-based development, feature branching
To create a new branch: git branch
, to switch to it: git checkout Secrets should not be stored in Git repo, use a secure key management system
Staging area in G...read more
The relationship between a train's speed passing through a platform and the relative speed of two trains is influenced by their individual speeds and direction.
The relative speed of two trains passing each other is the sum of their individual speeds in opposite directions.
When a train passes through a platform, its speed relative to the platform is the difference between its speed and the platform's speed.
The relative speed of two trains passing through a platform can be calc...read more
Q34. write a code to filter out loans with incomplete status using java 8 features.
Code to filter out loans with incomplete status using Java 8 features.
Use stream() method to convert the list of loans into a stream
Use filter() method to filter out loans with incomplete status
Use collect() method to collect the filtered loans into a new list
Q35. What is accountant and how many basic rules are there
An accountant is a professional who manages financial records and prepares financial reports. There are basic rules of accounting.
Accountants manage financial records and prepare financial reports
Basic rules of accounting include the accounting equation, double-entry accounting, and the matching principle
Accountants must follow generally accepted accounting principles (GAAP) and maintain ethical standards
Examples of accounting tasks include bookkeeping, tax preparation, and f...read more
Multitasking refers to the ability of an operating system to run multiple tasks concurrently, while multithreading involves executing multiple threads within a single process.
Multitasking allows multiple programs to run simultaneously on a single processor, switching between them quickly.
Multithreading enables a single program to perform multiple tasks concurrently by dividing it into smaller threads that can be executed independently.
Multitasking is at the process level, whi...read more
Q37. How to select a record from a table?
To select a record from a table, use the SELECT statement with appropriate conditions.
Use the SELECT statement with the appropriate columns to retrieve data from the table.
Specify the table name in the FROM clause.
Use the WHERE clause to specify the conditions for selecting the record.
Example: SELECT * FROM table_name WHERE column_name = 'value';
Q38. An atomic spark job runs for 15 mins everyday ,one day it is running for more than an hour what might be the issue ?
Possible reasons for an atomic spark job running for more than an hour.
Data size may have increased beyond the capacity of the cluster
Issues with network connectivity or hardware failure
Inefficient code or poorly optimized queries
Resource contention with other jobs running on the cluster
Data skew or data imbalance
Incorrect configuration settings
Q39. What are OOP concepts? Tell me about the pillars of Object Oriented Programming.
OOP concepts are the building blocks of Object Oriented Programming. The four pillars of OOP are Abstraction, Encapsulation, Inheritance, and Polymorphism.
Abstraction: Hiding implementation details and showing only necessary information to the user.
Encapsulation: Binding data and functions together to protect data from outside interference.
Inheritance: Creating new classes from existing ones, inheriting properties and methods.
Polymorphism: Ability of objects to take on multip...read more
Q40. Why Ansible is called agentless? How will you run an ansible-playbook, tell me the command used for it? What are variables in ansible? What are the roles in ansible and what is the benefit of using it? How does...
read moreAnsible is called agentless because it does not require any agent to be installed on the target host.
Ansible uses SSH to connect to the target host and execute commands remotely.
The command to run an ansible-playbook is 'ansible-playbook
'. Variables in Ansible are used to store values that can be used across multiple tasks and playbooks.
Roles in Ansible are a way to organize tasks, handlers, and variables into reusable units.
Ansible maintains inventory data in the inventory f...read more
Q41. What are the different types of Jobs in Jenkins, name at least 2, and their usage? How will you restrict access in Jenkins to someone, what is the plugin name? In what language Jenkins is written? What are the...
read moreJenkins is a popular CI/CD tool with various job types, access control, build triggers, and master-slave architecture.
Job types: Freestyle project, Pipeline project
Access control: Role-based Authorization Strategy plugin
Jenkins is written in Java
Build triggers: Manual, Scheduled, SCM, Remote Trigger, etc.
Build failure: Email notification, Console output, Build log
Master-slave: Distributes workload across multiple nodes for faster builds
Q42. 1.What is Singleton in java and create your own singleton class countering all breakable conditions? 2. What is Auto Configuration? 3. @Primary vs @Qualifier 4. What is idempotent? 5. What is class loader? Type...
read moreThe interview questions cover various topics related to Java development, including Singleton pattern, memory management, exception handling, Spring framework, and design patterns.
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Auto Configuration in Spring Boot automatically configures the Spring application based on dependencies present in the classpath.
@Primary annotation is used to give higher preference to a bean when mu...read more
Q43. Managerial: 1) Explain any one past issue and its mitigation strategy. 2) How we can handle the situation when we found code is not complaint before one day of deployment. 3) why are you looking for Switch?
Answering managerial questions for Tech Lead position
For past issue, explain the problem and how you identified it
Describe the mitigation strategy and its effectiveness
For non-compliant code, assess the impact and prioritize fixes
Communicate the issue to stakeholders and plan for a fix
For looking to switch, explain the reasons and how it aligns with career goals
Q44. 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 minimum time to rot all fresh oranges adjacent to rotten oranges in a grid.
Use Breadth First Search (BFS) to simulate the rotting process
Keep track of the time taken to rot all fresh oranges
Return -1 if not all fresh oranges can be rotten
Q45. What do you mean by SDLC?
SDLC stands for Software Development Life Cycle.
SDLC is a process used by software development teams to design, develop, and test high-quality software.
It consists of several phases including planning, analysis, design, implementation, testing, and maintenance.
Each phase has its own set of activities and deliverables that must be completed before moving on to the next phase.
SDLC helps ensure that software is developed efficiently, on time, and within budget.
Examples of SDLC m...read more
Q46. Intersection of Linked List Problem
You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.
Your task is to determine the data...read more
Find the node where two linked lists merge, return -1 if no merging occurs.
Traverse both lists to find their lengths and the difference in lengths
Move the pointer of the longer list by the difference in lengths
Traverse both lists simultaneously until they meet at the merging point
Q47. What is the command used for CPU usage in Linux? which Linux you have used? How will you see free memory in Linux in GB? Do you know NFS and what are the steps to create it?
Command for CPU usage in Linux, checking free memory in GB, and creating NFS.
Command for CPU usage: top or htop
Checking free memory in GB: free -g
Creating NFS: install nfs-utils, configure /etc/exports, start nfs-server and nfs-lock services
Linux used not specified
Early binding is resolved at compile time while late binding is resolved at runtime in C++.
Early binding is also known as static binding, where the function call is resolved at compile time based on the type of the object.
Late binding is also known as dynamic binding, where the function call is resolved at runtime based on the actual type of the object.
Early binding is faster as the function call is directly linked during compilation.
Late binding allows for more flexibility a...read more
Q49. Can you tell me the difference between C and C++ ?
C is a procedural programming language while C++ is an extension of C with added features of object-oriented programming.
C is a procedural language, while C++ supports both procedural and object-oriented programming.
C++ has additional features like classes, objects, inheritance, and polymorphism.
C++ supports function overloading and exception handling, which are not present in C.
C++ has a standard template library (STL) that provides useful data structures and algorithms.
C++ ...read more
Q50. What is OOPs? Difference between Overloading and overriding, what is polymorphism, what is database, what is candidate key, How we train model in ML, difference between call by value and call by reference, what...
read moreQuestions related to OOPs, database, and ML concepts.
OOPs stands for Object-Oriented Programming which is a programming paradigm based on the concept of objects.
Overloading is when multiple methods have the same name but different parameters, while overriding is when a subclass provides a specific implementation of a method that is already provided by its parent class.
Polymorphism is the ability of an object to take on many forms. In Java, it is achieved through method overlo...read more
Q51. As your major is mechanical, explain how turbine works and its parts?
A turbine is a mechanical device that converts the energy from a fluid flow into useful work.
Turbines are commonly used in power generation, aviation, and marine applications.
They consist of several key parts including the rotor, stator, blades, and shaft.
The rotor is the rotating part of the turbine, while the stator is the stationary part.
Blades are attached to the rotor and are designed to capture the energy of the fluid flow.
The shaft connects the rotor to the external lo...read more
Different languages used in DBMS include SQL, PL/SQL, T-SQL, and NoSQL.
SQL (Structured Query Language) is the standard language for relational database management systems.
PL/SQL (Procedural Language/SQL) is Oracle Corporation's procedural extension for SQL.
T-SQL (Transact-SQL) is Microsoft's proprietary extension to SQL.
NoSQL encompasses a wide range of database technologies that can store unstructured, semi-structured, or structured data.
Q53. Are you okay to learn front end and back end technologies to ensure you are a complete developer in the longer run? Would you be able to learn the concepts if a timeline is given?? If yes, explain your learning...
read moreYes, I am willing to learn front end and back end technologies and have a learning strategy in place.
I believe in continuous learning and growth as a developer.
I have experience in learning new technologies quickly and efficiently.
My learning strategy involves breaking down concepts into smaller parts and practicing regularly.
I also utilize online resources and seek guidance from experienced colleagues.
Examples of technologies I have learned include React, Node.js, and MongoD...read more
Q54. 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 longest increasing subsequence ending at each element.
Initialize an array to store the length of the longest increasing subsequence ending at each index.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum value in the array as the length of the longest increasing subsequence.
Q55. When we travel using busses from one place to another and there is no particular bus for this route then we have to co-ordinate timing of different busses to travel this route. We can make this process automati...
read moreYes, we can automate the process of coordinating timing of different busses for a particular route.
We can use GPS tracking to monitor the location of busses in real-time.
We can develop a software that can analyze the data and suggest the best route and timing for the passenger.
We can also use machine learning algorithms to predict the traffic and suggest the best route and timing for the passenger.
We can integrate this system with a mobile app that can provide real-time infor...read more
Q56. 1)what is constructor. 2)Difference between method overriding and overloading 3) Write a program for print prime number between two given ranges 4)What is dangling pointer
Interview questions for System Engineer position
Constructor is a special method that is used to initialize an object
Method overriding is when a subclass provides its own implementation of a method that is already present in the parent class, while method overloading is when multiple methods have the same name but different parameters
Program to print prime numbers between two given ranges can be achieved using nested loops and checking for prime numbers using modulus operator
A...read more
Q57. Unival Trees Problem Statement
You are given a binary tree. Your task is to return the count of unival sub-trees in the given binary tree. In a unival tree, all nodes below the root node have the same value as ...read more
Count the number of unival sub-trees in a binary tree where all nodes below the root have the same value as the root node.
Traverse the binary tree recursively and check if each subtree is a unival tree by comparing values with the root node.
Keep track of the count of unival trees while traversing the tree.
Return the total count of unival trees at the end of traversal.
Q58. How do you make the child records read only of its parent record's field is updated to some value
Child records can be made read-only when parent record's field is updated using validation rules.
Create a validation rule on child object
Use ISCHANGED() function to check if parent field is updated
Use PRIORVALUE() function to get the previous value of parent field
Use ISBLANK() function to check if the previous value of parent field is blank
Use ISNEW() function to allow creation of child records
Use OR() function to combine all conditions
Throw an error message if all conditions...read more
Q59. Introduce yourself 1.What is STLC 2. difference between Test plan,test case,test scanario 3.Positive and negative scanarion on pen. 4.selenium framework. 5.how to write selenium test cases.
I am an Automation Test Engineer with knowledge of STLC, test plan, test case, test scenario, Selenium framework, and writing Selenium test cases.
STLC stands for Software Testing Life Cycle and is a process followed to ensure quality in software testing.
Test plan is a document that outlines the testing strategy, objectives, and scope of testing.
Test case is a set of steps and conditions that are executed to verify the functionality of a software application.
Test scenario is a...read more
Q60. Is there any diversification going to happen in infosys from services to product development like Google?
Yes, Infosys has already diversified into product development with offerings like Finacle and EdgeVerve.
Infosys has already developed products like Finacle, a banking software, and EdgeVerve, an AI-powered automation platform.
The company has also acquired product-based companies like Panaya and Skava.
Infosys has a dedicated Product Engineering Services unit that focuses on developing and maintaining software products.
However, services still remain the primary focus of Infosys...read more
Garbage collector in Java is a built-in mechanism that automatically manages memory by reclaiming unused objects.
Garbage collector runs in the background to identify and delete objects that are no longer needed.
It helps in preventing memory leaks and optimizing memory usage.
Examples of garbage collectors in Java include Serial, Parallel, CMS, and G1.
Q62. You belong to mechanical domain, why do you want to switch it.
I want to switch to system engineering as it aligns with my interests and skills.
I have always been interested in technology and how systems work
I have gained experience in programming and software development
I believe my skills in problem-solving and critical thinking will be valuable in system engineering
I am excited about the opportunity to work on complex systems and contribute to their design and development
Q63. What is Dockerfile? Can you tell me some fields used in the Docker file? What is the difference between Dockerfile and Docker compose? Which is better Docker compose or Kubernetes, explain some differences? IN...
read moreExplanation of Dockerfile, Docker Compose, and differences between them and Kubernetes.
Dockerfile is a script that contains instructions to build a Docker image.
Fields in Dockerfile include FROM, RUN, COPY, ADD, CMD, and more.
Docker Compose is a tool for defining and running multi-container Docker applications.
Docker Compose uses a YAML file to define services, networks, and volumes.
Kubernetes is a container orchestration platform that automates deployment, scaling, and manag...read more
Q64. 2. Explain COMP, COMP-2, COMP-3 and Display. What are the difference between Continue and Next Sentence? Why does SOC7 occur?
Explanation of COMP, COMP-2, COMP-3, Display, Continue, Next Sentence, and SOC7.
COMP is a binary data type, COMP-2 is a packed decimal data type, COMP-3 is a packed decimal data type with sign, and Display is a character data type.
Continue is used to transfer control to the next statement within the same paragraph, while Next Sentence is used to transfer control to the first statement of the next paragraph.
SOC7 occurs due to a data exception error, such as an invalid numeric ...read more
Q65. Why you use Java, What are the features of java, How it is different with others?
Java is a popular programming language known for its platform independence, object-oriented approach, and robustness.
Java is platform independent, meaning it can run on any platform that has a Java Virtual Machine (JVM).
It is object-oriented, allowing for modular and reusable code.
Java is known for its robustness and reliability, with features like automatic memory management and exception handling.
Java has a rich set of APIs and libraries, making it versatile for various app...read more
Q66. What will you do in case you have only 2 KRs for an application and one of them takes a long sick leave for a couple of months, just two weeks prior to Transition Go Live
In case of a long sick leave for one of the key resources prior to Transition Go Live, I would take the following steps:
Assess the impact of the absence on the project timeline and deliverables
Identify if there are any backup resources available to temporarily fill the gap
If no backup resources are available, prioritize the remaining KR and allocate additional resources if necessary
Communicate the situation to the project stakeholders and manage their expectations
Re-evaluate ...read more
Call by Value passes a copy of the actual parameter, while Call by Reference passes the address of the actual parameter.
Call by Value: Changes made to the formal parameter inside the function do not affect the actual parameter.
Call by Reference: Changes made to the formal parameter inside the function affect the actual parameter.
Example: void swap(int a, int b) vs void swap(int &a, int &b)
The Diamond Problem in C++ occurs when a class inherits from two classes that have a common base class, leading to ambiguity in method resolution.
Diamond Problem arises in multiple inheritance in C++ when a class inherits from two classes that have a common base class.
Ambiguity occurs when the derived class tries to access a method or attribute from the common base class.
To resolve the Diamond Problem, virtual inheritance can be used to ensure that only one instance of the co...read more
Q69. Write a program to check a given string is palindrome or not
A program to check if a given string is a palindrome or not.
A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
To check if a string is a palindrome, we can compare the characters from the beginning and end of the string.
If the characters match at each position, the string is a palindrome.
We can use two pointers, one starting from the beginning and the other from the end, and compare the characters at each position....read more
Q70. What are features of JAVA?
Java is a versatile programming language known for its platform independence and rich set of features.
Platform independence: Java programs can run on any operating system or device with a Java Virtual Machine (JVM)
Object-oriented: Java supports the principles of object-oriented programming, allowing for modular and reusable code
Garbage collection: Java automatically manages memory allocation and deallocation, reducing the risk of memory leaks
Exception handling: Java provides ...read more
Q71. At what scale did you choose yourself in the programming language?
I chose myself in the programming language at a small scale and gradually increased it.
Started with basic syntax and gradually moved to more complex concepts
Practiced on small projects before moving to larger ones
Learned from online resources and collaborated with peers
Continuously updated skills and learned new languages as needed
Q72. Space Survival Game Challenge
Ninja is in space with unlimited fuel in his super spaceship. He starts with a health level H
and his spaceship has an armour A
. Ninja can be on only one of the three planets at a ...read more
Determine the maximum time Ninja can survive in a space survival game challenge.
Create a function that takes initial health and armour as input for each test case
Simulate Ninja's movement between planets and update health and armour accordingly
Keep track of the maximum time Ninja can survive before health or armour reaches 0
Q73. How to check ram usage in linux EC2 instance
To check RAM usage in Linux EC2 instance, use the 'free' command.
Open the terminal or SSH into the EC2 instance
Type 'free' command and press enter
The output will show the total, used, and free memory in kilobytes
Use '-h' option to display the output in human-readable format
Use 'top' command to see the real-time memory usage of processes
Q74. How many such letter-pairs are there in the word SERVANT, having the same no. of letters left between them in the word as they have in the series?
Counting letter-pairs with same no. of letters left between them in the word SERVANT.
Identify the letter-pairs in the word SERVANT.
Count the number of letters between each pair.
Compare the count with the position of the pair in the word.
If they match, increment the count of such pairs.
Answer the total count of such pairs.
Q75. If there is some fest in your college and you are given the responsibility of parking 500 cars in your campus, how will you do it?
I would create designated parking areas, implement a parking management system, and utilize efficient parking strategies.
Create designated parking areas based on the capacity and layout of the campus.
Implement a parking management system to track and manage the parking spaces.
Utilize efficient parking strategies such as valet parking, shuttle services, and carpooling.
Ensure proper signage and directions to guide the drivers to available parking spaces.
Coordinate with event or...read more
Q76. Count Inversions Problem Statement
Given an integer array ARR
of size N
containing all distinct values, determine the total number of inversions present in the array.
An inversion is defined for a pair of integ...read more
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the conditions for inversion are met.
Use a nested loop to compare each element with all elements to its right.
Keep a count of the inversions found and return the total count at the end.
Q77. Is there an entry for purchase sales?
Yes, there is an entry for purchase sales.
The entry for purchase sales is a double-entry accounting system.
The purchase is recorded as a debit to the inventory account and a credit to the accounts payable account.
The sale is recorded as a credit to the sales account and a debit to the accounts receivable account.
The cost of goods sold is recorded as a debit to the cost of goods sold account and a credit to the inventory account.
Examples include recording the purchase of inven...read more
Q78. 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 of coins.
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 based on the current denomination.
The final value in the table will represent the total number of ways to make change for the specified value.
Consider edge cases such as when ...read more
Q79. What are the different kinds of terraform variables? What do you mean by terraform resource? Have you used terraform in your project?
Terraform variables can be of different types. Terraform resource is a declarative representation of infrastructure.
Terraform variables can be of type string, number, bool, list, map, object, set.
Terraform resource is a block of code that defines a piece of infrastructure.
Examples of resources are AWS EC2 instance, Azure Virtual Machine, Google Cloud Storage bucket.
Yes, I have used Terraform in my project.
An interface in OOP is a blueprint of a class that defines a set of methods that a class must implement.
Interfaces in Java are used to achieve abstraction and multiple inheritance.
Interfaces contain only method signatures, not method bodies.
Classes can implement multiple interfaces but can only extend one class.
Example: interface Shape { void draw(); }
Example: class Circle implements Shape { public void draw() { // draw circle } }
The starter dependency of the Spring Boot module is spring-boot-starter-parent.
The starter dependency provides a set of default configurations and dependencies to kickstart a Spring Boot project.
It includes commonly used dependencies like spring-boot-starter-web, spring-boot-starter-data-jpa, etc.
By including the spring-boot-starter-parent in your project, you inherit all the default configurations and dependencies managed by Spring Boot.
Q82. Reset Matrix Problem Statement
Given a 2D array ARR
with 'N' rows and 'M' columns, where each element is either 0 or 1, your task is to transform this matrix into a 'Good' matrix. A 'Good' matrix is one in whic...read more
Transform a 2D array into a 'Good' matrix by setting rows and columns to 0 if a 0 is found.
Iterate through the matrix to find 0s
For each 0 found, set all elements in its row and column to 0
Update the input matrix accordingly
Q83. How Data Flow in SCOM monitoring Tool? DB name for SCOM and DB queries for Data Grooming. Values for Operations Console Grooming How to unseal the sealed management pack Names of Management Packs you have worke...
read moreSCOM monitoring tool uses a database to store and process data. It also requires management packs for monitoring different components.
Data flows from agents to management servers and then to the database
SCOM uses SQL Server as its database
Data grooming queries can be found in the OperationsManagerDW database
Operations Console grooming values can be set in the Administration workspace
To unseal a management pack, use the 'Unseal-ManagementPack' PowerShell cmdlet
Examples of mana...read more
Q84. What is a dataframe and how it differs from dataset ?
A dataframe is a two-dimensional tabular data structure in which data is organized in rows and columns. It differs from a dataset in terms of structure and functionality.
A dataframe is a data structure in which data is organized in a tabular format with rows and columns.
It is commonly used in data analysis and manipulation tasks.
Dataframes can handle both structured and semi-structured data.
They provide a convenient way to store and manipulate large datasets.
Dataframes offer ...read more
Thrashing in operating systems occurs when a system is spending more time swapping data between memory and disk than actually executing tasks.
Occurs when the system is overwhelmed with too many processes competing for limited resources
Results in a decrease in system performance as the CPU is constantly switching between processes
Can be alleviated by optimizing resource allocation and reducing the number of active processes
Example: A system running multiple memory-intensive ap...read more
Q86. What you know about Machine and its function?
A machine is a device that performs a specific task using power and mechanisms.
Machines can be simple or complex, ranging from a simple lever to a complex computer.
Machines use energy to perform work, such as lifting, moving, or transforming materials.
Examples of machines include cars, airplanes, washing machines, and robots.
Machines can be classified into six types: lever, pulley, wheel and axle, inclined plane, wedge, and screw.
Q87. How data structures and variables are managed in memory in Python?
Python manages data structures and variables using dynamic memory allocation.
Python uses a heap to manage memory allocation for data structures and variables.
Variables are created dynamically and stored in memory as objects.
Python uses reference counting to keep track of the number of references to an object.
Garbage collection is used to reclaim memory for objects that are no longer referenced.
Examples of data structures in Python include lists, tuples, dictionaries, and sets...read more
Q88. What are the different types of loops used in C++?
C++ has three types of loops: for, while, and do-while.
For loop is used when the number of iterations is known beforehand.
While loop is used when the number of iterations is not known beforehand.
Do-while loop is similar to while loop, but it executes at least once before checking the condition.
Q89. Prime Time Again Problem Statement
You are given two integers DAY_HOURS
and PARTS
. Consider a day with DAY_HOURS
hours, which can be divided into PARTS
equal parts. Your task is to determine the total instances...read more
Calculate total instances of equivalent prime groups in a day divided into equal parts.
Divide the day into equal parts and find prime numbers in each part.
Identify prime groups with prime numbers at the same position in different parts.
Count the total instances of equivalent prime groups.
Ensure DAY_HOURS is divisible by PARTS and handle constraints.
Return the number of equivalent prime groups for each test case.
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructor, fields, and methods, while interface cannot have any implementation.
A class can implement multiple interfaces but can only extend one abstract class.
Abstract class is used to define common characteristics of subclasses, while interface is used to define a contract for classes to implement.
Example: Abstract class 'Animal' with abst...read more
Q91. Bipartite Graph Problem
Check whether a given graph is bipartite or not. Return true
if the graph's vertices can be divided into two independent sets, ‘U’ and ‘V’, such that every edge (‘u’, ‘v’) either connect...read more
Check if a given graph is bipartite by dividing vertices into two independent sets.
Use BFS or DFS to traverse the graph and assign colors to vertices to check for bipartiteness.
If an edge connects vertices of the same color, the graph is not bipartite.
Return true if all edges connect vertices of different colors, else return false.
Q92. Boundary Traversal of Binary Tree
Given a binary tree of integers, your task is to print the boundary nodes of the binary tree in an anti-clockwise direction starting from the root node.
Note:
The boundary incl...read more
Boundary traversal of a binary tree in anti-clockwise direction starting from the root node.
Implement a function to calculate the boundary traversal of a binary tree
Include nodes from left boundary, leaf nodes, and right boundary in sequence
Ensure only unique nodes are included in the output
Print the boundary nodes separated by single spaces for each test case
Q93. Print Diagonal Elements of a 2D Matrix
Given a 2D matrix, your task is to create and return a 2D vector that contains all elements of the matrix arranged in a diagonal fashion.
Input:
The first line contains an...read more
The task is to create and return a 2D vector containing diagonal elements of a given 2D matrix.
Iterate through the matrix diagonally to extract elements
Store the elements in a 2D vector in the required order
Handle cases where the matrix is not square by adjusting the diagonal traversal
Q94. Rat in a Maze Problem Statement
You need to determine all possible paths for a rat starting at position (0, 0) in a square maze to reach its destination at (N-1, N-1). The maze is represented as an N*N matrix w...read more
Find all possible paths for a rat in a maze from start to finish.
Use backtracking to explore all possible paths in the maze.
Keep track of visited cells to avoid loops.
Return all valid paths sorted in alphabetical order.
Q95. A task of parking is given, how will you go forward with it?
I would analyze the requirements and constraints of the parking task and devise a plan accordingly.
Understand the size and type of vehicles that need to be parked
Analyze the available space and layout of the parking area
Consider any regulations or restrictions on parking
Determine the optimal parking arrangement for maximum efficiency
Implement a system for monitoring and managing the parking area
Types of constructors in OOP include default, parameterized, copy, and static constructors.
Default constructor: Constructor with no parameters.
Parameterized constructor: Constructor with parameters to initialize object properties.
Copy constructor: Constructor that creates a new object as a copy of an existing object.
Static constructor: Constructor used to initialize static data members of a class.
Limitations of inheritance in OOP include tight coupling, lack of flexibility, and potential for creating deep class hierarchies.
Tight coupling: Subclasses are tightly bound to their superclasses, making it difficult to make changes without affecting other classes.
Lack of flexibility: Subclasses inherit all attributes and methods from their superclasses, limiting the ability to customize behavior.
Deep class hierarchies: Inheritance can lead to deep class hierarchies with mult...read more
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 and dependency.
Denormalization involves combining tables to improve query performance by reducing the number of joins needed.
Normalization helps maintain data integrity by reducing the risk of anomalies such as update, insert, an...read more
Q99. Which programming languages do you use regularly in your work?
I use multiple programming languages depending on the task at hand.
Python for automation and scripting
Java for building applications
Bash for shell scripting
SQL for database management
JavaScript for web development
Go for microservices
Perl for text processing
C/C++ for system-level programming
Q100. You have to take responsibility of the parking section of an event which has 500 cars. How will you manage the task given to you?
I will manage the parking section of the event by implementing a systematic approach and utilizing technology.
Create a parking plan and layout to efficiently accommodate 500 cars.
Assign dedicated parking spots for VIPs, disabled individuals, and event staff.
Implement a ticketing system or RFID technology to track and manage parking spaces.
Deploy parking attendants to guide drivers and ensure smooth traffic flow.
Utilize digital signage or mobile apps to provide real-time parki...read more
Top HR Questions asked in Infosys
Interview Process at Infosys

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

