PrepBytes Blog

ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING

Sign in to your account

Forgot your password?

Login via OTP

We will send you an one time password on your mobile number

An OTP has been sent to your mobile number please verify it below

Register with PrepBytes

Infosys java language questions.

' src=

Last Updated on February 22, 2023 by Prepbytes

Infosys is a global leader in technology services and consulting, with a diverse range of projects and clients across industries. Working at Infosys offers many perks and benefits for employees. Founded in 1981, the company has grown to become one of the largest IT services companies in the world. Infosys is a well-established and highly respected company in the IT industry, and it has a strong reputation for delivering high-quality services and innovative solutions. Infosys is committed to the professional development of its employees, and it provides ongoing training and career advancement opportunities. Whether you are just starting out in your career or looking to take the next step, Infosys is an excellent choice for those who are looking to grow and develop professionally.

In this article, we have compiled the Java Questions that were asked in interviews before. So, let us start.

Infosys Java Language Questions: Fundamentals

Here are the questions that were previously asked in the interviews at Infosys.

Q1. What are List, Set, and Map in Java? Ans. List, Set, and Map are all data structures in programming that are used to store collections of values or objects. However, they differ in their properties and the way they store and manage data.

  • List: A List is an ordered collection of elements that allows duplicates. Lists can be implemented as arrays or linked lists and are useful for storing collections of items that need to be maintained in a specific order.
  • Set: A Set, on the other hand, is an unordered collection of unique elements. Sets can be implemented as hash sets or trees and are useful for representing collections of elements where the uniqueness of elements is important and order is not.
  • Map: A Map is a collection of key-value pairs where each key is unique. Maps can be implemented as hash maps or trees and are useful for storing collections of values where each value is associated with a specific key. The key is used to retrieve the value, so maps are often used to implement dictionaries or lookups.

Q2. Which classes in Java support mutable Strings? Ans. In Java, the StringBuilder and StringBuffer classes support mutable strings. These classes provide a convenient and efficient way to manipulate strings in memory, as they allow for operations such as appending, inserting, and deleting characters from a string without creating a new string object each time.

The StringBuilder class is not thread-safe, while the StringBuffer class is thread-safe. Therefore, if you are working with multiple threads and need to ensure that your mutable string operations are synchronized, you should use StringBuffer. Otherwise, if you are working in a single-threaded environment, StringBuilder is typically the preferred choice due to its higher performance.

Q3. Does Java8 support Multiple Interfaces? Ans. Yes, Java 8 and later versions support multiple interfaces. In Java, a class can implement multiple interfaces by separating the interface names with commas in the implements clause of the class definition. For example

Here, MyClass implements both Interface1 and Interface2. This feature was available in previous versions of Java as well, and it continues to be supported in Java 8 and later versions.

Q4. What do you mean by String Immutability in Java? Ans. In Java, a string is immutable, which means that once a string object is created, its value cannot be changed. If you want to modify a string, you need to create a new string object with the desired value. This is different from some other programming languages where strings can be modified directly. The immutability of strings in Java is enforced by making the string class final and ensuring that its instance variables (i.e., the characters in the string) are declared as private final.

Q5. What is OOP and what are its advantages? Ans. OOP stands for Object-Oriented Programming. It is a programming paradigm that emphasizes the use of objects and classes to represent real-world entities and concepts. In OOP, a program is made up of objects that interact with each other to perform specific tasks.

Here are some advantages of using OOP:

  • Modularity: OOP allows for the creation of self-contained and modular programs. This makes it easier to maintain and modify code, as changes can be made to one part of the program without affecting the rest of the program.
  • Reusability: OOP enables the creation of reusable code. Once a class is created, it can be used by other parts of the program or by other programs entirely. This can save time and effort in development.
  • Encapsulation: OOP allows for encapsulation, which means that data and methods are bundled together in a single unit, such as a class. This provides a level of abstraction, which makes it easier to manage complexity and prevents unwanted changes to the data.
  • Inheritance: OOP supports inheritance, which allows new classes to be based on existing classes. This enables the creation of more specialized classes that inherit the properties and methods of the base class. This can save time and effort in development.
  • Polymorphism: OOP supports polymorphism, which allows different objects to be treated as if they were of the same type. This enables the creation of flexible and extensible programs.

Overall, OOP provides a structured approach to programming that can make code more modular, reusable, and easier to maintain and modify.

Q6. What is Weak Hash Map? Ans. Weak Hash Map is a class in Java that is a type of Map that allows the garbage collector to remove keys from the map if they are no longer referenced elsewhere in the program. This is different from a regular HashMap, where keys remain in the map until they are explicitly removed, even if they are no longer needed.

In a WeakHashMap, each key is stored as a weak reference, which means that it may be garbage collected when no other references to the key exist. This is useful in situations where the keys are not needed anymore and you want to free up memory.

It’s worth noting that because keys in a WeakHashMap can be garbage collected, the map may not always be consistent or predictable in its behavior, since it may be modified by the garbage collector in ways that are difficult to anticipate.

Q7. What are Static Overloading and Dynamic Overloading in Java? Ans. In Java, overloading refers to the practice of defining multiple methods with the same name but different parameters. There are two types of overloading in Java:

  • Static Overloading: Static overloading is also called compile-time overloading because the decision of which method to call is made at compile-time based on the parameters passed to the method. In other words, the method signature is used to determine which method to call. This means that the static overloading is resolved at compile-time and is independent of the object being referred to.
  • Dynamic Overloading: Dynamic overloading is also called runtime overloading because the decision of which method to call is made at runtime based on the object being referred to. In other words, the type of the object determines which method to call. This means that dynamic overloading is resolved at runtime and is dependent on the object being referred to. Dynamic overloading is used in polymorphism, where objects of different classes can be referred to using a common interface, and the appropriate method is called based on the type of the object being referred to.

Q8. State the Differences Between an Array and an ArrayList? Ans. Here are some differences between an array and an ArrayList in Java:

  • Size: Arrays have a fixed size that is determined when they are created, and this size cannot be changed. ArrayLists, on the other hand, can grow and shrink dynamically as elements are added and removed.
  • Type: Arrays can store primitive data types, as well as objects of any class. ArrayLists can only store objects, not primitives.
  • Memory allocation: Arrays are stored in contiguous memory locations, while ArrayLists are implemented using an underlying array that can be resized as needed.
  • Performance: Arrays are generally faster when accessing elements since they use direct indexing. ArrayLists, on the other hand, are slower when accessing elements, since they use an iterator or the get() method to access elements.
  • Length: The length of an array is defined using the length attribute, whereas the length of an ArrayList is defined using the size() method.

Q9. Enlist the Differences between String and StringBuffer. Ans. Here are some differences between String and StringBuffer in Java:

  • Immutability: String objects are immutable, which means that once a string object is created, its value cannot be changed. StringBuffer objects are mutable, which means that you can modify the value of the object after it’s created.
  • Thread-safety: String objects are thread-safe, which means that they can be accessed by multiple threads at the same time without any issues. StringBuffer objects, on the other hand, are not thread-safe, but there is a thread-safe version called StringBuilder.
  • Performance: Because String objects are immutable, creating a new String object each time you modify it can be inefficient. StringBuffer objects, on the other hand, can be modified without creating a new object each time, making them more efficient in certain situations.
  • Usability: Strings are generally used to represent constants, whereas StringBuffer is used to represent mutable sequences of characters.
  • Methods: String has limited methods to modify its content, such as substring, replace, and concat. StringBuffer provides a variety of methods to modify its content, such as append, insert, delete, and replace.

Overall, if you need to modify a string frequently or if performance is a concern, then you should use StringBuffer or StringBuilder. If you need to represent a constant value, then you should use String.

Q10. What Types of Inheritance are supported in Java? Ans. In Java, there are five types of inheritance that are supported:

  • Single Inheritance: A subclass extends a single superclass.
  • Multilevel Inheritance: A subclass extends a superclass, which in turn extends another superclass.
  • Hierarchical Inheritance: Multiple subclasses extend a single superclass.
  • Multiple Inheritance (through interfaces): A subclass implements multiple interfaces, which define the behaviors that the subclass must implement.
  • Hybrid Inheritance: This is a combination of any two or more types of inheritance mentioned above.

However, it’s worth noting that Java doesn’t support multiple inheritance of classes, only interfaces, to avoid the "diamond problem".

Infosys Java Language Questions: Coding

In this section, we will discuss Infosys Java Language Questions. There is a higher probability that you will see these questions in your interview.

Q1. Write a Java program to Rotate a Matrix by 90 degrees. Ans.

Q2. Write a Java Program to convert Decimal Number to Binary Number. Ans.

Q3. Write a Java Program to Add Two Numbers without using the Addition Operator. Ans.

Q4. Write a program for the Spiral Traversal of a Matrix in Java. Ans.

Q5. Write a Java Program to remove duplicates in an array. Ans.

Frequently Asked Questions (FAQs)

Here are some Frequently Asked Questions:

Q1: How to prepare for Infosys Java language questions? A: To prepare for Infosys Java language questions, candidates should focus on mastering the basic concepts of the language and practice coding exercises and sample questions. They can refer to standard textbooks and online resources that cover Java programming in detail. Candidates can also take mock tests and practice previous year’s question papers to get a sense of the type of questions asked and the level of difficulty. Additionally, they can participate in coding challenges and competitions on various online judges to enhance their skills and gain practical experience.

Q2: What is the difficulty level of Infosys Java language questions? A: The difficulty level of Infosys Java language questions can vary depending on the job position and the level of the candidate’s experience. Typically, Infosys Java language questions for entry-level positions are of moderate difficulty and focus on fundamental concepts, while the questions for experienced positions may be more complex and cover advanced topics. The questions are doable if someone has decent exposure to programming.

Q3: Are Infosys Java language questions only asked in written tests, or are they also asked in interviews? A: Infosys Java language questions are typically asked in both written tests and interviews. In written tests, candidates may be asked multiple-choice or descriptive questions to test their understanding of the language’s syntax, data types, and programming constructs. In interviews, the questions may be more focused on the candidate’s problem-solving ability, coding skills, and ability to design and implement programs using Java. The interviewer may also ask the candidate to explain their code, provide alternate solutions, and discuss the trade-offs and limitations of different approaches.

Q4. What are other rounds in the Infosys Recruitment Process? A: The three steps of the Infosys recruiting process are given below:

  • Round 1: Online Test
  • Round 2: Technical Interview
  • Round 3: HR Interview

It should be noted that for some job positions, there may be extra technical rounds in between.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

  • Linked List
  • Segment Tree
  • Backtracking
  • Dynamic Programming
  • Greedy Algorithm
  • Operating System
  • Company Placement
  • Interview Tips
  • General Interview Questions
  • Data Structure
  • Other Topics
  • Computational Geometry
  • Game Theory

Related Post

What is infosys, infosys syllabus, infosys interview experience, infosys hr interview questions, infosys technical interview questions, infosys c language questions.

infosys lex java assignment solutions

  • Internships New

InfyTQ - Java Coding Questions

Sanket Mishra

Sanket Mishra

Coding comprises 60% of the total weightage in the InfyTQ examination. If you are thoroughly prepared with the coding part then the chances of cracking the exam increase significantly as the cutoff is 65%.

Practice InfyTQ exam with Edyst Special Test Prep. Pack! Try 1 Free Module!

infosys lex java assignment solutions

In this article, we will be discussing some previous coding questions that have been asked in the InfyTQ examination. This will give you an idea of the pattern of the questions asked.

To know the pattern and syllabus of the InfyTQ examination check our previous article on How to Prepare for the Infytq Examination?

Here are some of the Java coding questions that have been asked in previous years.

QUESTION 1:

Input: Given a list of numbers separated with a comma.The numbers 5 and 8 are present in the list.

Assume that 8 always comes after 5.

Case 1: num1 -> Add all numbers which do not lie between 5 and 8 in the Input List.

Case 2: num2 -> Numbers formed by concatenating all numbers from 5 to 8 in the list

.Output: Sum of num1 and num2

Example: 3,2,6,5,1,4,8,9

Num1: 3+2+6+9 =20

Num2: 5148O/p=5148+20 = 5168

Solution in Java

Question 2:.

A string which is a mixture of letters, numbers, and special characters from which produce the largest

even number from the available digit after removing the duplicates digits.

If an even number did not produce then return -1.

Ex: infosys@337

— — — — — — — — — — — -

Hello#81@21349

O/p : 984312

QUESTION 3:

Take input a number ’N’ and an array as given below.

Input:-N = 2

Array =1,2,3,3,4,4

Find the least number of unique elements after deleting N numbers of elements from the array.

In the above example, after deleting N=2 elements from the array.

In above 1,2 will be deleted.

So 3,3,4,4 will be remaining so,

2 unique elements are in the array i.e 3 and 4.

QUESTION 4:

A non-empty string containing only alphabets. print the longest prefix from the input string which is the same as the suffix.

Prefix and Suffix should not be overlapped.

Print -1 if no prefix exists which is also the suffix without overlap.

Do case-sensitive comparison.

Positions start from 1.

Input : xxAbcxxAbcxx

o/p: xx (‘xx’ in the prefix and ‘xx’ in the suffix and this is the longest one in the input string so the output will be ‘xx’).

Input: Racecar

o/p: -1 (There is no prefix which is also a suffix so the output will be -1).

QUESTION 5:

Number of odd sub-arrays.

Find the number of distinct subarrays in an array of integers such that the sum of the subarray is an odd integer, two subarrays are considered different if they either start or end at different indexes.

Explanation : Total subarrays are [1], [1, 2], [1, 2, 3], [2], [2, 3], [3]

In this there are four subarrays which sum is odd i.e: [1],[1,2] ,[2,3],[3].

The questions asked are of medium difficulty and can be easily solved if you practice well. Practice on Complete Coding Test & Interview Preparation Pack to succeed at Coding rounds at companies like TCS (Ninja), Wipro, Infosys, Mindtree, ValueLabs, CGI, and many more.

W hen you practise, you get better. It’s very simple .

We hope you find this piece of writing helpful in any way possible.

Wanna drop us some suggestions & ideas to write articles on? Write to us @ [email protected]

Visit Edyst Website — www.edyst.com

Visit Edyst YouTube Channel — www.youtube.com/edyst

Visit Edyst Instagram Page- www.instagram.com/edystme/

Visit Edyst Telegram Channel- t.me/edystannouncements

About Edyst:

We are an online learning destination for aspiring software developers to get ready for the most in-demand job.

Check Edyst Most Popular Courses:

- Full Stack Web Developer Bootcamp

- Adv. Algorithms and Data Structures Bootcamp

- Python Programming: Intro + Advanced

- Java Programming: Intro + Advanced

- Complete Coding Test and Preparation Pack

- Wipro Elite NLTH 2021 Test Pack

Blog Author Image

Sanket is currently pursuing B.tech in Information Technology and loves to solve real-life problems through coding. He loves doing competitive programming & has also worked as a Content Creator Intern in many companies.

infosys lex java assignment solutions

Company Preparation Pack

Try past year questions of companies of Accenture, Wipro, Cognizant, EPAM, Mintree, Capgemini.

Crack exams like TCS Ninja NQT, TCS Digital, Infosys HackWithInfy, Hexaware, Infosys Infy TQ, TCS CodeVita.

Try our Free Pack

See more companies

infosys lex java assignment solutions

Basics Of Java

Enroll with the best online training institute, offering quality courses to fulfill your Basic Of Java needs, be it entry level or at an expert level!!

Latest posts

Weather App Application Project Using Python [2023]

Weather App Application Project Using Python [2023]

Book Query Application Project Using Python [2023]

Book Query Application Project Using Python [2023]

How FTX crashed and how FTX went from the 3rd largest cryptocurrency to bankruptcy in 2022?

How FTX crashed and how FTX went from the 3rd largest cryptocurrency to bankruptcy in 2022?

How to prepare for technical interview questions in 2023

How to prepare for technical interview questions in 2023

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

This repository contains all the assignments of Infosys Foundation Program 5.0.

sourabhgupta385/Infosys-Assignments

Folders and files, repository files navigation, infosys-assignments.

  • Python 100.0%

IMAGES

  1. Infosys Lex java assignment Question with answer

    infosys lex java assignment solutions

  2. Infosys Springboard Lex Assignment Answers

    infosys lex java assignment solutions

  3. Infosys Springboard Lex Assignments Answers

    infosys lex java assignment solutions

  4. Exception Assignment -1

    infosys lex java assignment solutions

  5. Programming using Java Infosys Lex assessment answers |Infosys Generic

    infosys lex java assignment solutions

  6. Programming_using_Java_Assessment_Solution of "Infosys Springboard

    infosys lex java assignment solutions

VIDEO

  1. Java breeding progress|fawn java breeding progress|white java breeding progress|#java

  2. Accenture Mass Hiring 2024 || 2024 and 2023 Batch Eligible || All Branches Eligible || CTC-4.7LPA

  3. Nandan Nilekani at IIMB’s 41st Annual Convocation

  4. FACTS with STATS 255 #shorts #ytshorts #facts #nuclearwarheads #present #countries #stats

  5. Practical Blockchain and Smart Contracts: Ethereum and Solidity

  6. Infosys privacy by design lex assessment sol

COMMENTS

  1. infytq-assignment-solutions · GitHub Topics · GitHub

    To associate your repository with the infytq-assignment-solutions topic, visit your repo's landing page and select "manage topics." GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

  2. Programming using java Infosys springboard answers

    Read this before starting this course👇 Infosys Springboard/lex Java Assignments (Programming Using Java) This certification course is available on springboar...

  3. GitHub

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  4. Infosys Lex java assignment Question with answer

    In this video I have solved an assignment question on Abstract class example using Java.This question was asked in Infosys InterviewsFor more java assignment...

  5. Infosys Springboard Lex Assignments Answers

    Infosys Springboard Assignments Solutions| Programming using Java course | Java programming language | 2023Infosys Springboard Assignments Answers:https://yo...

  6. Solutions to InfyTQ Assignments, quiz and tests.

    InfyTQ is a free platform open to all engineering students in their third and fourth year across India. The platform encourages holistic development by imparting technical as well as professional skills and help them become industry ready. I started this course on June 15th 2019. The platform consists of various assignments with rising ...

  7. Lex

    Learn new skills and grow your career with Lex, the online learning platform for Infosys employees.

  8. Lex

    These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in, retaining the user's language and regional preference(s) at the end of each browsing session and for tracking session idle time.

  9. Infosys Java Language Questions and Answers 2023

    Infosys Java Language Questions: Coding. In this section, we will discuss Infosys Java Language Questions. There is a higher probability that you will see these questions in your interview. Q1. Write a Java program to Rotate a Matrix by 90 degrees. Ans. Java. class Main {. static int N = 4;

  10. Infosys Springboard Lex Assignments Answers

    Infosys Springboard Lex Assignments Answers | OOP, Methods and Constructors | Programming Using JavaInfosys Springboard Assignments Answers:https://youtu.be/...

  11. ErShreyas/InfyTQ-Programming-Using-Java

    Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video. - GitHub - ErShreyas/InfyTQ-Programming-Using-Java: Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video.

  12. Lex All Assignment Answers

    Lex All Assignment Answers - Free download as PDF File (.pdf) or read online for free.

  13. InfyTQ

    Basics Of Java. Enroll with the best online training institute, offering quality courses to fulfill your Basic Of Java needs, be it entry level or at an expert level!! 2 days. InfyTQ features Java coding questions, that require you to be up-to-date with the latest released technologies in the industry.

  14. After watching the video, load the dataset on the

    In what year and month did the Company have the highest credit. After watching the video, load the dataset on the second sheet of the Excel workbook into Tableau to complete the questions in this assignment. 1. Which Super Store customer accounts for the most credit sales? multiple choice 1 John Lee William Brown Paul Prost Matt Abelman 2.

  15. Infosys Springboard Lex Assignment Answers

    Infosys Springboard Lex Assignment Answers | Array | Programming Using JavaInfosys Springboard Assignments Answers:https://youtu.be/phripxnkqxoInfosys Spring...

  16. MCU at a glance

    Welcome to the website of Moscow City University. We have created it so that any user - from applicants to teachers - can freely navigate through the large space of information of the university. Moscow City is a team of students, teachers, alumni and all those who share our values. Become a part of our close-knit team.

  17. Lex

    Cloud-first and mobile-first solution that enables organizations to focus on training their talent of today, to be ready for tomorrow. Lex About Us Help & Contact Certificate Verification

  18. Moscow Minecraft Maps for Java Edition

    17th microdistrict of Yasenevo, Moscow 1:1. Land Structure Map. 8. 4. 177 5. x 6. Egor_Ant073 • 12 hours ago. Moscow Block of flats / Marino District, Pererva St. 3D Art Map.

  19. Infosys Springboard Lex Assignments Answers

    Infosys Springboard Lex Assignments Answers | Control Structure | Programming Using Java | 2023Infosys Springboard Assignments Answers:https://youtu.be/phrip...

  20. Programming Using Java Solutions

    Hii friends, In this repo I have provided Infosys Springboard Assignment's solutions. If you are facing any problem while doing assignments you can comment below the video. - ErShreyas/InfyTQ-...

  21. PDF 81st Moscow Olympiad for Students in Physics 2020 Grade 11, Round 1

    Moscow Physics Olympiad 2020 11th Grade Round 1 Figure 7: Problem 5 1.In the roughest model we assume that the pressure on the left side is P 0 = 105 Pa and on the right side it's zero.

  22. Infosys Springboard Lex Assignment Answers

    Infosys Springboard Assignment Answers | String | Programming Using JavaInfosys Springboard Assignments Answers:https://youtu.be/phripxnkqxoInfosys Springboa...

  23. sourabhgupta385/Infosys-Assignments

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.