Ramya Shankar | 28 Jul, 2023

Infosys Interview Questions

 

Infosys is one company where interviewers are quite friendly and try to make you comfortable. In this blog, we will discuss a lot of questions that are popularly asked in the personal interview (technical) round as well as touch some important HR round questions.

HR questions play an important role because unlike many other companies, Infosys filters at least 20-30% candidates after the final HR round too. I wouldn’t say it is easy to crack Infosys interview, but if you have practiced enough, you will be confident. The confidence will surely show in the way answer – that’s the attitude interviewer will look for!

Top Infosys Interview Questions

Infosys technical interview is not purely technical. They focus more on overall personality and behavioral aspects – for example, how you respond to different situations (communication), whether you are able to think logically (reasoning), what is your approach to different types of problems (problem-solving) and handling stress (for experienced) are some important factors.

A typical interview will start with an exchange of pleasantries. These can be –

  • How are you doing today or how was your day so far?
  • Tell about yourself – previous experiences, any specific projects, etc…
  • How do you spend your weekends – your hobbies, favorite food, places to hang out, etc…
  • What is your favorite programming language?

Even if you choose one particular language as your favorite, the interviewer will touch upon questions around all the languages you have mentioned in your resume. As long as you are clear with the basics, you should be good to go.

Note that this list is compiled based on many interviews and all these questions are not from a single interview. Here are a few typically asked Infosys interview questions –

Software development

Question: What is SDLC?

Answer: Software Development Life Cycle (SDLC) is an end to end process that defines the flow of the development of a project from requirements stage to the maintenance and support stage. The stages in SDLC are requirements analysis, planning, definition, design, development, testing, deployment, and support (maintenance).

Read more: What are different SDLC Methodologies?

Question: Do you know what is waterfall model? (experienced candidates)

Answer: Just like waterfalls from top to bottom, this approach follows breaking down of project activities into different phases. Once a stage is completed, the next stage in the sequence is followed. Each stage is dependent on the result of the previous stage.

Answer: One of them is the waterfall model. The other is AGILE which is gaining more popularity now because of its continuous iteration methodology that is less prone to errors during production environment.

The interviewer may also ask you about the differences between agile and waterfall models.

C & C++ Questions

Question: Explain some important differences between C & C++.

Answer: For the interview, you will be checked only for your basic knowledge and key differences like –

C C++
C is a procedural language, hence there is no concept of classes, objects, inheritance, encapsulation, and polymorphism. C++ is an Object-Oriented language. Polymorphism, encapsulation and inheritance are the essences of OOPS.
Dynamic memory allocation is done through malloc() and calloc() functions Memory allocation is done using the ‘new’ operator.
Main function can be called from any other functions. Main function cannot be called from any other functions.
No operator and function overloading It is easy to implement function overloading and operator overloading in C++
You cannot run C++ code in C You can run most of the C code in C++
For input and output scanf and printf functions are used respectively. Cin and cout are respectively used for input and output.
Reference variables, virtual and friend functions are not supported These are supported fully
Exception handling is not supported Full support for exception handling

For your own curiosity, you can read this article to learn in-depth about the differences.

Question: What are the differences between C++ and Java? Which one do you think is better and why?

Answer: Both are based on OOPS concept. Following are the basic differences –

C++ JAVA
Platform dependent language You can write the code and run it anywhere. Java is platform-independent.
Used for system programming, for example OSs are written in C++. Used for application programming, like mobile and web-based applications.
Supports both pass by value and pass by reference Can pass variables only by the value
Developers can explicitly write code for pointers. Java uses pointers internally. Developers can’t write programs i.e. there is restricted support for pointers
Supports operator overloading No support for operator overloading
Supports multiple inheritances Doesn’t support multiple inheritances. (can be achieved through an interface)

When asked your opinion on which is better, there is no right or wrong answer. You can say what you like about C++ or Java more. For example, I don’t like pointers and Java doesn’t have it, so I can vote for Java. On the other hand, C++ supports operator overloading and passing by reference while Java doesn’t, so I can like C++ more because of this flexibility. This question is just to test if you can analyze and weigh the pros and cons of each.

 

Question: What is OOPS concept and how is it implemented in C++?

Answer: OOPS (or object-oriented programming) is a programming methodology where an application program is designed considering everything as objects. It makes programming easy. The main oops concepts are –

  • Class – contains methods and variables. You can use a class by creating objects of the class.
  • Inheritance – when there are common properties that can be reused, we can create a parent class. The child classes can then inherit the common methods and variables of the parent class. A very common example is the Animal class. If Dog and Lion are two different animals, they can inherit the common methods of Animal like run(), eat() or makeSound(). The sound of Dog and Lion are different, so each will have their own implementation.
  • Polymorphism – redefine the way the certain thing works using a different implementation. Polymorphism can be achieved using overloading and overriding.
  • Abstraction – for complex real-time programs, not all the details need to be shown to the user. Through abstraction, we can separate what an object does from how the object works and show only ‘what’ to the user.
  • Encapsulation – encapsulation is based on the concept of having the data and code into a single unit to hide the internal workings of the code to an end-user. For example, a class encapsulates several member variables and methods that may not be accessible outside the class.

As an extension, the interviewer can ask you to describe each or any of these. You can just explain the basic concept.

Question: What are Structs and how are they different from Classes?

Answer: Struct is a customized data type that contains other data types. For example,

struct Student {
int rollNumber;
char section;
void getName();
};
  • Members of a class are private by default, to make a variable public, we need to add the public modifier. In a struct, by default members are public and if we need any private members, we have to use a modifier.
  • A class can be inherited but structs cannot.

Question: What is a pointer? Give an example.

Answer: Pointer is a variable that stores the address of another variable. Pointers allow passing variables by references using the address. For example –

int a = 23;
int *ptr = &a;
cout << ptr;

ptr will store the address of a. That means the address of a is the value of ptr.

0x6788f30 0x4563edd81x

When we do *ptr, we will get the value stored in the address referenced by ptr i.e. 23. * is called the dereference operator.

Question: What is the difference between reference and pointer?

Answer: Pointer stores the address of a variable, but the reference is just a copy of a variable with a different name. References have to be initialized, whereas pointer need not be. To initialize pointer, we use the dereference operator,

int a;
int *ptr = &a;
// We use the & reference operator to initialize reference variable.
int a = 20;
int &ref = a;

In the above, while ptr will store address of a, ref will store the value of a (20). Learn more about references and pointers through this detailed article.

Question: How is dynamic memory allocation done in C/C++?

Answer: We have covered this answer in question 4 (comparison).

Question: What are virtual functions?

Answer: Suppose there is a class Customer. It has a function SendEmail() marked as virtual. Now any class that is derived from Customer must have its own implementation of SendEmail() function. Let us say the class PrivilegedCustomer is derived from Customer. PrivilegedCustomer should override the function SendEmail() to provide its own implementation.

Hence, virtual functions are functions that have to be overridden and ensure that the correct method is called.

Question: Give examples of data structures in C++.

Answer: There are two types of data structures in C++ ? linear and nonlinear.

  • Linear – data elements are stored in sequence. Example, stack, queue and linked list.
  • Non-linear – tree and graph that are not stored in sequential manner.

Question: Tell me one disadvantage of using C++.

Answer: There is no built-in support for threads. If they ask more, you can say it doesn’t support garbage collection.

Question: What is friend function/class?

Answer:

  • Friend function – if a function is marked as a ‘friend’ of a particular class, it can access the protected and private members of the class.
  • Friend class – same as function, if a class is marked as friend of another class, it can access the protected and private members of that class.

Example –

class Student {
private: int roll;
public: friend class Teacher;
};
Class Teacher{
private: float marks;
public: void getRollNumber(Student& stud){
cout << stud.roll;
}
};

Check also the C++ Interview Question.

Frequently Asked Java Questions

Question: How is polymorphism implemented in Java?

Answer: Method overloading or static polymorphism

That means a method with the same name can have different number of parameters. Based on the parameter list, the appropriate method will be called. For example,

Method overloading

print(String name){
//code
}
print(int marks, String name){
//code
}
print(String[] subjects, String name){
//code
}
// in the main program,
if(subjects.length >0){
print(String[] subjects, String name);
}else if(marks>0){
print(int marks, String name);
}else
print(String name);

Overriding or dynamic polymorphism

This is the case when a child class extends parent class. During run time when the object is created, the appropriate method will be created. You can take the popular PizzaShop example –

class PizzaShop{
void prepareDough(){
System.out.println(“Pizza shop fresh dough ready!”);
}
}
class IndianPizzaShop extends PizzaShop{
void prepareDough(){
System.out.println(“Welcome to IndianPizza, fresh dough is ready!”);
}
}
In the main class,
public static void main(String[] args) {
PizzaShop pizza = new IndianPizzaShop();
pizza.prepareDough();
}

The output will be - Welcome to IndianPizza, fresh dough is ready!

This means that the method prepareDough() is overridden by the child class IndianPizzaShop at runtime.

Question: What is the difference between stack and heap memory?

Answer:

Heap –

  • JRE uses it to allocate memory for objects and JRE classes.
  • Garbage collection is done on heap memory
  • Objects created on heap are accessible globally.

Stack –

  • Short term references like the current thread of execution
  • References to heap objects are stored in stack
  • When a method is called, a new memory block is created. Once the method gets executed, the block is used by the next program.

Stack memory size is smaller compared to heap memory.

Question: Write a program to check if a number is prime.

Answer: Pass the number let us say int number = 47;

// set default to not prime
boolean flag = false;
// prime numbers are divisible only by themselves and 1
for(int i = 2; i <= number/2; ++i)
{
// if no remainder
if(number % i == 0)
{
// number is divisible by i, so it is not prime.
flag = true;
// break the loop if the number is not prime
break;
}
}
// if flag is not equal to true
if (!flag)
System.out.println(number + " is prime.");
else
System.out.println(number + " is not prime.");

Question: Explain the concept of inheritance.

Answer: Inheritance is a concept where a child class can access the methods of a base class. Inheritance can be achieved by extending a parent class or by using interfaces.

class A{}
class B extends A{}
interface C{}
class D extends A implements C{}

Question: How is exception handling done in C++ and Java?

Answer: C++ and Java use the try/catch and throw keywords to handle exceptions. However,

  • In Java only the instances of Throwable or subclasses of Throwable can be thrown as an exception. In C++, even primitive types and pointers are allowed to be thrown as an exception.
  • Java has finally block which is executed after try-catch block. This block is used to execute some code irrespective of what happens in the code (clean up, clearing variables etc…). there is no such provision in C++.
  • To list the set of exceptions a method can throw, Java uses the ‘throws’ keyword, whereas in C++, throw does the job.
  • All exceptions are unchecked in C++. Java can have checked and unchecked exceptions.

Question: What is ‘null’ and how is memory allocation done for null objects?

Answer: When a non-primitive variable doesn’t point or refer to any object, it is called null.

  • String str = null; //declaring null
  • if(str == null) //Finding out if value is null
  • int length = str.length();//using a null value will throw NullPointerException;

Question: What is the difference between Array and ArrayList?

Answer:

  • The array has a fixed length, whereas the size of ArrayList can grow dynamically as elements are added.
  • ArrayList does not store primitives. If we have to store int elements, each should be wrapped into Integer objects to be stored in ArrayList. This is not the case with Array.

Question: Can you write a program to swap two numbers?

Answer:

int temp = 0;
temp = number1;
number1 = number2;
number2 = temp;

Question: Now write the same (above) program without using temporary variable. Is it possible?

Answer:

Let us say number1 = 10 and number2 = 20;

number1 = number1 + number2; // number1 is now 30
number2 = number1 - number2; // number2 is now 10(number1)
number1 = number1 - number2; // number1 is now 20(number2)

Question: What is a circular linked list?

Answer: Circular linked list is a list in which each node is linked to the next and the last one (tail) is linked to the first (head), completing a circle.

Circular Linked List

Image source: Wikipedia

Question: What are the different modifiers in Java?

Answer: public, private, protected and default are the modifiers in Java.

Question: What is a class? How to create an object? If a class is static, can you create an object?

Answer: Class encapsulates variables of different types and methods that can be clubbed together.

For example,

Class Student can have all the variables and methods related to a student like name, roll number, marks, subjects chosen etc… When an application wants the details of a Student, an object of this class can be created to fetch all the details of the student.

Student student1 = new Student();

In java, only a nested class can be static. A top level (outer) class cannot be static.

public class Outer {
public static class Nested {
}
}

Yes, an object of static class can be directly created in another class without creating an instance of the outer class.

public class Test {
Outer.Nested obj = new Outer.Nested();
}

Question: What are the different types of loops in Java?

Answer: For loop, While loop, do while loop.

Frequently Asked Database (SQL) Interview Questions

Question: What is a database schema?

Answer: Schema is a logical representation or structure of the entire database. It defines how the data is organized, associated and stored in the database.

Question: What is RDBMS?

Answer: Relational Database Management System (RDBMS) is a set of programs that helps a developer to interact with the database for creating, updating or deleting data. This is done through queries (SQL). For example, each data element can be a row in the table.

Question: What is the difference between unique key, foreign key and primary key?

Answer:

Primary key – identifies each row in a table. For example, in the student table, student_id can be the primary key used to access the details of student. student_id will always be different for different students. Can’t be null.

Unique key – set of one or more fields that collectively identify a database record. This should not include the primary key. Unique key can have one null value. For example, student_name and batch_number can be collectively used to identify top students in last 3 years.

Foreign key – a column that references the column of another table to establish the relationship between two tables. Most of the times, the primary key in one table is the foreign key in another. For example, the book table can have student_id as a foreign key that will determine the details of the books a student has taken.

Question: What are clustered indexes?

Answer: Indexes are used to speed the query time to improve performance. Think of it as an index in a book, which makes it easy for you to navigate to a particular page or chapter. Clustered index maintains the physical order of the data in a table. For example, if a clustered index is created on the student_id column of student table, student with student_id 5, will be stored as the 5th row and with id 10 will be in the 10th row, irrespective of the order in which the data is inserted.

Question: What are SQL joins? How to use them to fetch data from multiple tables?

Answer: Joins are used to get results from multiple tables using primary and foreign keys of the related tables. Example –

table – student table - books
student_id (primary key) book_id (primary key)
student_name book_title
student_batch student_id (foreign key)
student_department book_author

Now, to get the name of the books that a student has taken, we can simply write a query as –

select student.student_name, student.student_batch, book.book_title, book.book_author from student, book where student.student_id = book.student_id;

The results will be –

student_name student_batch book_title book_author
Karan 2008 C++ for beginners Yashwant Kanetkar
Karan 2008 Java for dummies Kathy Sierra

Question: What are SQL triggers?

Answer: Triggers are stored procedures that are invoked when some event like insert, update or delete happens in the database on a particular table.

For More SQL Interview Questions Read this Blog Post.

Frequently Asked HTML Interview Questions

Question: What is the full form of HTML?

Answer: Hypertext Mark-up Language.

Question: Name some common tags used in HTML.

Answer:,--main content

Question: What is a frame?

Answer: Frames can divide the html page into separate windows. Each frame is a different html document loaded using ‘src’ attribute.

HR Questions for Freshers

Question: Tell me about yourself.

Answer: You can start with your name, education, previous experiences (If any)

Question: Some questions from your resume – regarding projects, previous projects etc…

Answer: Take interest to give more details and answer the follow-up questions, if any.

Question: What is the most difficult challenge you have faced working in a team/project?

Answer: This could be an individual issue like a code problem that you sat on for a couple of days, or an external issue like getting approval for some project.

Question: What are your strengths and weaknesses?

Answer: Be honest. Support your answers with examples of how you have demonstrated the said strength or weakness. For example, “I can’t switch to another task unless I complete the current one. I have experienced it in previous projects. “

Question: Why do you think Infosys is a good choice for your career?

Answer: This is a tricky one. As a fresher, your first thought would be to clear any interview that fetches you a job. For this question, you have to do some homework. Go through the Infosys website, read about what they do, find out how your career goals match their vision and talk about that. Tell them how you can grow as an individual in the company while providing your best services to the company.

Question: What do you know about Infosys?

Answer: Again, you should visit the Infosys, read about their founder, CEO, work culture, infrastructure, the training campus and other interesting information that has attracted you into attending this interview.

Question: What are your long-term career goals?

Answer: Talk about where you see yourself in the next 5 or 10 years. It can be as simple as buying a new house or seeing yourself as the project head in the Netherlands. This helps the interviewer know about your personal ambitions.

Question: Why should we hire you?

Answer: You can tell about the values you can bring to the company and the qualities you possess that can help the company grow. For example, you look at a project from a bigger perspective – how will it impact the business, how can any change bring more success to the customer and so on.

Don’t just say you are a team player or a smart-worker. Tell something that is unique to you.

HR Questions for Experienced Candidates

The below set of questions can be asked in the technical round also. In that case, you will not have a separate HR round and when you meet the HR, he will directly ask you about your salary expectations and other general stuff. These questions are subjective and there is no right or wrong answer.

Everyone has different ways of handling others. The main test here is the communication skills – how transparent and open are you for resolving issues. Would you set up a meeting and calmly explain your points with facts, or would you just sulk and complain? Would you ask for help when you are stuck or get worked up because you want to do-it-all by yourself? These are personal views and you have to build your own answer as these will be a show of your personality.

  1. If you have a difference of opinion with your immediate manager, how will you explain your point of view to him?
  2. If you had to change one thing in your past, what would that be?
  3. If there is a conflict between you and your team member, how will you resolve it amicably?
  4. Have you resolved differences between two team members who report to you? How will you do so in the future?
  5. Have you handled any teams before? How would you motivate your employees?
  6. Let us say your manager gives you a high priority task, your onsite coordinator calls you up and says he wants a task done urgently and your team members are facing a critical issue which needs your immediate attention. What would you do?

All is well that ends well…

Other than these, general questions regarding your salary expectations, work timings, and flexibility, location, a personal profile will be asked. HR will also tell you about the company’s growth, future plans, and overall work culture. Just go with confidence, think positively, and be honest. You can crack it!

Wanna prepare more? Here is the best book to crack any programming interview: Cracking the Coding Interview: 189 Programming Questions and Solution.

People are also reading:

 

 
By Ramya Shankar

A cheerful, full of life and vibrant person, I hold a lot of dreams that I want to fulfill on my own. My passion for writing started with small diary entries and travel blogs, after which I have moved on to writing well-researched technical content. I find it fascinating to blend thoughts and research and shape them into something beautiful through my writing.

View all post by the author

Subscribe to our Newsletter for Articles, News, & Jobs.

I accept the Terms and Conditions.

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments