Rakuten
Lab & Allied Interview Questions and Answers
Q1. Merge Two Sorted Arrays Problem Statement
Given two sorted integer arrays ARR1
and ARR2
of size M and N, respectively, merge them into ARR1
as one sorted array. Assume that ARR1
has a size of M + N to hold all ...read more
Merge two sorted arrays into one sorted array in place.
Iterate from the end of both arrays and compare elements to merge in place
Use two pointers to keep track of the current position in each array
Handle cases where one array is fully merged before the other
Q2. Reverse a Stack Using Recursion
You are given a stack of integers. Your task is to reverse the stack using recursion without using any extra space other than the internal stack space used due to recursion. You ...read more
Reverse a stack using recursion without using any extra space other than the internal stack space.
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
Make use of auxiliary functions to handle the recursion process
Objects in JVM memory are created on the heap and managed by the garbage collector.
Objects are created on the heap memory in JVM.
Memory for objects is allocated using the 'new' keyword.
Objects are managed by the garbage collector to reclaim unused memory.
Garbage collector uses different algorithms like Mark-Sweep, G1, etc.
Example: 'String str = new String("Hello World");'
Method overriding in Java allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
In method overriding, a subclass provides a specific implementation of a method that is already provided by its superclass.
The method in the subclass must have the same name, return type, and parameters as the method in the superclass.
Method overriding is used to achieve runtime polymorphism in Java.
Example: class Animal { void sound() { Syst...read more
JVM stands for Java Virtual Machine, which is a virtual machine that enables a computer to run Java programs.
JVM is an abstract computing machine that enables a computer to run Java programs.
It provides a runtime environment in which Java bytecode can be executed.
JVM is platform-independent, meaning Java code can run on any device that has a JVM installed.
It manages memory, provides security, and facilitates garbage collection.
Examples of JVM implementations include Oracle Ho...read more
Polymorphism in Java allows objects of different classes to be treated as objects of a common superclass.
Polymorphism is achieved through method overriding and method overloading.
Method overriding allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
Method overloading allows multiple methods with the same name but different parameters in the same class.
Polymorphism helps in achieving flexibility and reusability in code....read more
Interview Process at Lab & Allied
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month