
Virtusa Consulting Services

20+ Virtusa Consulting Services Associate Software Engineer Interview Questions and Answers
Q1. Reverse Stack with Recursion
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more
Reverse a given stack of integers using recursion without using extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Ensure to handle base cases like empty stack or single element stack.
Example: If the input stack is [1, 2, 3], after reversal it should be [3, 2, 1].
Q2. Word Occurrence Counting
Given a string 'S' of words, the goal is to determine the frequency of each word in the string. Consider a word as a sequence of one or more non-space characters. The string can have mu...read more
Count the frequency of each word in a given string.
Split the input string by spaces to get individual words.
Use a hashmap to store the frequency of each word.
Iterate through the words and update the hashmap accordingly.
Print the unique words and their frequencies from the hashmap.
Number and Digits Problem Statement
You are provided with a positive integer N
. Your task is to identify all numbers such that the sum of the number and its digits equals N
.
Example:
Input:
N = 21
Output:
[15]
Identify numbers where sum of number and its digits equals given integer N.
Iterate through numbers from 1 to N and check if sum of number and its digits equals N
Use a helper function to calculate sum of digits for a given number
Return the numbers that satisfy the condition in increasing order, else return -1
The three levels of data abstraction in a Database Management System are Physical Level, Logical Level, and View Level.
Physical Level: Deals with how data is stored on the storage medium. It includes details like data structures, file organization, and indexing.
Logical Level: Focuses on how data is viewed by users. It hides the physical storage details and presents a logical view of the database.
View Level: Represents a subset of the database to specific users. It provides a ...read more
To combine two tables in SQL, you can use the JOIN clause to merge rows based on a related column.
Use the JOIN clause to specify the columns from each table that are used to match up rows.
Types of JOINs include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.
Example: SELECT * FROM table1 JOIN table2 ON table1.column = table2.column;
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructors, member variables, and methods with implementation.
Interface can only have abstract methods and constants.
A class can implement multiple interfaces but can only extend one abstract class.
Example: Abstract class - Animal with abstract method 'eat', Interface - Flyable with method 'fly'.
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. Denormalization is the opposite process.
Normalization involves breaking down a table into smaller tables and defining relationships between them to reduce redundancy.
Denormalization involves combining tables to reduce the number of joins needed for queries, sacrificing some normalization benefits for performance.
Normalization helps in maintaining data integrity and r...read more
Objects are key-value pairs with methods, while Maps are collections of key-value pairs with ordered keys and better performance.
Objects are unordered collections of key-value pairs, while Maps maintain the order of insertion.
Maps allow any type of key, while Objects only allow strings and symbols as keys.
Maps have better performance for scenarios involving frequent additions and removals of key-value pairs.
Objects have prototype chain and methods like hasOwnProperty(), while...read more
HTML5 offers several advantages over its previous versions.
Improved support for multimedia elements such as audio and video tags
Enhanced support for canvas and SVG for better graphics rendering
Introduction of new semantic elements like <header>, <footer>, <nav>, <article> for better structure and accessibility
Built-in support for offline storage using local storage and session storage
Better support for drag and drop functionality and geolocation services
Various formatting tags in HTML include <b>, <i>, <u>, <strong>, <em>, <sub>, <sup>, <strike>, <br>, <hr>, <pre>, <blockquote>, <code>, <kbd>, <samp>, <var>, <cite>, <abbr>, <address>, <small>, <big>, <font>, <center>, <s>, <del>, <ins>, <mark>, <time>, <progress>, <meter>, <q>, <dfn>, <span>, <div>, <section>, <article>, <aside>, <nav>, <header>, <footer>, <main>, <figure>, <figcaption>, <details>, <summary>, <dialog>, <menu>, <menuitem>, <legend>, <fieldset>, <label>, <butt...read more
let is block-scoped while var is function-scoped in JavaScript.
let is block-scoped, meaning it is only accessible within the block it is declared in.
var is function-scoped, meaning it is accessible throughout the function it is declared in.
Using let can help prevent variable hoisting issues.
let allows for better control over variable scope and reduces the risk of unintended variable redeclarations.
Q12. Is a string mutable/immutable with an example
A string can be both mutable and immutable depending on the programming language.
In languages like Java and Python, strings are immutable.
In languages like C++ and C#, strings are mutable.
Immutable strings cannot be modified once created, while mutable strings can be modified.
Example of immutable string: 'hello world'.replace('o', '0') returns 'hell0 w0rld'.
Example of mutable string: string s = 'hello'; s[0] = 'j'; s now becomes 'jello'.
Q13. String is immutable. Array and arraylist differences
String is immutable, array and arraylist are mutable data structures.
String is immutable, meaning its value cannot be changed once it is created.
Array is a fixed-size data structure that stores elements of the same data type.
ArrayList is a dynamic array that can grow or shrink in size as needed.
Example: String str = "hello"; char[] arr = {'h', 'e', 'l', 'l', 'o'}; ArrayList
list = new ArrayList ();
Q14. What is Java OOP's concept
Java OOP's concept is a programming paradigm that uses objects to design applications and programs.
Java OOP's concept is based on four main principles: encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation is the process of hiding the implementation details of an object from the outside world.
Inheritance allows a class to inherit properties and methods from another class.
Polymorphism allows objects to take on multiple forms or behaviors.
Abstraction is the pr...read more
Q15. A program on recursion.
Recursion is a programming technique where a function calls itself to solve a problem.
Recursion involves a base case and a recursive case
Recursion can be used to solve problems like factorial, Fibonacci sequence, and binary search
Recursion can be less efficient than iterative solutions for some problems
Q16. OOPS concept with examples
OOPS is a programming paradigm based on the concept of objects.
OOPS stands for Object-Oriented Programming System
It focuses on creating objects that contain both data and functions
Encapsulation, Inheritance, and Polymorphism are the three main pillars of OOPS
Example: A car is an object that has properties like color, model, and functions like start, stop, and accelerate
Q17. Explain Marker Interface.
Marker interface is an empty interface used to mark classes for special treatment.
Marker interface has no methods or fields.
It is used to provide metadata to the JVM or other tools.
Examples include Serializable interface in Java.
Q18. Explain OOPs concepts.
OOPs concepts are the principles of Object-Oriented Programming, including encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (object).
Inheritance: Allowing a class to inherit properties and behavior from another class.
Polymorphism: The ability for objects of different classes to respond to the same method call.
Abstraction: Hiding the complex implementation details and showing only the...read more
Q19. Explain synchronization.
Synchronization is the coordination of multiple processes or threads to ensure they access shared resources in a controlled manner.
Synchronization is important in multi-threaded programming to prevent race conditions and ensure data consistency.
Common synchronization mechanisms include locks, semaphores, and monitors.
For example, using a mutex lock to protect a critical section of code from being accessed by multiple threads simultaneously.
Q20. Explain Normalization.
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization is used to eliminate data redundancy by breaking up tables into smaller, related tables.
It helps in reducing data anomalies such as update, insert, and delete anomalies.
Normalization is achieved through a series of stages called normal forms, such as 1NF, 2NF, 3NF, and BCNF.
For example, in a database of students and courses, instead of storing student de...read more
Q21. Explain Array and ArrayList
Array is a fixed-size collection of elements of the same data type, while ArrayList is a dynamic-size collection of objects.
Array is a static data structure with a fixed size, while ArrayList is a dynamic data structure that can grow or shrink in size.
Arrays can only store elements of the same data type, while ArrayList can store objects of different data types.
Arrays are accessed using index positions, while ArrayList provides methods for adding, removing, and accessing elem...read more
Q22. Deadlock scenario in thread
Deadlock scenario in thread occurs when two or more threads are waiting for each other to release resources, causing a standstill.
Two threads each holding a resource needed by the other thread
No thread can proceed until the other releases the resource
Can be avoided by careful resource allocation and ordering
Q23. Maximum questios from java
The question is asking for the maximum number of questions that can be asked from Java.
Java is a versatile programming language with a wide range of topics that can be covered in questions.
Topics can include data types, control structures, object-oriented programming, exception handling, multithreading, collections, etc.
Examples of questions could be related to inheritance, polymorphism, encapsulation, abstraction, interfaces, etc.
Q24. Multithreading in Java
Multithreading in Java allows multiple threads to execute concurrently, improving performance and responsiveness.
Multithreading is achieved in Java by extending the Thread class or implementing the Runnable interface.
Threads can be started using the start() method and controlled using methods like join(), sleep(), and interrupt().
Synchronization is important to prevent race conditions and ensure thread safety, which can be achieved using synchronized blocks or methods.
Java pr...read more
Q25. Array sort program
Implement a program to sort an array of strings
Use a sorting algorithm like bubble sort, selection sort, or quicksort
Ensure the sorting algorithm is implemented correctly for strings
Consider using built-in sorting functions in programming languages like sort() in Python
More about working at Virtusa Consulting Services

Top HR Questions asked in Virtusa Consulting Services Associate Software Engineer
Interview Process at Virtusa Consulting Services Associate Software Engineer

Top Associate Software Engineer Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

