# Capgemini Exceller Coding Questions 2023

## Capgemini Exceller Coding Questions and Answers 2023

Capgemini Exceller Coding Questions has been included as a new round in Capgemini Exceller selection process for 2023 graduates. This round will be conducted through CoCubes, containing 2 coding questions and you will have a total of 45 mins to solve. This round has been added to check the candidates programming, logical and problem solving techniques. Below we have given some previous year sample based questions for Capgemini Exceller Coding Round, make sure you practice all of them

## Details for Capgemini Exceller Coding Round

Coding RoundImportant Information
Total no. of question2
Allotted Time45 mins
Section PropertyMandatory
DifficultyHigh

Capgemini Exceller has started asking Coding Questions, but it is asked in a special hiring where the package being offered is more than the normal hiring. The package  offered for this post is 7.5LPA, and since the package being offered is comparatively higher than the normal hiring process, the selection process and test difficulties level are also higher than normal.

## Practice Questions for Capgemini Exceller Coding Round

#### Question 1

Problem Statement –

You have write a function that accepts, a string which length is “len”, the string has some “#”, in it you have to move all the hashes to the front of the string and return the whole string back and print it.

char* moveHash(char str[],int n);

example :-

Sample Test Case

Input:

Move#Hash#to#Front

Output:

###MoveHashtoFront

#### Question 2

Problem Statement –

Capgemini in its online written test have a coding question, wherein the students are given a string with multiple characters that are repeated consecutively. You’re supposed to reduce the size of this string using mathematical logic given as in the example below :

Input :

aabbbbeeeeffggg

Output:

a2b4e4f2g3

Input :

abbccccc

Output:

ab2c5

#### Question 3

Problem Statement –

Write the code to traverse a matrix in a spiral format.

Sample Input

Input

5   4

1   2   3   4

5   6   7   8

9   10 11 12

13 14 15 16

17 18 19 20

Output

1  2  3  4  8  12  16  20  19  18  17  13  9  5  6  7  11  15  12  14 10

#### Question 4

Problem Statement –

You’re given an array of integers, print the number of times each integer has occurred in the array.

Example

Input :

10

1 2 3 3 4 1 4 5 1 2

Output :

1 occurs 3 times

2 occurs 2 times

3 occurs 2 times

4 occurs 2 times

5 occurs 1 times

#### Question 5

Problem Statement –

Write a function to solve the following equation a3 + a2b + 2a2b + 2ab2 + ab2 + b3.

Write a program to accept three values in order of a, b and c and get the result of the above equation.

#### Question 6

Problem Statement –

A function is there which tells how many dealerships there are and the total number of cars in each dealership.

Your job is to calculate how many tyres would be there in each dealership.

Input

4 2

4 0

1 2

Output

20

16

8

There are total 3 dealerships

dealerships1 contains 4 cars and 2 bikes

dealerships2 contains 4 cars and 0 bikes

dealerships3 contains 1 cars and 2 bikes

Total number of tyres in dealerships1  is (4 x 4) + (2 x 2) = 20

Total number of tyres in dealerships2 is (4 x 4) + (0 x 2) = 16

Total number of tyres in dealerships3 is (1 x 4) + (2 x 2) = 8

### 30 comments on “Capgemini Exceller Coding Questions 2023”

• 26

Question 4

import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int [] arr = new int [10];
int count, prev = 0;
for (int i = 0; i < 10; i ++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
for (int i = 0; i < 10; i += prev) {
count = 1;
for (int j = i + 1; j < 10; j ++) {
if (arr[i] == arr[j]) {
count ++;
}
}
prev = count;
System.out.printf("%d occurs %d times", arr[i], count);
System.out.println();
}
}
}

• 26

Question 2

public class Main
{
public static void main(String[] args) {
String str = “aabbbbeeeeffggg”;
int count, prev = 0;
for (int i = 0; i < str.length(); i += prev) {
count = 1;
for (int j = i + 1; j < str.length(); j ++) {
if (str.charAt(i) == str.charAt(j)) {
count ++;
}
}
prev = count;
System.out.print(str.charAt(i));
System.out.print(count);
}
}
}

• 26

Question 1
public class Main
{
public static void main(String[] args) {
String str1 = new String(“M#ve#Hash#to#Fr#nt”);
char [] arr = new char[str1.length()];
for (int i = 0; i < str1.length(); i ++) {
if (str1.charAt(i) == '#') {
arr[i] = str1.charAt(i);
}
}
String str2 = String.valueOf(arr);
str1 = str1.replace("#", "");
System.out.println(str2.concat(str1));
}
}

• PrepInsta Support

Discord

• 26

Question 4
import java.util.*;

public class Main {
public static void main(String[] args) {
int i, j, count = 0;
ArrayList arr = new ArrayList();
Scanner sc = new Scanner(System.in);

for (i = 0; i < 5; i++) {
}

for (i = 0; i < arr.size(); i++) {
count=1;
for (j = i + 1; j < arr.size(); j++) {
if (arr.get(i).equals(arr.get(j))) {
arr.remove(j);
j –; // Adjust the loop index after removal
count ++;
}
}
System.out.printf("%d occurs %d times", arr.get(i), count);
System.out.println();
}
}
}

• Rani

Code for 2nd Que in Python
s=input(“s= “)
res=””
c=1
a=len(s)-1
for i in range(len(s)-1):
if s[i]==s[i+1]:
c=c+1
else:
res+=s[i]+str(c)
i=c
c=1
res+=s[a]+str(c)
print(“\n”,res)

• 19501A0570

Question 6: simplified
n=int(input())
s=0
for i in range(n):
x,y=map(int,input().split())
s=s+(x*4)+(y*2)
print(s)

• Epic

l=list(map(int,input().split(” “)))
l.sort()
d=list(set(l))
for i in d:
print(i,”occurs”,l.count(i),”times”)

• Asif Basheer

import java.util.*;
class Asif {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
for(int i = 0; iSystem.out.print(k+””+v));
}
}

problem-2
s=input(“Enter the string:\n”)
l1=list(s)
l=[]
for i in l1:
if i not in l:
l.append(i)
x=l1.count(i)
if x>1:
l.append(str(x))
n=”
for i in l:
n=n+i
print(n)

• John

import java.util.*;
public class Dealers {
public static void main(String[] args) {
int [][] a = {
{4,2},
{4,0},
{1,2}
};
List ans = calc(a, 3);
for(int i: ans)
System.out.print(i+” “);
}
private static List calc(int a[][], int n){
List ans = new ArrayList();

for(int i=0; i<n; i++){
int cars = a[i][0];
int bikes = a[i][1];
int tyres = (cars * 4) + (bikes * 2);