RAKUTEN Latest Coding Questions with Solutions
Rakuten Online Test : Previously asked Java coding Question Here
Selection Process :
Round 1 : Online Objective and programing Test 240 minutes of time duration , this round has 4 section.
Section 1 : Aptitude test or English Grammar test.
Section 2 : Java coding test.
Section 3 : Computer fundamentals.
Section 4 : Descriptive question SQL + JAVA (6 question 90 Minutes).
Round 2 : Its is a video round . You will get 10 Question same to all candidates.
Round 3 : Technical Interview with focus on computer science fundamental, Java Programing and college Project.
Question 1 : Asked in 12th May Batch 2021
Please implement this method to sort a given array of String in alphabaeti order ignoring spaces ("symbols ) within the string.
The method is expected to following input may be provided and desire output corresponding to respective input is shown below.
| Input | Output |
|---|---|
| {"John", "han","poter"} | {"han","john", "poter"} |
| "shiv raj", "shivrej", "shiva" | {"shiv raj", "shiva", "shivrej"} |
| "Raaj", "raaj", "rAaj","Ra Aj" | {"RA Aj", "Raaj", "rAaj", "raaj"} |
| "J o h n", "john", "joHn", "J o H n" | {"J o H n", "J o h n", "joHn", "john"} |
import java.util.Arrays;
import java.util.Scanner;
public class StringArraySort {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
String[] arr = str.split(",");
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (arr[i].compareTo(arr[j]) > 0) {
String temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
System.out.println(Arrays.toString(arr));
}
}
Question 2 :
Please implement this method to sort a given array of String in alphabaetic order ignoring spaces (" symbols ) within the string.
The method is expected to following input may be provided and desire output corresponding to respective input is shown below
| Input | Output |
|---|---|
| ["20 30"] | 50 |
| ["5 Sad"] | 5 |
| ["10 "] | 10 |
| ["10 abc"] | 10 |
| null | Handle NullPointerException |
import java.util.Scanner;
public class SumOfNumber {
public static int getSum(String s) {
String[] arr = s.split(" ");
int sum =0;
for(int i=0; i<arr.length; i++) {
try{
sum+=Integer.parseInt(arr[i]);
}catch(Exception e) {
continue;
}
}
return sum;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
try {
if(!(str.equalsIgnoreCase(null))) {
System.out.println(getSum(str));
}else {
throw new Exception();
}
}catch(Exception e) {
System.out.println("Handle NullPointer Exception");
}
}
}
Question 3 (Asked in 12h May Batch - 2021)
Please implement this method to return a Set equals to the intersection of the parameter Sets The method should not change the content of the parameter.
The method is expected to following input may be probided and desired output corresponding to respectice input is show below.
Input Output Table
Input |
Output |
|---|---|
| {"bill dooley", "jesse james"}{"jan Darwn", "bll dooley"} | ["bill dooley"] |
| {"a","b","c"} {"a","d","e"} | {"a"} |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class IntersectionSet {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String list1 = sc.nextLine();
String list2 = sc.nextLine();
String[] arr1 = list1.split(",");
String[] arr2 = list2.split(",");
Set <Object> set1 = new HashSet<>();
Set <Object>set2 = new HashSet<>();
for (int i = 0; i < arr1.length; i++) {
set1.add(arr1[i]);
}
for (int i = 0; i < arr2.length; i++) {
set2.add(arr2[i]);
}
Set<Object> ans = getIntersection(set1, set2);
System.out.println(ans.toString());
}
public static Set<Object > getIntersection(Set<Object > set1, Set<Object>set2) {
Set<Object> ans = new HashSet<>();
for (Object x : set1) {
for (Object y : set2) {
if (x.equals(y)) {
ans.add(y);
}
}
}
return ans;
}
}
Question 4 : Coming Soon!
🚀 Boost Your Java Interview Preparation
📢 Get daily Java interview questions, coding tips & updates directly on your phone!
👉 Join our Telegram Channel: Click here to join
📸 Follow us on Instagram for quick tips & reels: Follow now
Good contact 👍
ReplyDelete