Virtusa interview experience Real time questions & tips from candidates to crack your interview

Associate Software Engineer

Virtusa
upvote
share-icon
3 rounds | 14 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date10 Sep 2020
Coding problem6

This round had 2 coding questions where in I was first asked to explain my approach and then code the solution . After that , I was asked some more questions on OOPS and Java.

1. Two Sum

Easy
10m average time
90% success
0/40
Asked in companies
FacebookAmazonSAP Labs

You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.

Note:

We cannot use the element at a given index twice.

Follow Up:

Try to do this problem in O(N) time complexity. 
Problem approach

Approach : 

1) We can store the frequency of every element in the array in a hashmap.

2) We will loop over every index i, and check the frequency of (Target - ARR[i]) is the hashmap:
2.1) If (Target - ARR[i]) is equal to ARR[i], we will check if frequency of ARR[i] . If it is greater than 1 then we will decrease the frequency of ARR[i] by 2 and add a pair (ARR[i] , ARR[i]) to our answer.

2.2) Else, if the frequency of ARR[i] and Target - ARR[i] is greater than equal to 1 then we add pair (ARR[i], Target - ARR[i]) to our answer and decrease the frequency of both by 1.

3) If no valid pairs exist, we will return [[-1,-1]].


TC : O(N) , where N = size of the array
SC : O(N)

Try solving now

2. Intersection of Linked List

Easy
25m average time
73% success
0/40
Asked in companies
Red HatAmazonHSBC

You are given two Singly Linked Lists of integers, which may have an intersection point.

Your task is to return the first intersection node. If there is no intersection, return NULL.


Example:-
The Linked Lists, where a1, a2, c1, c2, c3 is the first linked list and b1, b2, b3, c1, c2, c3 is the second linked list, merging at node c1.

alt.txt

Problem approach

Approach : 

1) Calculate the length of both the lists, say len1 and len2

2) Get the absolute difference of the lengths, diff = |len1 – len2|

3) Now traverse the long list from the first node till ‘diff’ nodes so that from there onwards both the lists have equal number of nodes

4) Then traverse both the lists in parallel and check whether a common node is reached (Note that getting a common node is done by comparing the address of the nodes, not the data)
4.1) If yes, return that node’s data
4.2) If no, return -1


TC : O(N) , where N = max length of the linked list
SC : O(1)

Try solving now

3. OOPS Question

When can you use super keyword?

Problem approach

The super keyword is used to access hidden fields and overridden methods or attributes of the parent class.

Following are the cases when this keyword can be used :

1) Accessing data members of parent class when the member names of the class and its child subclasses are same.
2) To call the default and parameterized constructor of the parent class inside the child class.
3) Accessing the parent class methods when the child classes have overridden them.

4. OOPS Question

What do you mean by data encapsulation?

Problem approach

1) Data Encapsulation is an Object-Oriented Programming concept of hiding the data attributes and their behaviors in a single unit.

2) It helps developers to follow modularity while developing software by ensuring that each object is independent of other objects by having its own methods, attributes, and functionalities.

3) It is used for the security of the private properties of an object and hence serves the purpose of data hiding.

5. Java Question

What do you know about JIT compiler?

Problem approach

JIT Compiler : 

1) JIT stands for Just-In-Time and it is used for improving the performance during run time. It does the task of compiling parts of byte code having similar functionality at the same time thereby reducing the amount of compilation time for the code to run.

2) The compiler is nothing but a translator of source code to machine-executable code. 

Working of JIT Compiler : 

1) First, the Java source code (.java) conversion to byte code (.class) occurs with the help of the javac compiler.

2) Then, the .class files are loaded at run time by JVM and with the help of an interpreter, these are converted to machine understandable code.

3) JIT compiler is a part of JVM. When the JIT compiler is enabled, the JVM analyzes the method calls in the .class files and compiles them to get more efficient and native code. It also ensures that the prioritized method calls are optimized.

4) Once the above step is done, the JVM executes the optimized code directly instead of interpreting the code again. This increases the performance and speed of the execution.

6. Java Question

Explain the use of final keyword in variable, method and class.

Problem approach

In Java, the final keyword is used as defining something as constant /final and represents the non-access modifier.

1) final variable :
1.1) When a variable is declared as final in Java, the value can’t be modified once it has been assigned.

1.2) If any value has not been assigned to that variable, then it can be assigned only by the constructor of the class.


2) final method :
2.1) A method declared as final cannot be overridden by its children's classes.

2.2) A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited. Hence, marking it final doesn't make sense. Java throws compilation error saying - modifier final not allowed here


3) final class :
3.1) No classes can be inherited from the class declared as final. But that final class can extend other classes for its usage.

02
Round
Medium
Video Call
Duration60 Minutes
Interview date10 Sep 2020
Coding problem6

This round had 1 coding question related to Backtracking followed by some more questions from DBMS and SQL.

1. Rat In A Maze

Easy
15m average time
85% success
0/40
Asked in companies
OlaMicrosoftCisco

You are given a starting position for a rat which is stuck in a maze at an initial point (0, 0) (the maze can be thought of as a 2-dimensional plane). The maze would be given in the form of a square matrix of order 'N' * 'N' where the cells with value 0 represent the maze’s blocked locations while value 1 is the open/available path that the rat can take to reach its destination. The rat's destination is at ('N' - 1, 'N' - 1). Your task is to find all the possible paths that the rat can take to reach from source to destination in the maze. The possible directions that it can take to move in the maze are 'U'(up) i.e. (x, y - 1) , 'D'(down) i.e. (x, y + 1) , 'L' (left) i.e. (x - 1, y), 'R' (right) i.e. (x + 1, y).

Note:
Here, sorted paths mean that the expected output should be in alphabetical order.
For Example:
Given a square matrix of size 4*4 (i.e. here 'N' = 4):
1 0 0 0
1 1 0 0
1 1 0 0
0 1 1 1 
Expected Output:
DDRDRR DRDDRR 
i.e. Path-1: DDRDRR and Path-2: DRDDRR

The rat can reach the destination at (3, 3) from (0, 0) by two paths, i.e. DRDDRR and DDRDRR when printed in sorted order, we get DDRDRR DRDDRR.
Problem approach

Approach : 

1) Take the starting position of the rat as (0, 0) and start traversing the valid cells (which are unblocked, i.e. with value 1) through adjacent cells in the following order Down -> Left -> Right -> Up so that we can automatically get sorted paths in alphabetical order.

2) Create another matrix/grid called ‘VISITED’ to keep track of all visited and unvisited cells

3) Recursively look for the valid set of paths possible from the starting cell until we reach the destination or an invalid cell. We keep setting the respective ‘VISITED’ matrix/grid value of the cell to true. I.e.:- 

4) If the move is possible, then move to that cell while storing the character corresponding to the move, i.e. either (D, L, R, U) and recursively start looking for a valid move until the destination (i.e. (n - 1, n - 1)) is reached by the rat.

5) Keep marking the cells as visited. When all the paths possible are traversed from that cell, unmark that cell for other different paths and remove the character from the path formed.

6) As soon as the last index of the grid(bottom right), our destination is reached, we store the traversed path information in a vector/list.


TC : O(3^(N^2)), where N is the dimension of the square matrix.
SC : O(N^2)

Try solving now

2. DBMS Question

Explain the concept of ACID properties in DBMS?

Problem approach

ACID properties is the combination of Atomicity, Consistency, Isolation, and Durability properties. These properties are very helpful in allowing a safe and secure way of sharing the data among multiple users.

1) Atomicity: This is based on the concept of “either all or nothing” which basically means that if any update occurs inside the database then that update should either be available to all the others beyond user and application program or it should not be available to anyone beyond the user and application program.

2) Consistency: This ensures that the consistency is maintained in the database before or after any transaction that takes place inside the database.

3) Isolation: As the name itself suggests, this property states that each transaction that occurs is in isolation with others i.e. a transaction which has started but not yet completed should be in isolation with others so that the other transaction does not get impacted with this transaction.

4) Durability: This property states that the data should always be in a durable state i.e. any data which is in the committed state should be available in the same state even if any failure or restart occurs in the system.

3. DBMS Question

What are different types of joins in SQL?

Problem approach

There are 4 types of SQL Joins:

1) Inner Join: This type of join is used to fetch the data among the tables which are common in both the tables.

2) Left Join: This returns all the rows from the table which is on the left side of the join but only the matching rows from the table which is on the right side of the join.

3) Right Join: This returns all the rows from the table which is on the right side of the join but only the matching rows from the table which is on the left side of the join.

4) Full Join: This returns the rows from all the tables on which the join condition has put and the rows which do not match hold null values.

4. DBMS Question

What are Constraints in SQL?

Problem approach

Constraints are used to specify the rules concerning data in the table. It can be applied for single or multiple fields in
an SQL table during the creation of the table or after creating using the ALTER TABLE command. The constraints are :

1) NOT NULL - Restricts NULL value from being inserted into a column.
2) CHECK - Verifies that all values in a field satisfy a condition.
3) DEFAULT - Automatically assigns a default value if no value has been specified for the field.
4) UNIQUE - Ensures unique values to be inserted into the field.
5) INDEX - Indexes a field providing faster retrieval of records.
6) PRIMARY KEY - Uniquely identifies each record in a table.
7) FOREIGN KEY - Ensures referential integrity for a record in another table.

5. DBMS Question

Write a query that joins two tables A and B having common attribute ID and selects records(ID_NAME) that have
matching ID values in both tables .

Problem approach

SELECT A.ID_Name, B.ID_Name
FROM A
INNER JOIN B ON A.ID=B.ID;

6. DBMS Question

Given an Employee Table, find the Nth highest salary from it.

Problem approach

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE M INT;
SET M=N-1;
RETURN (
SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M, 1
);
END

03
Round
Easy
HR Round
Duration30 Minutes
Interview date10 Sep 2020
Coding problem2

This was a typical HR round with some standard Behavioral questions.

1. Basic HR Question

Tell me something about yourself?

Problem approach

Tip 1 : Prepare the points that you will speak in your introduction prior to the interview.
Tip 2 : Tell about your current cgpa, achievements and authenticated certification
Tip 3 : I told about my role in current internship and what all I do

2. Basic HR Question

Why should we hire you ?

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.

Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.

Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.

Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical
questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

What is the output of print(type("Python"))?

Choose another skill to practice
Similar interview experiences
Associate Software Engineer
3 rounds | 16 problems
Interviewed by Virtusa
1361 views
0 comments
0 upvotes
Associate Software Engineer
3 rounds | 4 problems
Interviewed by Virtusa
1260 views
1 comments
0 upvotes
Analyst
3 rounds | 3 problems
Interviewed by Virtusa
1095 views
0 comments
0 upvotes
Associate Software Engineer
2 rounds | 4 problems
Interviewed by Virtusa
1108 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Associate Software Engineer
2 rounds | 2 problems
Interviewed by Tata Consultancy Services (TCS)
5025 views
1 comments
0 upvotes
company logo
Associate Software Engineer
3 rounds | 5 problems
Interviewed by Tata Consultancy Services (TCS)
3225 views
2 comments
0 upvotes
company logo
Associate Software Engineer
4 rounds | 5 problems
Interviewed by Accenture
3802 views
0 comments
0 upvotes