Online IDE
Free Mock
Events New Scaler
Improve your coding skills with our resources
Compete in popular contests with top coders
Attend free live masterclass hosted by top tech professionals
Explore Offerings by SCALER

Download Interview guide PDF

Before you leave, take this Virtusa Interview Questions interview guide with you.
Get a Free Personalized Career Roadmap
Answer 4 simple questions about you and get a path to a lucrative career
expand-icon Expand in New Tab
/ Interview Guides / Virtusa Interview Questions

Virtusa Interview Questions

Last Updated: Jan 02, 2024
Certificate included
About the Speaker
What will you Learn?
Register Now

Programming skills are the most important thing in any software engineer’s toolbox. If you can’t code, you might as well not be there. The perfect syntax of your code is immaterial if a programmer can’t understand it or write that same code again.

You need to be able to think like a coder and express yourself in programming languages and tools. Programming questions come in all shapes and forms, but they have one thing in common: They test your logical thinking ability and programming knowledge. These questions don't directly measure your typing speed or memory recall—instead, they poke holes in your knowledge until you find the answer. And that's what happened during the complete Virtusa Interview process.

Virtusa Corporation, a United States-based technology services firm, was established in 1996 in Sri Lanka and is headquartered in Southborough. The firm offers IT consulting, business consulting, system implementation, and application outsourcing services to large corporations and software producers. Virtusa has several delivery centres in India and Sri Lanka, the largest of which are in Hyderabad, Chennai, and Colombo. Baring Private Equity Asia acquired the firm for $2 billion in February 2021.

Virtusa Recruitment Process

1. Interview Rounds

Round 1- Virtusa Online Technical Aptitude Assessment.: This is the online technical skill assessment round. This consists of 60 MCQ questions and the questions are technical. The topics that cover these technical questions are - Operating systems,  Computer Networks, Database Management systems, Object-Oriented Programming, (Java & C/C++ ), and Data Structures and algorithms. From the year 2022, the company also start asking the code snippets to detect errors and predict outputs. The duration of the test will be of 90 minutes.

Round 2- Virtusa Technical Interview Round: This round will be on technical interviews. In this round, the interviewer starts with the basic questions related to the computer's fundamental subjects and then moves forward by asking more questions related to Object-Oriented programming. The interviewer will also ask questions from core java. The question will be around a medium level and easily answerable when studied well. The interviewer will also ask about the projects that you did. The discussion of the project is most important because virtusa hires software engineers who have some idea about software development. The whole interview will be of duration between 1.5 hours to 2 hours max.

Round 3 - Virtusa HR Interview Round: This round will be an HR Interview round. During the interview, the interviewer didn't ask any technical questions. They were mainly checking the candidate's communication skills and thinking patterns. The representative didn't ask any questions about Virtusa products or technologies. Instead, they focused on the applicant's communication skills and skills at persuading. They wanted to see if the candidate was honest and straightforward. All of their questions would be related to the company. Therefore, it is important to familiarize yourself with the company's profile.

Virtusa also conducts the national-level coding hackathon named - Virtusa Neural Hack. This consists of 4 coding questions that the participants can solve with programming languages - (Java, C++, and Python). The winner will get the price reward from Virtusa and also get an opportunity for placement at Virtusa. Based on the shortlisting criteria, the other candidate who didn't get the price but cleared the contest will get the interview from Virtusa in most cases.

  • Why Should the Company Hire You?
    First and foremost, it’s imperative to show your potential employer why they should hire you over other candidates. Your answer should be specific, practical, and explain how you can help the company reach its goals. While your answer can’t be an advertisement for your skills, you should also avoid vague or general statements. Avoid phrases such as, “I would love to work here because the company is amazing,” or “I want to join the company because it seems like a great place to work.” Instead, explain why the company is important to you and how you can help it reach its goals.
  • What Will You Bring to the Company?
    HR interviews can be a good chance to show how you fit into the company’s culture. Be prepared to discuss the culture of the company and how you can contribute to it. You can also mention some of the ways your past work experience contributed to the industry or company. For instance, if you are applying for a position at a startup, you can mention how your previous work in a startup relates to your skills for the position.
  • Why Should We Choose You Over Another Candidate?
    You can answer this question by explaining how you fit the company’s needs. Explain why you are a good fit for the company, as well as how your skills can help the company reach its goals. You can also refer to your work experience and how it relates to the company’s needs. For example, if you are applying for a position at an accounting firm, you can discuss your previous work experience in accounting and how it relates to the company’s goals.
  • On a scale of one to ten, rate me as an interviewer.
    It is common for candidates to believe that a rating of 10 on 10 would boost their chances of getting hired. However, this is incorrect. The inquiries asked by interviewers are intended to detect a candidate's diplomatic qualities. But you have to answer this. 
    There can be many answers there, but possibly one of the best answers can be - 
    My opinion is that I am not the right person to judge you. You have the best qualities, and that's why you are here. However, I am happy to interact with you.
  • What are your strengths?
    Certain qualities set a candidate apart from the rest; your strengths are what qualify you to be the best candidate for the job. The interviewer might ask this question to find out if your skills and competencies align with their hiring needs. Strengths are those qualities that you possess or have exhibited through past experiences that make you an excellent fit for the job. They can vary from work ethics to creativity and personality. Be ready to talk about your past experiences and focus on the things that you do well. Don’t just name generic strengths like “I’m a team player” or “I’m always willing to learn new things.” What sets you apart from other candidates?
  • What are your weaknesses?
    Well, your strengths might also be your weaknesses in disguise. But, in general, weaknesses are characteristics that are missing in a person. While they don’t disqualify you from the job, they do make you a less than perfect candidate. The interviewer might ask this question to determine if you’re the right person for the job. Your interviewer might also ask you this question to see if it makes any sense to them. It means, “Do your skills and competencies match the job needs?” You may be asked to address your weaknesses in the interview if you are lacking in a certain area and it does not make sense to them or the job description.
Create a free personalised study plan Create a FREE custom study plan
Get into your dream companies with expert guidance
Get into your dream companies with expert..
Real-Life Problems
Prep for Target Roles
Custom Plan Duration
Flexible Plans

2. Interview Process

Virtusa hires freshers from both On-campus and Off-campus. For both types of candidates, the interview process is the same. In addition to the applicants from the career portal, Virtusa also hires candidates from employee referrals. 

Virtusa Interview process

  • Round 1: Virtusa Online Technical Aptitude Assessment.
  • Round 2: Virtusa Technical Interview Round.
  • Round 3: Virtusa HR Interview Round.

Note: - The Interview Round for the experienced candidate is the same as fresher except the Round 1 - Technical Aptitude assessment changes to the coding assessment.

Virtusa Technical Interview Questions: Freshers and Experienced

1. In an array num containing n distinct numbers in the range [0, n], return the number that's missing.

Example - [0,6,8,5,1,2,3,4] Missing number = 7

We can solve this problem with the help of a hash table that marks the number from 0 to n. And after marking, if any number is left for marking, then we will return that number. But this takes extra space. So to optimize this we can apply mathematics for finding the sum of numbers from an array to the actual sum that needs to exist from (1 - n). So the code solution will be -

//Method that returns the missing number
 public int missingNumber(int[] nums) {
        int sumArray = 0;
        int n = nums.length;
        //calculating sum of number from array
        for(int i = 0; i<n; i++)
            sumArray += nums[i];
        //The actual sum
        int ActualSum = (n*n + n)/2;
        // Returning the difference, the will be the missing number
        return ActualSum - sumArray;

Useful Resources

You can download a PDF version of Virtusa Interview Questions.

Download PDF

Your requested download is ready!
Click here to download.

2. Write a program to reverse the digits of x in such a way that the value stays within the range of a signed 32-bit integer. If reversing x causes the value to jump outside that range, return 0.

For example:

Input- 54678 Output - 87645

Input- 2147483647 Output - 0 (because reversing it goes out of bound to an integer.)

Since we need to store the maximum integer also that is not possible with the integer data type. As it goes out of bounds. So we can either use data type long or the other that can be easily identifiable. In this solution, we will be using the char data type to do that. So here is the solution for that.

 //Method will reverse the integer and return it.
public int reverse(int x) {
        //Convert the number to a character array to reverse.
        char [] ans = Integer.toString(x).toCharArray();
        //Storing max and min possible value for boundary case
        int maxAllowedPos = 2147483647;
        int maxAllowedNeg = -2147483648; 
        if(x > 0){
            int i = 0, j = ans.length-1;
            while(i < j){
                char c = ans[i];
                ans[i++] = ans[j];
                ans[j--] = c;
            String an = new String(ans);
            double t = Double.parseDouble(an);
            if(t > maxAllowedPos)
                return 0;
            return (int)t;
            int i = 1, j = ans.length-1;
            while(i < j){
                char c = ans[i];
                ans[i++] = ans[j];
                ans[j--] = c;
            String an = new String(ans);
            double d = Double.parseDouble(an);
            if(d < maxAllowedNeg)
                return 0;
            return (int)d;

3. Rotate an array by k degrees to the right, assuming the array is initially positioned in that direction. Write a program for that.

//Method that rotates the array.
public int[] rotate(int[] nums, int k) {
        int n = nums.length;
        if(n == 1)
        //Determining the exact k number of steps to rotate
        if(k > n)
            k = k%n;
        //Finding the index from which the array has to be rotated.
        int i = n-k, j = 0;
        //Creating the auxiliary array that stores the reversed array.
        int [] auxArray = new int[k];
        //Traversing the and storing the elements that are unreversed.
        while(i < n){
            auxArray[j++] = nums[i++];
        i = n-1;
        //reversing the remaining element to the array answer.
        while(i >= k){
            nums[i] = nums[i-k];
        return auArray;
Explore InterviewBit’s Exclusive Live Events
Explore Exclusive Events
No More Events to show!
No More Events to show!
No More Events to show!
No More Events to show!
Certificate included
About the Speaker
What will you Learn?
Register Now

4. You are given two non-empty linked lists that represent non-negative integers. The nodes of each list contain a single digit, in reverse order of the most significant digit. Add the two numbers and return the sum as a linked list.

class Solution {
    private int val = 0;
    private int carry = 0;
    //This method reverse the linked list.
    private ListNode reverse(ListNode head){
        if(head == null || == null)
            return head;
        ListNode t = reverse(; = head; = null;
        return t;
    // This method takes the 2 linked list and creates a new linked list with answer.
    private ListNode addNumber(ListNode l1, ListNode l2){
        //The approach used is the same as the normal arithmetic we learn during school days.
       //We keep count of the carry and create the node from that.
        if(l1 == null && l2 != null){
            val = l2.val + carry;
            carry = val/10;
            ListNode n = new ListNode((val%10), addNumber(l1,;
            return n;
        else if(l1 != null && l2 == null){
            val = l1.val + carry;
            carry = val/10;
            ListNode n = new ListNode((val%10), addNumber(, l2));
            return n;
        else if(l1 != null && l2 != null){
            val = l1.val + l2.val + carry;
            carry = val/10;
            ListNode n = new ListNode((val%10), addNumber(,;
            return n;
            if(carry != 0)
                return new ListNode(carry);
            return null;
    public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        l1 = reverse(l1);
        l2 = reverse(l2);
        l1 = addNumber(l1, l2);
        return reverse(l1);

5. Determine if the given string s contains only the characters '(', ')', '{', '}', '[' and ']'. To do this, first find all the characters that are not brackets (i.e. '[', ']', '{', and '(') and '(' and ')').

Then see if there are any remaining characters that are brackets (i.e. '{', '}', '(' and ')'). If the string is valid, output true. Otherwise, the output is false. If the string is invalid, the output is false.

We can use the stack to test the expression. The solution can be like this -

//This method returns true if the expression is valid. Oterwise false.
public boolean isValid(String s) {
        int n = s.length();
        if(n%2 != 0)
            return false;
        // Created a stack to keep count of the valid parentheses.    
        char[] stack = new char[n];
        int top = -1;
        //Looping and pushing and poping the element from the stack based 
        //on it's validity 
        for(int i = 0; i < n; i++){
            char ch = s.charAt(i);
            if(ch == '(' || ch == '{' || ch == '['){
                stack[++top] = ch;
                if((ch == ')') && (top == -1 || stack[top] != '('))
                    return false;
                else if((ch == '}') && (top == -1 || stack[top] != '{'))
                    return false;
                else if((ch == ']') && (top == -1 || stack[top] != '['))
                    return false;
        // If the stack is empty then the parentheses are valid. So return true
        if(top == -1)
            return true;
        //Otherwise return false
        return false;
Start Your Coding Journey With Tracks Start Your Coding Journey With Tracks
Master Data Structures and Algorithms with our Learning Tracks
Master Data Structures and Algorithms
Topic Buckets
Mock Assessments
Reading Material
Earn a Certificate

6. Write a program to check if any element occurs at least twice in the array nums and return true. If every element is unique, return false.

We can solve this problem by keeping the element in the HashMap. And if any of the elements appear to be already existing then we need to return true. And in this, HashMap helps us to do that. So the 

//Method that returns the boolean if element found duplicate or not
public boolean containsDuplicate(int[] arr) {
        int n = arr.length;
        if(n == 1){return false;}
        HashSet<Integer> set = new HashSet<>();
        //RETURN TRUE
        for(int i =0; i<n; i++)
            if(set.contains(arr[i])){return true;}
        return false;

7. Search for a value in an m x n integer matrix matrix using an efficient algorithm.

The following properties must exist:

1. A row of integers is sorted from left to right, 

2. Starting with the first integer of each row is greater than the last.

Since we know that the matrix is already in a sorted position, we can apply binary search in each row and then on the particular row, we can search for the value in that particular column. This is how we can solve this problem efficiently in O(log m + log n) times. The implementation of this solution will be -

class Solution {
    //Applying binary search algorithm to the matrix on each column.
    private boolean binarySearch(int[][] mat, int i, int low, int high, int target){
        if(low > high)
            return false;
        int mid = (low + high)/2;
        if(mat[i][mid] == target)
            return true;
        else if(mat[i][mid] > target)
            return binarySearch(mat, i, low, mid-1, target);
        return binarySearch(mat, i, mid+1, high, target);
    public boolean searchMatrix(int[][] mat, int target) {
        int m = mat.length; 
        int n = mat[0].length;
        //Searching every row by binary search tosearch for the element.
        for(int i = 0; i < m; i++){
            if(target < mat[i][0])
                return false;
            if(target >= mat[i][0] && target <= mat[i][n-1])
                return binarySearch(mat, i, 0, n-1, target);
        return false;

8. Eliminate all duplicates to head a sorted linked list, ensuring that every element appears only once. Return the linked list in order.

We can use the two-pointer approach to solve this problem by getting the nodes that contain the duplicate value. Since the lists are already in sorted order, It becomes easy to point to the node with duplicate values. So the code solution for this problem will be -

class Solution {
    public ListNode deleteDuplicates(ListNode head) {
	  // if LL is empty or contains only 1 element then return LL.
        if(head==null || {
            return head;
	  // creating a dummy Head for traversing the LinkedList.
        ListNode node = head;
        while(!=null) {
            if(node.val! {
	      // if value of current node is same as value of next node then
            // traverse the node forward.
                node =;
            } else {
		// if value of current node is same as value of next node then 
            //connect current with next to next node.
        return head;

9. You are provided with an original 0-indexed 1-dimensional integer array and two integers, m, and n. You must create a 2D array of m rows and n columns using all of the elements from the original.

The original array contains the integer indices from 0 to n - 1 (inclusive). The second row of the 2D array is constructed from the integer indices from n to 2 * n - 1 (inclusive).

This can be a simple solution by creating a 2D array of the size given row and column. Then we can simply start traversing the 1D array and input the element to the 2D array based on the row and column.

class Solution {
    public int[][] construct2DArray(int[] arr, int r, int c) {
        if(r*c != arr.length){return new int[0][0];}
        //2D ARRAY
        int ans[][] = new int[r][c];
        int count = 0;
        for(int i= 0;i <r; i++)
            for(int j =0; j<c; j++)
                ans[i][j] = arr[count];
        return ans;

10. Given a binary tree's root, determine whether it is a BST. Then, determine whether it is a valid BST. A BST is a tree in which both subtrees are binary search trees and in which the subtrees of each node are also BSTs.

We can easily solve this problem with the help of recursion. Just we need to see that every subtree must be a binary search tree. So here is the approach for the solution using the recursion.

 class Solution {
    //private method that validates the tree by the values of root and sub roots
    private boolean solution(TreeNode root, long left, long right){
        //Base case to determine if we reach the leaf of the
        //tree and found no error. Then the part is the valid BST
        if(root == null)
            return true;
        //Comparing the value of the subtrees that all values to 
        //its sub tree must fulfill the condition of validity. 
        if(!(root.val < right && root.val > left))
            return false;
        //Recursively validating it's right subtree and left subtree.
        return ((solution(root.left, left, root.val)) &&
                (solution(root.right, root.val, right)));
    //Method that validates and returns true if it's valid. 
    public boolean isValidBST(TreeNode root) {
        //Calling private helper method to validate.
        return solution(root, Long.MIN_VALUE, Long.MAX_VALUE);
Discover your path to a   Discover your path to a   Successful Tech Career for FREE! Successful Tech Career!
Answer 4 simple questions & get a career plan tailored for you
Answer 4 simple questions & get a career plan tailored for you
Interview Process
CTC & Designation
Projects on the Job
Referral System
Try It Out
2 Lakh+ Roadmaps Created

11. Write a code that accepts the URL string and decodes the URL into its tiny version. The output URL must have the predecessor of “https://www.tinyURL/<encoded string>”

For example - 

Input URL = “” 

The Output will be - “https://www.tinyURL/xsf34

We can do one thing to solve this problem we can create an index that will be used as an index such that it can map to the long URL. And when it wants to access then it can be accessed in constant time.

The code implementation can be -

 public class encodeURL{
    HashMap<String, String> hm = new HashMap<>();
    //Method that generates an encoded URL that will be used as index.
    private String generateHashURL(){
        String AlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
        StringBuilder sb = new StringBuilder(10);
        for (int i = 0; i < 10; i++) {
            int index = (int)(AlphaNumericString.length() * Math.random());
        //This creates a random string and returns it.
        return sb.toString();
    // Encodes a URL to a shortened URL and returns it.
    public String encode(String longUrl) {
        String predecessorURL = "https://www.tinyURL/";
        String hashURL = predecessorURL+generateHashURL();
            hashURL = predecessorURL+generateHashURL();
        hm.put(hashURL, longUrl);
        return hashURL;

12. What is TCP/IP Protocol?

TCP/IP (Transmission Control Protocol/Internet Protocol) is the network protocol that computers use to communicate with each other. It’s the foundation of the internet and how we download things from the Internet. TCP stands for Transmission Control, and IP stands for Internet Protocol. Together, these two terms describe how data moves from one computer to another. TCP/IP is like a highway system for data. Each connection has its own pair of lanes: TCP and IP. When data travels through this system, it moves in a specific direction and follows rules set by each lane. For example, if you’re walking down the highway, your footpath is called a lane. If you’re driving, it’s called an interstate or expressway. Your car can only move in these two directions at a time; you can’t travel in both directions at once. The same goes for data moving through your computer. You can only send data in one direction at a time, so you have to use separate lanes for each direction (for example, 1st Lane – Download; 2nd Lane – Upload).
With the right software installed on your computer, you can instantly share files with anyone on the internet who uses TCP/IP as well as with other computers that have TCP/IP enabled on their network ports.

13. Explain in detail about binary Search. How does it work? And Implement it.

Binary search is one of the most common algorithms used in computer programming. It’s so common that it’s almost always implemented in computer programs. Binary search is quite useful, and you can see this by looking at how often it appears in different programming languages.  Binary search is the faster algorithm that can help to search the element in just O(log n) time. The only requirement for binary search to work is that the element must be in sorted order.

Binary Search follows the approach of eliminating the elements in the list that are not required because of the sorted property. It is being assured that the element doesn’t exist there. So to make this approach practical, the binary search tries to search for the key at such position in the list, which helps to identify on what side of the position, the key must exist in the list. So binary search finds the middle position in the list and compares it with the key. If the element matches with the key, then it returns true indicating that the key is found in the list. Otherwise, it checks with the element that in which side, the key must exist in the list. Based on this, the algorithm eliminates the other half. And it does this in every iteration. This is how on every iteration a binary search eliminates half of the list. So by eliminating half it takes O(log n) time.

Implementation of Binary Search using Java-

public boolean binarySearch(int[] arr, int low, int high, key){
        //base case returns false when index is out of bound 
        if(low > high) 
            return false;
        int mid = (low+high)/2
        //Searching on mid if key found then return true
        if(arr[mid] == key) 
            return true
        //Searching on right sub array if key exist there
        else if(arr[mid] < key) 
            return binarySearch(arr, mid+1, high, key);
        //Searching on left sub-array of key exist there.
            return binarySearch(arr, low, mid-1, key);

14. Difference Between Left Join and Right Join in Database.

The Left Join operator is used when you want to join two tables in which some columns have both primary and foreign keys. If the left table has a column that contains primary key values, then only those rows will be included in the result set of the query. If you do not specify a primary key column, then all rows will be included in the result set. A right join returns all rows in the right table that match any values in the left table. The left join returns all rows that match any values in the left table. The difference between Left Join and Right Join operators lies here as well. While the Left Join operator is used when tables have columns that support equality, the Right Join operator is used when tables have columns that do not support equality.

15. Difference between Thread and Runnable in java.

Thread is a class in Java and Runnable is the interface. Other than this, there are lot many differences between these two in terms of their functionality and implementation. Those are -

Thread Runnable
Thread is a class. This helps in creating a new thread in the java program. Runnable is a functional interface and threads can also be created using this.
The class has multiple methods, including start() and run() This interface only has one abstract method, run()
For each thread, an object is created and associated For a single object, there can be multiple threads that share it.
It requires more memory because it creates a separate object. Less memory is required because of the common objects.
Since multiple inheritances are not allowed in Java, a class that extends Thread cannot extend another class. The class can be extended to another class if it implements the runnable interface.

16. When should a function throw an exception?

Exceptions are handled with try and catch keywords. But in the case when we don’t want to handle the exception in the method on which the exception may rise, then we can use the keyword throw in the method declaration. This indicates that whichever method is calling this method must have handled the exception. 

For Example - Consider a method that accepts 2 integers, divides that number, and returns the result.  So if the calling function provides 0 in the argument, then the method will cause an exception. So in this case we can declare the add method with a throw keyword indicating that this method might cause an exception. So f you are calling this, then you have to handle it.

17. What is the use of the ‘super’ keyword inside the constructor?

The Super keyword in the constructor is used to invoke the parent class constructor. Generally when a subclass extends the parent class, and the parent class has a parameterized constructor. If we create the object of the child class then the default constructor of parent will be invoked implicitly. Since we need to initialize the object with some value, so we need to explicitly call it from the child class constructor using the super keyword.

18. Tell me something about DHCP.

A Dynamic Host Configuration Protocol (DHCP) allows a device to automatically obtain an IP address and other network parameters from a DHCP server. This can be useful if you don’t want to manually assign IP addresses to devices on your network or if you have a large network and want to give each device a specific IP address. Many routers come with a built-in DHCP server, but it’s also possible to set up a DHCP server on your computer to assign IP addresses to devices on your network.

19. What do you know about DNS?

The Domain Name Service (DNS) is what converts a domain name (such as into an IP address The technical term for this is querying. DNS is what you would use if you wanted to type into your web browser. Instead of just typing in the domain, you would type the word, and the DNS would look up the IP address associated with that domain. Names are great, but IP addresses are harder to remember. To avoid having to memorize the IP addresses of all the devices on your network, you can use a DNS server, which can be configured to return the correct IP address for a particular hostname. This can be done on a single computer or on a server.

20. Explain some drawbacks of the Classical Waterfall Model.

 There are several shortcomings to the classical waterfall model; we cannot use it in real projects, but we use other software development lifecycle models that are based on it. This model has the following major drawbacks: 

  • There is no feedback path: In the classical waterfall model, software evolves from one phase to another. During any phase, developers are assumed not to commit any errors. Due to this, it does not incorporate a mechanism for correcting errors.
  • Change requests are difficult to accommodate: This model assumes all customer requirements can be determined upfront, but in reality, the requirements of customers keep changing over time.  After the requirements specifications phase has been completed, it is difficult to accommodate any change requests.
  • There is no overlapping of phases: This model recommends starting a new phase after the previous one is complete. However, in real projects, this cannot be maintained. Phases may overlap in order to increase efficiency and reduce costs.

21. Difference between set and list.

A list is an ordered collection of values where each value can be accessed using a numeric index. A set is an unordered collection of values that cannot be modified once created. The main difference between a set and a list is that lists are ordered (starting from 0), whereas sets are unordered.

There are several uses for sets: 

  • They can be used to store information in a precise order, such as the days of the week, months of the year, or a list of phone numbers.
  • Sets can be used to preserve their original order when they are copied (e.g., when sharing files with someone who doesn't have the same software tools).
  • They can be used to represent a finite population in which all members are unique (e.g., all people born in New York City).
  • They can be used to represent random events in which all members have equal probability (e.g., rolling dice).
  • They can also be used to store specific instances of objects (e.g., all forks from your kitchen drawer).

These uses show that sets and lists both have different purposes and uses. As such, it is important to know the difference between them so that you can select the correct type for your application.

22. What is collection framework in java?

A collection framework is a library of classes that provides generic methods for creating, searching, sorting, and iterating over collections of objects. In other words, it contains the building blocks needed to create custom collection types.

Unlike traditional APIs such as java.util.Collection, a collection framework can be used to create new data structures that are not part of the JDK itself. This allows developers to create custom collections that share common features with existing JDK collections without writing custom code. Many popular frameworks, such as Apache Commons Collections and Google Guava, offer implementations of this concept. However, not all collection frameworks are created equal. A poorly designed collection framework can lead to difficult-to-debug bugs or memory leaks, so it's important to choose wisely when choosing a framework for your project.

23. What Is Object-Oriented Programming?

Object-oriented programming is the way in which a computer programs objects. These objects are the things that the computer can use.

There are two types of objects: classes and instances. Classes represent an object’s attributes and behaviour, while instances represent individual objects. Objects can be thought of as containers for data. Each object has a unique identity and can have different attributes and behaviours. The class represents what it is (the attribute), while the instance represents what it does (its behaviour).

Object-oriented programming is used to create software that mimics real-world relationships and processes. For example, a car could be represented as an object with attributes such as colour and make, as well as behaviours such as start and stop. The user interface could also be represented as an object with attributes such as location on the screen and size of text, along with behaviours such as allowing input from the keyboard or touchscreen or updating the position of the car on the screen each time is moved by the user.

In object-oriented programming, classes define objects’ attributes and behaviours, while instances define individual objects that are created from those classes.

The main benefit of object-oriented programming is code reuse. When you write a class definition once, you can reuse it over and over again without having to rewrite it every time you want to add new attributes or behaviours to your object.

24. What is Servlet?

A Servlet is a web application component that can be used to process incoming HTTP requests. Servlets are responsible for performing the logic that allows the web application to present its data to end-users and handle any required interactions with the database. Servlets can be written in a variety of programming languages, including Java, PHP, and Ruby. The most important thing to know about servlets is that they are defined by the use of Servlet API.

One way to think about a servlet is as an HTTP request handler - a part of your application that listens for incoming requests processes them and then returns the results to the client. In most cases, a servlet will have access to the same resources as other parts of your application; it might use these resources to display information or perform some processing on its own.

25. What is REST API?

REST API (Representational State Transfer) is an architectural style used to describe the transfer of information between web services. REST describes three types of interactions: request and response, PUT and GET, and resource and representation. These interactions can be performed over standard HTTP requests, but REST also provides a contract that describes the types of data that can be transferred, how it can be formatted, and what methods can be used to manipulate it.

The concept behind REST API is to minimize the amount of data sent over the network. It does this by defining how data will be transferred (either PUT or POST) and what method will be used to do so (GET or DELETE).

Another key aspect of REST API is that both client-sender and server-receiver must adhere to a set of rules that define how data will be transferred (e.g. which format/data format). The combination of these two elements allows for increased security in remote communication and ensures that no information can be passed between devices unless explicitly allowed by both parties.

REST API has become a popular architectural pattern among modern web applications because it reduces complexity while ensuring interoperability between web services. Although the concept of REST API might seem simple at first glance, there are several subtleties involved in building an application with this architectural style in mind. In particular, REST API requires both clients.

26. Explain ACID Property in DBMS.

ACID stands for the acronym "Atomicity, Consistency, Isolation, and Durability". Property of a database system that ensures consistency between the internal data of the database and the external data sources such as a file system. If a property is missing in one area, the data in all areas must be consistent.
The ACID property can be expressed as

  1. Atomicity - No changes are allowed to take place in the database system except those that are explicitly allowed by a transaction.
  2. Consistency - The internal data of the database and the external data sources must be consistent. This is achieved by ensuring that no transactions attempt to update the same records at different times.
  3. Isolation - Transactions should not interfere with each other. For example, if one transaction updates a record that another transaction is updating, both transactions are likely to fail.
  4. Durability - All records must remain intact when they are written back to their original location after completion of a transaction.

27. Describe Garbage Collection in Java.

Garbage collection is the process of reclaiming memory space occupied by objects that no longer have a reference (i.e., an owner), or have been declared unreachable. Garbage collection is performed automatically by the Java Virtual Machine (JVM) whenever the program runs out of memory.

When Java applications run out of memory, it will automatically perform garbage collection to reclaim unused memory. The JVM can reclaim used space from the following sources:

  • Objects are allocated on the managed heap (per-thread space managed by the JVM).
  • Objects are allocated on the native heap (unmanaged storage that’s encapsulated by the VM).
  • Specialized caches such as a JIT compiler’s cache and interpreter’s cache.

By default, Java programs allocate objects on the managed heap. Objects on the managed heap are freed during garbage collection operations based on their lifetimes, which include when they were created, when they were last accessed, and their last reference count. When objects are no longer referenced by any other object, they can be freed immediately. However, if an object has been referenced multiple times before being last accessed, then it must be reclaimed with a separate garbage collection operation.

28. You are given an array of numbers and a target number. You are required to return the index of 2 numbers such that adding the element of the index will sum to the target.

You may assume that there must be a solution exist.  Example - arr = [2,9,1,3,4] target = 12 Output = [1,3]

The naive solution can be to pick every element and find the element that sums up to target. This approach can take time of O(n2). So we can observe that we are repeating the work by revising the index every time. So we can do one thing we can store the index of the element that we already visited in HashMap. And next whenever the element that is required to sum to target that we can get from the Hashmap. So with this approach, we can do this work in O(n) time.

//This method returns the index of the two-element that sum to the target.
public int[] solution(int[] nums, int target) {
        int val = 0;
        // HashMap that stores the index of the element that are required
        // to sum to target
        HashMap<Integer, Integer> hm = new HashMap<>();
        hm.put(nums[0], 0);
        for(int i = 1; i < nums.length; i++){
            val = target - nums[i];
            //Returning the solution of the element found.
                return new int[]{hm.get(val), i};
            // Adding the element to the hashmap so that it may be needed
            // for future element
            hm.put(nums[i], i);
        return new int[]{0,0};

Virtusa Interview Preparation

1. Interview Preparation Tips

  • Attention: The interviewer in Virtusa mostly sees how attentive you are. So make sure you are very attentive during your interview. One way to make the interviewer believe that you are attentive is to make eye contact with each interviewer as they speak to you. This shows them that you're listening and interested in what they have to say. Listen to every question well and give the answers accordingly.
  • Prepare from Resume: Make sure you prepare the things from your resume well. You must not lie in your resume because the interviewer can ask any questions related to the topics that you have mentioned in your resume. (For Example - Programming Languages, Web Technology, Subject of Interest, etc).
  • Project: The interviewer from Virtusa will discuss your project for around 15 minutes to 20 minutes. So make sure you are able to answer well in this. If you have made the project on your own, then you can answer this very easily.
  • Java: Working Programming language ion virtusa is mostly on java. So if you are good at java then it's good. Otherwise, prepare the java. The interviewer will ask questions from java also. It’s not maybe direct, but in the form of object-oriented programming concepts, like Dynamic Method DIspatch in OOPs that can only be answerable well in java.
  • Learn Basic Computer Skills: It’s better that you must have knowledge of basic computer fundamentals. The interviewer might ask questions like - Which Operating System do you use? What is the release version of this? And sometimes the interviewer can ask you to explain the steps to install the new operating system. And also other kinds of questions like this.
  • Prepare for Scenario-based Questions: The interviewer may also give you scenario-based questions that you have to answer. With these types of questions, the interviewer tests your thinking ability and also notices your ability to solve problems.

Frequently Asked Questions

1. Is virtusa interview difficult?

The Virtusa interview is not difficult to clear. But if you haven’t prepared well, then obviously it will be difficult to clear. The interviewer usually sees your confidence. Be well prepared for the important topics listed in the above sections. And the other is your project. How well you're prepared to answer questions related to it.

2. Why do you want to join our company?

There can be many possibly best answers to this question that you have to take care of. By asking these questions, the interviewer often wants to see your interest in the organization. They expect that you give a unique answer, not by just learning the best from the internet. So for this, try to research about the company and understand everything about the work culture for your profile that you are selected for and answer this question with curiosity and your answer must convey to the interviewer that you feel excited to work for the company.

3. Why do you want this job?

In your answer, first, focus on and list the employer’s strengths (which you would know if you had investigated the company). Like: 

  • What training and growth opportunities does the firm provide for someone in your field of expertise?
  • Why do other candidates want to work for them rather than for their competitors?
  • How has the firm contributed to the country or community?

Once you've established the desired answer, you should then discuss what else you can provide that will satisfy their demands. When you've customized your response to this query, make sure to practice saying it aloud. You may want to ask a friend or family member to play the role of the interviewer.

4. Why should we hire you?

The interviewer is trying to get to know you as a person, beyond your skills and experience. They’ll likely ask why you’re the best person for this job. They want to know what makes you tick, what your passions are, and why you’re a good fit for the job and the company. In addition, they also want to learn more about your career goals and what you want out of your career. Before you answer, make sure you have a good understanding of why the company needs and wants you. If you don’t understand the need, you could waste both of your time by trying to answer the question the way you want to.

5. Do you have any questions for us?

This is a nice transition from the last question. This can also be a great opportunity to ask a few follow-up questions about the company. You want to keep the conversation going, but you also want to see where this leads. You can also ask about how things work at the company, your co-workers, or other topics that you’d like to know more about. Since you’re now in the flow of the conversation and you’ve established that you’re interested in learning more, this is your chance to ask questions and really get to know the company and the interviewer.

6. How to explain the project in the interview?

Project discussion in the interview is very important. Using your project, the interviewer basically wants to know more about your skills. How well you have utilized the technology to solve any real-world problem using your project. So whenever you start to explain your project, always start with how the idea came into your mind and what motivated you to build the project. Next, explain how your project can be extended further and help in solving the real-world problem. Then explain to the interviewer about the technology that you have opted to build the project and the reason why you have chosen the technology. Also, explain a one-liner about the technology and its alternatives. Conclude your project by explaining the high-level view and the data flow. If the interviewer asks more about this, then you have to explain the low-level design of your project.

7. How long is the Virtusa interview?

Generally, the interview will be the duration of 1 hour to 1.5 hours. But in some cases, it can be extended up to 2 hours depending on how well you are answering and the interviewer decides to hire you based on your explanation and your knowledge. The total selection process in Virtusa will be between 10 -  20 days that you will get the offer.

8. What is the Eligibility Criteria at Virtusa?

  • Course Eligibility: B.E./B.Tech/MCA/M.Tech/M.E./M.Sc (IT).
  • Backlog: No active backlog during Joining.
  • Percentage Criteria: 65% / 6.5 GPA or Above.
Excel at your interview with Masterclasses Know More
Certificate included
What will you Learn?
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+91 *
Change Number
Graduation Year *
Graduation Year *
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Please verify your phone number
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test