Infosys Technical Interview Questions for Freshers On Campus and Off Campus

Infosys Technical Interview Questions 2022

This page contains the most recent Infosys Technical Interview Questions and Answers for freshers in 2022 for both on-campus and off-campus.

We collected Student Interview Experience from over 200 students and created a list of the most frequently asked questions in the Infosys interview, as well as facts and interview patterns.

Infosys Technical Interview questions

Top Infosys Interview Technical Interview Questions

Question 1: Mention some high-level programming languages.


Some high-level programming languages are

  • C++
  • C
  • Python
  • PHP
  • JavaScript
  • Java

Question 2:- Write a program to swap two numbers.

# Swap two variables in Python
a=int(input(“Enter value : “))
b=int(input(“Enter value : “))
print(“Before swapping a :”,a)
print(“Before swapping b :”,b)
#logic to swap using third variable 
print(“After swapping a becomes :”,a)
print(“After swapping b becomes :”,b)

Question 3: What is polymorphism?


Polymorphism is a fundamental concept in object-oriented programming (OOP) that describes situations in which something occurs in multiple forms. It describes the idea of being able to access objects of various types via the same interface. This interface can be implemented independently by each type.

Questions 4: Define a Token in C++ programming language.


A Tokens are the smallest elements in C++ that a compiler can understand. Tokens include identifiers, keywords, literals, operators, punctuations, and other separators.

Question 5: Write a code to check if the given string is palindrome or not in C


int main()
//Initializing variable.
char str[100];
int i,length=0,flag=0;

//Accepting input.
printf("Enter the string : ");

//Initializing for loop.
//Checking if string is palindrome or not.

//Printing result.
printf("String entered is palindrome");
printf("String entered is not palindrome");

return 0;

Question 6: Can we implement multiple inheritances in JAVA?


Multiple inheritances are not supported by java. However, by using an interface, we can achieve multiple inheritances. Multiple interfaces can be incorporated into our application.

Question 7: What is a Preprocessor in C?


The preprocessor is not a component of the compiler, but rather a separate step in the compilation process. Preprocessors are the commands that begin with a # symbol and are written at the top of the programme code.

Question 8: What is DLL and EXE file extension?


EXE File: The EXE file extension is used for executable files and indicates that the file is a program. It operates on its own. An EXE has its own memory and process space.

DLL File: DLL is an abbreviation for dynamic link library, which contains functions and procedures that are used by other applications. This DLL can be used by multiple applications. It will use the same memory and process space as the calling application.

Questions 9: What is the difference between Stack and heap memory?

Heap memory:

  • Objects are stored in heap memory.
  • When the heap memory is full, java.lang.OutOfMemoryError is returned.
  • When compared to stack, accessing this memory takes longer.
  • Throughout the applications, heap space is utilized.

Stack Memory: 

  • This type of memory is used to keep track of the order in which methods are executed as well as local variables.
  • It returns java.lan if the stack memory is exhausted.
  • StackOverFlowError.
  • When compared to heap, this memory access is faster.
  • Methods that are currently running are stored in Stack space.

Question 10: Write a code for bubble sort in C++

using namespace std;

void swap(int *var1, int *var2)
int temp = *var1;
*var1 = *var2;
*var2 = temp;
//Here we will implement bubbleSort.
void bubbleSort(int arr[], int n)
int i, j;
for (i = 0; i < n-1; i++)
//Since, after each iteration rightmost i elements are sorted.
for (j = 0; j < n-i-1; j++) if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
// Function to print array.
void display(int arr[], int size)
int i;
for (i=0; i < size; i++)
cout << arr[i] << "\t";

//Main function to run the program.
int main()
int array[] = {5, 3, 1, 9, 8, 2, 4,7};
int size = sizeof(array)/sizeof(array[0]);

cout<<"Before bubble sort: \n";
display(array, size);//Calling display function to print unsorted array.

bubbleSort(array, size);

cout<<"After bubble sort: \n";
display(array, size);//Calling display function to print sorted array.

return 0;

Question 11: Define method overloading and method overriding?


Method Overloading: Method overloading occurs when two methods with the same name differ in the number of arguments or the type of arguments. Because it occurs during compilation, it is referred to as compile-time polymorphism.

Method Overriding: Method overriding refers to the ability to define subclass and superclass methods with the same name and signatures, with the subclass method overriding the superclass method. Because it occurs during run time, it is referred to as run-time polymorphism.


Question 12: How C is different from C++?

C C++
There are no classes, objects, inheritance, encapsulation or polymorphism in C is because it is a procedural language C++ is an Object-Oriented Programming Language (OOP). The essence of OOPS are polymorphism, encapsulation, and inheritance.
The malloc() and calloc() functions are used to allocate dynamic memory The ‘new’ operator is used to allocate memory.
Any other function can call the main function. Any other functions cannot call the main function.
C++ code cannot be run in C C code can we run in C++.

Question 13: What are the different levels of programming languages?


Different levels of programming languages:

  • Low-level programming language
  • assembly-level programming language
  • Middle-level programming language
  • High-level programming language

Question 14: Write a code to check whether a given year is a leap year or notin JAVA

// Leap year program in Java
// If the year satisfies either of the conditions, it's considered a leap year -
// 1. The year must be divisible by 400.
// 2. The year must be divisible by 4 but not 100.public class Main
public static void main (String[]args)

int year = 2020;

if (year % 400 == 0)
System.out.println (year + " is a Leap Year");

else if (year % 4 == 0 && year % 100 != 0)
System.out.println (year + " is a Leap Year");

System.out.println (year + " is not a Leap Year");


Question 15: How a white-box testing is different from black-box testing?

White-box testing Black Box-Testing
White box testing is also known as open box testing, glass testing, structural testing, clear box testing, and code-based testing. Black box testing is also known as closed-box testing, functional testing, and data-driven testing.
The tester will be completely familiar with the application’s internal workings. It is not necessary to understand the application’s internal workings.
White box testing is carried out by developers and testers (QA). Black box testing is carried out by both the end-user and developers and testers.
White box testing takes more time and is more exhaustive. Black box testing takes less time and is less exhaustive.
A tester creates test data and test cases. Testing is carried out from the perspective of an external or end-user.

Question 16: Define a DSN(Data Source Name).


Data Source Name: The Data Source Name (DSN) is used to connect to a database using an ODBC driver. The database name, directory, database driver, UserID, password, and other information are all stored in the DSN. Once you’ve created a DSN for a database, you can use it in an application to retrieve data from it.

Question 17: Define an array.


Every high-level programming language supports arrays, which are the most important data structures. Arrays are collections of data types that are stored together in a single memory location. This makes retrieving array elements a breeze.

Question 18: Write a code to replace a substring in a string in Python

string=input("Enter String :\n")
str1=input("Enter substring which has to be replaced :\n")
str2=input("Enter substring with which str1 has to be replaced :\n")
print("String after replacement")

Question 19: Define a pointer.


A variable that stores the address of another variable is called a pointer. The pointer variable’s data type and the variable it stores should also be the same. Pointers are primarily used when dynamic memory allocation is required.

Question 20: Explain the functionality of the linked list.


There are two parts to a linked list. There are two parts to this: 

  • the information part
  • the link part. 

In a single linked list, the first node is identified by a unique pointer called start, which points to the list’s first element, and the link part of each node consists of a pointer pointing to the next node, but the list’s last node is identified by a null pointer. The Start pointer can be used to navigate the linked list quickly.

Question 21: Define a NULL pointer.


NULL pointers are pointers that point to no objects or variables. A NULL pointer refers to the end of any data structure, such as a list.

Question 22:- What is Normalization in DBMS?


Normalization is a process or technique used on databases to reduce data redundancy and increase the dependency of data. It is basically used to divide a big table into small tables so the unwanted or repeated data can be removed.

Question 23:- Define Virtual functions.


Virtual functions are defined in the derived class and have a virtual keyword before their name in the base class.

Question 24:- Define the Software development life cycle.


Software Development Life Cycle: The Software Development Life Cycle (SDLC) is a method for creating and improving software projects. It’s a detailed plan for creating and maintaining a specific piece of software. The life cycle is a methodology for improving software quality and the development process as a whole.

There are seven phases of the Software Development Life Cycle:

  • Planning
  • Define Requirements
  • Design and prototyping
  • Software Development
  • Testing
  • Deployment
  • Operations and Maintenance

Question 25:- How Clustered index is different from Non- Clustered index?

Clustered IndexNon-Clustered Index
There is a limit of one per table.In a table, it can be used multiple times.
Because the data is physically stored in index order, it is faster to read than non-clustered data.Inserting and updating operations are faster than with a clustered index.

Question 26:- What are different types of inheritance?


  • Single Inheritance
  • Multi-level Inheritance
  • Hierarchical Inheritance
  • Multiple Inheritance
  • Hybrid Inheritance
  • Multipath Inheritance

Question 27:- Write a code of greatest common divisor.

// The code used a recursive function to return gcd of p and q 
 int gcd(int p, int q) 

  // checking divisibility by 0 
    if (p == 0) 
       return q; 
    if (q == 0) 
       return p; 

   // base case 
    if (p == q) 
      return p; 
  // p is greater  
    if (p > q) 
        return gcd(p-q, q);   

        return gcd(p, q-p); 

// Driver program to test above function 
int main() 
    int p = 98, q = 56; 
    printf("GCD of %d and %d is %d ", p, q, gcd(p, q)); 
    return 0; 
//C++ Program
//GCD of Two Numbers
using namespace std;
// Recursive function declaration
int findGCD(int, int);
// main program
int main()
        int first, second;
    	cout<<"Enter First Number: ";
    	cout<<"Enter second Number: ";
    	cout<<"GCD of "< second)
   		return findGCD(first - second, second);
   	 return findGCD(first, second - first);
import java.util.Scanner;
public class gcd_or_hcf
	public static void main(String[] args)
		//scanner class declaration
		Scanner sc = new Scanner(;
		//input from the user		
		System.out.print("Enter the first number : ");		
		int num1 = sc.nextInt();
		//input from the user
		System.out.print("Enter the second number : ");		
		int num2 = sc.nextInt();
		int n = 1;
		System.out.print("HCF of "+num1+" and "+num2+" is ");
		if( num1 != num2)
			while(n != 0)
				//storing remainder
				n = num1 % num2;			
				if(n != 0)
					num1 = num2;
					num2 = n;
			System.out.println("Wrong Input");
		//closing scanner class(not compulsory, but good practice)
num1 = int(input("Enter First Number:"))
num2 = int(input("Enter Second Number:"))

def gcdFunction(num1, num2):
    if num1 > num2:
        small = num2
        small = num1
    for i in range(1, small+1):
        if (num1 % i == 0) and (num2 % i == 0):
            gcd = i
    print("GCD of two Number: {}".format(gcd))

gcdFunction(num1, num2)

One comment on “Infosys Technical Interview Questions for Freshers On Campus and Off Campus”