Interview Questions and Answers for 'Infosy' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Infosy' - 97 question(s) found - Order By Rating

next 30
 Q1. What are the best strategies to improve code readability ? General
Ans. https://dzone.com/articles/10-tips-how-to-improve-the-readability-of-your-sof

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 2 Companies


 Q2. What is a base class ? Is Abstract class and Base class the same thing ?Core Java
Ans. Base Class is a relative term. For example - Class Vehicle is a Base class of Class Car. Even though Base class is derived in this case , there is no restriction on instantiation of Vehicle class.

Abstract Class is a class that is meant only to be a Base Class and not allowed to be instantiated.

Abstract Class is a Base Class that isn't allowed to be instantiated and is only meant for carrying definition to derived class and help participate in runtime polymorphism.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q3. How can we click on hidden element.Html
Ans.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     html hidden element     Asked in 1 Companies


 Q4. Explain Hibernate caching mechanismHibernate
Ans. Every fresh session having its own cache memory, Caching is a mechanism for storing the loaded objects into cache memory. The advantage of cache mechanism is, whenever again we want to load the same object from the database then instead of hitting the database once again, it loads from the local cache memory only, so that the no. of round trips between an application and a database server got decreased. It means caching mechanism increases the performance of the application.

In hibernate we have two levels of caching

First Level Cache [ or ] Session Cache
Second Level Cache [ or ] Session Factory Cache [ or ] JVM Level Cache

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 23 Companies


 Q5. Why is Java platform independent ?Core Java
Ans. Platform independent language means once compiled you can execute the program on any platform (OS). Java is platform independent. Because the Java compiler converts the source code to bytecode, which is Intermediate Language. Bytecode can be executed on any platform (OS) using JVM( Java Virtual Machine).

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q6. What is TypeCasting ?Core Java
Ans. Assigning a value of one type to a variable of another type is known as Type Casting.

Example :

int x = 10;
byte y = (byte)x;

In Java, type casting is classified into two types, Widening Casting(Implicit) widening-type-conversion and Narrowing Casting (Explicitly done) narrowing-type-conversion.

Widening or Automatic type converion - Automatic Type casting take place when,the two types are compatible and the target type is larger than the source type

Example :

public class Test {
public static void main(String[] args) {
int i = 100;
long l = i; //no explicit type casting required
float f = l;//no explicit type casting required
System.out.println("Int value " i);
System.out.println("Long value " l);
System.out.println("Float value " f);
}
}

Narrowing or Explicit type conversion - When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting.

Example :

public class Test{
public static void main(String[] args) {
double d = 100.04;
long l = (long)d; //explicit type casting required
int i = (int)l;//explicit type casting required
System.out.println("Double value " d);
System.out.println("Long value " l);
System.out.println("Int value " i);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     typecasting  type casting     Asked in 23 Companies


  Q7. Difference between Arrays and ArrayList ?Core Java
Ans. Both Arrays and ArrayLists are used to store elements. Elements can be either primitives or objects in case of Arrays, but only objects can be stored in Arraylist. Array is a fixed length data structure while arraylist is variable length collection class. Once created, you cannot change the size of the arrays, but arraylists can dynamically resize itself when needed.Another notable difference between Arrays and Arrayslist is that arary is part of core java programming and array list is part of collection classes

  Sample Code for arrays arraylist

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     array  arraylist  array vs arraylist     Asked in 7 Companies      basic        frequent


 Q8. Describe structure of a Web application.architecture
Ans. WEB APP |WEB-INF - META-INF | | | META-INF.MF | lib - WEB.xml - Classes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     web application     Asked in 3 Companies      intermediate        frequent


 Q9. Can we have multiple inheritance in java using abstract class ?Core Java
Ans. No

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class   multiple inheritance  object oriented programming (oops)  oops concepts     Asked in 2 Companies


  Q10. Write code to sort an array.Algorithm
Ans. https://www.geeksforgeeks.org/arrays-sort-in-java-with-examples/

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     array  sorting     Asked in 16 Companies      basic        frequent


 Q11. What is setter injection ?Spring
Ans. Setter Injection in Spring is a type of dependency injection in which the framework injects the dependent objects into the client using a setter method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     setter injection   dependency injection     Asked in 2 Companies


 Q12. What methodology and technology stack do you use ?General
Ans. [Open Ended Answer]

Possible Answer - We are using Agile. We have daily standups, Bi weekly Backlog Grooming , Planning and Retrospective, We have a 2 week sprint and We use Jira for Scrum Management. We are using Java 8, Spring Boot, JSF , Apache Kafka , Soap as well as Rest Services.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 9 Companies


 Q13. What is garbage collection ?Core Java
Ans. The garbage collection is a facility wherein a program runs on the Java Virtual Machine which gets rid of objects, which are not being used by a Java application anymore. It is a form of automatic memory management and recollection.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 4 Companies


 Q14. Why do you want to leave your current job ?General
Ans. The most effective and acceptable reasons for leaving your current job should be positive e.g. moving forward in your life or career

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 21 Companies


 Q15. What is your role in current project ?General
Ans. Possible Answer - Java Developer

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 5 Companies


 Q16. Should we have instance variables in the Spring Bean which has been scoped as Singleton ?Spring
Ans. No, if required we should only have final variables. Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     singleton     Asked in 1 Companies


 Q17. Explain flow of MVCDesign
Ans. It is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


  Q18. Explain OOps concepts.Core Java
Ans. There are four main OOP concepts in Java. These are:

Abstraction. Abstraction means using simple things to represent complexity. We all know how to turn the TV on, but we don?t need to know how it works in order to enjoy it. In Java, abstraction means simple things like objects, classes, and variables represent more complex underlying code and data. This is important because it lets avoid repeating the same work multiple times.

Encapsulation. This is the practice of keeping fields within a class private, then providing access to them via public methods. It?s a protective barrier that keeps the data and code safe within the class itself. This way, we can re-use objects like code components or variables without allowing open access to the data system-wide.

Inheritance. This is a special feature of Object Oriented Programming in Java. It lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel.

Polymorphism. This Java OOP concept lets programmers use the same word to mean different things in different contexts. One form of polymorphism in Java is method overloading. That?s when different meanings are implied by the code itself. The other form is method overriding. That?s when the different meanings are implied by the values of the supplied variables. See more on this below.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops concepts     Asked in 16 Companies      basic        frequent


 Q19. Difference between JVM, JRE and JDK ?Core Java
Ans. JDK(Java Development kit) = Development Kit comprising of JVM , library and development tools for developers

JRE (Java Run time Environment) - Comprise of JVM and set of libraries

JVM(Java Virtual Machine) = Interpreter which reads the .class file line by line.

When we install JDK, JRE also get installed so we can write,compile and excute our code. Used by developer. Without JDK we can only execute the program using JRE.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     jvm  jre  jdk  jvm vs jre vs jdk     Asked in 4 Companies


 Q20. What is abstraction ?Design
Ans. Abstraction is a process of hiding the implementation details and describing only the functionality to the user.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     bstraction  oops concepts  oops principle     Asked in 22 Companies


 Q21. What is the difference between SDLC and Agile ?Process
Ans. Here are the differences between Agile and Waterfall Methodology:

The software development process is divided into different phases in the Waterfall model while Agile methodology segregates the project development lifecycle into sprints

Waterfall is a structured software development methodology, and often times can be quite rigid, whereas the Agile methodology is known for its flexibility

According to the Waterfall model, software development is to be completed as one single project, which is then divided into different phases, with each phase appearing only once during the SDLC. However, the Agile methodology can be considered as a collection of many different projects, which are nothing but the iterations of the different phases focusing on improving the overall software quality with feedback from users or the QA team

If you want to use the Waterfall model for software development, then you have to be clear with all the development requirements beforehand as there is no scope of changing the requirements once the project development starts. The Agile methodology, on the other hand, is quite flexible, and allows for changes to be made in the project development requirements even after the initial planning has been completed

All the project development phases such as designing, development, testing, etc. are completed once in the Waterfall model while as part of the Agile methodology, they follow an iterative development approach.

As a result, planning, development, prototyping and other software development phases can appear more than once during the entire SDLC One of the major differences between Agile and Waterfall development methodology is their individual approach towards quality and testing.

In the Waterfall model, the Testing phase comes after the Build phase, but, in the Agile methodology, testing is typically performed concurrently with programming or at least in the same iteration as programming

While Waterfall methodology is an internal process and does not require the participation of customers, the Agile software development approach focuses on customer satisfaction and thus, involves the participation of customers throughout the development phase

The Waterfall model can be regarded as a stringently sequential process, however, the Agile methodology is a highly collaborative software development process, thereby leading to better team input and faster problem solving

The Waterfall model is best suited for projects which have clearly defined requirements and in which change is not expected at all, while Agile development supports a process in which the requirements are expected to change and evolve. Thus, if you are planning to develop a software that would require frequent overhauls and has to keep up with the technology landscape and customer requirements, Agile is the best approach to follow

The Waterfall model exhibits a project mindset and lays its focus strictly on the completion of project development, while Agile introduces a product mindset that focuses on ensuring that the developed product satisfies its end customers, and changes itself as the requisites of customers change

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     sdlc  agile  adlc vs agile     Asked in 3 Companies


 Q22. What is the difference between Singleton and Prototype Bean scope in Spring ?Spring
Ans. Prototype scope - A new object is created each time it is injected/looked up. It will use new SomeClass() each time.

Singleton scope - It is the default scope. The same object is returned each time it is injected/looked up. Here it will instantiate one instance of SomeClass and then return it each time.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Spring beans  singleton bean scope  prototype bean scope     Asked in 1 Companies


 Q23. What is ORM or Object Relationship Mapping ?Database
Ans. ORM is the mapping technique, which maps object with relational data model. As we know that in java we need objects we can not user data in relational(in table form). So ORM is set of guideline which allows us to map relational data model in object form.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     orm     Asked in 1 Companies        frequent


 Q24. Explain Generics in Java ?Core Java
Ans. Generics are a facility of generic programming that were added to the Java programming language in 2004 within J2SE5.0. They allow "a type or method to operate on objects of various types while providing compile-time type safety.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     generics     Asked in 7 Companies


  Q25. Explain OOPs

or

Explain OOPs Principles

or

Explain OOPs Concepts

or

Explain OOPs features

or

Tell me something about OOPs
Core Java
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features

1. Inheritance for Code Reuse
2. Abstraction for modularity, maintenance and agility
3. Encapsulation for security and protection
4. Polymorphism for flexibility and interfacing

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops features     Asked in 260 Companies      basic        frequent


 Q26. If an Abstract class has only abstract methods, What's the difference between such a class and an interface ?Core Java
Ans. Such a class still can have member elements which can be inherited and hence facilitate code reuse. Moreover Abstract class can have non final static elements whereas interfaces are only allowed to have static final elements.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class   interfaces     Asked in 2 Companies      Basic


 Q27. What is Amazon S3 ?Amazon Web Services (AWS)
Ans. Amazon Simple Storage Service or S3 is object storage with a simple web service interface to store and retrieve any amount of data from anywhere on the web.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     aws  amazon s3  aws s3  aws storage  amazon cloud storage  amazon s3     Asked in 12 Companies


Frequently asked Spring interview question.
 Q28. What are the components of Spring framework ?Spring
Ans. Core: [Core, Bean, Context, Expression Language]

Web: [Web, Portlet, Servlet, etc]

Data Access [JMS, JDBC, etc]

AOP, Aspect

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     spring  spring framework components     Asked in 12 Companies


 Q29. What is a Webdriver ?Testing
Ans. Selenium WebDriver is a tool for automating web application testing.It helps in replicating the manual tester behavior like keyboard entry, mouse events etc and then matching the output against the expected.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     selenium  webdriver     Asked in 37 Companies


 Q30. Write a Program to print factorial of a number using recursionCore Java
Ans. public class BuggyBread {
public static void main(String args[]) {
System.out.println(factorial(5));
}

private static int factorial(int number){
if(number == 1){
return 1;
} else {
return number * factorial(number - 1);
}
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     recursion     Asked in 25 Companies


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: