Capgemini Menu9>
- Placement Papers
- Pseudo Code
- English Communication Test
- Game Based Aptitude Test
- Behavioral Competency Test
- Game based Questions
- Syllabus
- Recruitment Process
- Game Based Cognitive Assessement
- Coding Questions
- Spoken English Test
- Interview Questions
- Capgemini Registration Process
- Exceller Interview Questions
- Essay Writing
PREPINSTA PRIME
Capgemini Exceller Coding Questions 2025
Capgemini Exceller Coding Questions and Answers 2025
Capgemini Exceller Coding Questions has been included as a new round in Capgemini Exceller selection process for 2025 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 Round | Important Information |
---|---|
Total no. of question | 2 |
Allotted Time | 45 mins |
Section Property | Mandatory |
Difficulty | High |
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
#include<string.h> #include<stdio.h>char *moveHash(char str[],int n) { char str1[100],str2[100]; int i,j=0,k=0; for(i=0;str[i];i++) { if(str[i]=='#') str1[j++]=str[i]; else str2[k++]=str[i]; } strcat(str1,str2); printf("%s",str1); } int main() { char a[100], len; scanf("%[^\n]s",a); len = strlen(a); moveHash(a, len); return 0; }
#include<bits/stdc++.h> using namespace std; char *moveHash(char str[],int n) { char str1[100],str2[100]; int i,j=0,k=0; for(i=0;str[i];i++) { if(str[i]=='#') str1[j++]=str[i]; else str2[k++]=str[i]; } strcat(str1,str2); cout<<str1; } int main() { char a[100], len; cin>>a; len = strlen(a); moveHash(a, len); return 0; }
import java.util.*; public class MoveHash { public static void moveHash(String str ,int n) { String str1= new String(""); String str2= new String(""); int i=0; for(i=0;i<n;i++) { if(str.charAt(i)=='#') str1=str1 + str.charAt(i); else str2 = str2 + str.charAt(i); } String result = str1.concat(str2); System.out.println(result); } public static void main(String args[]) { Scanner sc = new Scanner(System.in); String a = sc.nextLine(); int len= a.length(); moveHash(a, len); } }
s=input() x=s.count("#") s=s.replace("#","") print("#"*x+s)
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
#include<stdio.h> int main() { char str[100]; scanf("%[^\n]s",str); int i, j, k=0, count = 0; char str1[100]; for(i=0; str[i]!='\0'; i++) { count = 0; for(j=0; j<=i; j++) { if(str[i]==str[j]) { count++; } } if(count==1) { str1[k] = str[i]; k++; } } for(i=0; i<k; i++) { count = 0; for(j=0; str[j]!='\0'; j++) { if(str1[i]==str[j]) { count++; } } if(count==1) { printf("%c",str1[i]); } else { printf("%c%d",str1[i],count); } } return 0; }
import java.util.*; public class CharacterCount { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); int i, j, k = 0, count = 0; String uni = new String(""); for(i=0; i<str.length(); i++) { count = 0; for(j=0; j<=i; j++) { if(str.charAt(i)==str.charAt(j)) { count++; } } if(count==1) { uni = uni + str.charAt(i); } } for(i=0; i<uni.length(); i++) { count = 0; for(j=0; j<str.length(); j++) { if(uni.charAt(i)==str.charAt(j)) { count++; } } if(count==1) { System.out.printf("%c",uni.charAt(i)); } else { System.out.printf("%c%d",uni.charAt(i),count); } } } }
def solve(s): ans="" c=1 for i in range(len(s)-1): if(s[i]==s[i+1]): c+=1 else: if(c==1): ans+=s[i] else: ans+=s[i]+str(c) c=1 if(c==1): ans+=s[i+1] else: ans+=s[i+1]+str(c) return anss=input() print(solve(s))
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
#include<stdio.h> int main() { int a[5][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16},{17,18,19,20}}; int rs = 0, re = 5, cs = 0, ce = 4; int i, j, k=0; for(i=0;i<5;i++) { for(j=0;j<4;j++) { printf("%d\t",a[i][j]); } printf("\n"); } printf("\n"); while(rs { for(i=cs;i<ce;i++) { printf("%d\t",a[rs][i]); } rs++; for(i=rs;i<re;i++) { printf("%d\t",a[i][ce-1]); } ce--; if(rs<re) { for(i=ce-1; i>=cs; --i) { printf("%d\t", a[re - 1][i]); } re--; } if(cs<ce) { for(i=re-1; i>=rs; --i) { printf("%d\t", a[i][cs]); } cs++; } } return 0; }
import java.util.*;
public class Solution
{
public static List<Integer> solve(int [][]matrix,int row,int col)
{
List<Integer> res=new ArrayList<Integer>();
boolean[][] temp=new boolean[row][col];
int []arr1={0,1,0,-1};
int []arr2={1,0,-1,0};
int di=0,r=0,c=0;
for(int i=0;i<row*col;i++)
{
res.add(matrix[r][c]);
temp[r][c]=true;
int count1=r+arr1[di];
int count2=c+arr2[di];
if(count1>=0 && row>count1 && count2>=0 && col>count2 && !temp[count1][count2]){
r=count1;
c=count2;
}
else
{
di=(di+1)%4;
r+=arr1[di];
c+=arr2[di];
}
}
return res;
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int m=sc.nextInt();
int n=sc.nextInt();
int matrix[][]=new int[m][n];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
matrix[i][j]=sc.nextInt();
}
System.out.println(solve(matrix,m,n));
}
}
def spiralOrder(arr):
ans=[]
while arr:
ans+=arr.pop(0)
arr= (list(zip(*arr)))[::-1]
return ans
arr=[]
n,m=map(int,input().split())
for i in range(n):
arr.append(list(map(int,input().split())))
print(*spiralOrder(arr))
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
#include<stdio.h> int main() { int n; scanf("%d",&n); int arr[n]; int count; int k=0; for(int i=0; i<n; i++) { scanf("%d",&arr[i]); //input of arrray } int newarr[n]; //step 1 for(int i=0; i<n; i++) { count = 0; for(int j=0; j<=i; j++) { if(arr[i]==arr[j]) { count++; } } if(count==1) { newarr[k] = arr[i]; k++; } } //step 2 for(int i=0; i<k; i++) { count = 0; for(int j=0; j<n; j++) { if(newarr[i]==arr[j]) { count++; } } printf("%d occurs %d times\n",newarr[i],count); } return 0; }
import java.util.Scanner; public class ArrayFrequency { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int array[] = new int[n]; // taking value of integer int count = 0; int k = 0; for(int i=0; i<n; i++) { array[i] = sc.nextInt(); //elements of array } //step - 1 int newarray[] = new int[n]; for(int i=0; i<n; i++) { count = 0; for(int j=0; j<=i; j++) { if(array[i]==array[j]) { count++; } } if(count == 1) { newarray[k] = array[i]; k++; } } //step 2; for(int i=0; i<k; i++) { count = 0; for(int j=0; j<n; j++) { if(newarray[i] == array[j]) { count++; } } System.out.printf("%d occurs %d times\n",newarray[i],count); } } }
n=int(input()) arr=list(map(int,input().split())) dup=[] for i in arr: if(i not in dup): dup.append(i) print("{} occurs {} times".format(i,arr.count(i)))
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.
#include<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); int sum; sum=(a+b)*(a+b)*(a+b); printf("%d",sum); }
#include<iostream.h> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; int sum; sum=(a+b)*(a+b)*(a+b); cout<<sum; }
def spiralOrder(arr): ans=[] while arr: ans+=arr.pop(0) arr= (list(zip(*arr)))[::-1] return ans arr=[] n,m=map(int,input().split()) for i in range(n): arr.append(list(map(int,input().split()))) print(*spiralOrder(arr))
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
3
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
#include<stdio.h> int main() { int t,cars,bikes; scanf("%d",&t); for(int i=0;i<t;i++) { scanf("%d%d",&cars,&bikes); printf("%d\n",cars*4+bikes*2); } }
#include<iostream.h> using namespace std; int main() { int t,cars,bikes; cin>>t; for(int i=0;i<t;i++) { cin>>cars>>bikes; cout<<cars*4+bikes*2; cout<<"\n"; } }
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int dealership=sc.nextInt(); while(dealership-->0) { int cars=sc.nextInt(); int bikes=sc.nextInt(); System.out.println(cars*4+bikes*2); } } }
for i in range(int(input())): cars,bikes=map(int,input().split()) print(cars*4+bikes*2)
30+ Companies are Hiring
Get Hiring Updates right in your inbox from PrepInsta
Question 4 (Using LinkedHashMap)
import java.util.*;
class Asif {
public static void main(String[] args) {
int s[] = {1, 2, 3, 3, 4, 1, 4, 5, 1, 2};
LinkedHashMap mapp = new LinkedHashMap();
for(int i = 0; i
System.out.println(key + ” occures “+value+” times”));}
}
import java.util.*;
public class MyClass {
public static void main(String args[]) {
String s = “Move#Hash#to#Front”;
String v = “”;
String h = “”;
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='#'){
v += s.charAt(i);
}else{
h +=s.charAt(i);
}
}
System.out.println(v +""+h);
problem statement 2(in java ): public class demo3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
char arr[]=s.toCharArray();
HashMap c = new HashMap();
for(int i=0;i<s.length();i++){
if(c.containsKey(arr[i])){
c.put(arr[i],c.get(arr[i])+1);
}
else{
c.put(arr[i],1);
}
}
for (Map.Entry entry: c.entrySet()){
System.out.print(entry.getKey()+""+entry.getValue());
}
}
}
Q. 1.)
Solution :-
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s=sc.next();
String s1[]=s.split(“#”);
List ll = new ArrayList();
for (String i:s1
) {
ll.add(i);
}
LinkedHashMap lhm = new LinkedHashMap();
for (int i=0;i<s.length();i++)
{
if (lhm.containsKey(s.charAt(i)))
{
lhm.put(s.charAt(i),lhm.get(s.charAt(i))+1);
}
else
{
lhm.put(s.charAt(i),1);
}
}
int count=0;
for (Map.Entry entry:lhm.entrySet()
) {
if (entry.getKey()==’#’)
{
count=entry.getValue();
}
}
for (int i=0;i<count;i++)
{
ll.add(0,"#");
}
for (String i:ll
) {
System.out.print(i);
}
}
}
Here is one solution :-
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
ArrayList al1 = new ArrayList();
ArrayList al2 = new ArrayList();
while (n>0)
{
al1.add(sc.nextInt());
al2.add(sc.nextInt());
n–;
}
ArrayList al = new ArrayList();
ListIterator li1 = al1.listIterator();
ListIterator li2 = al2.listIterator();
while (li1.hasNext()&& li2.hasNext())
{
al.add(li1.next()*4+ li2.next()*2);
}
for (Integer i:al
) {
System.out.println(i);
}
}
}
Q-2
from collections import Counter
d=Counter()
s=input()
d.update(s)
l={}
for i in d.elements():
if d[i]==1:
l.update({i:(str(”))})
else:
l.update({i:(str(d[i]))})
new_dict= ”.join(map(”.join, l.items()))
print(new_dict)
Problem Statement 1 :
str = int(input(“String :: “))
def hashfun(str):
str1=””
str2=””
for i in str:
if i == ‘#’:
str1 +=i
else:
str2 += i
str1 += str2
return str1
print(hashfun(str))
code for 6th question in python
l=[]
t= int(input())
for i in range(t):
a=[int(b) for b in input().split()]
l.append(a)
#print(l)
for i in l:
print(i[0]*4+i[1]*2)
import java.util.Arrays;
import java.util.Scanner;
public class dealear_ship_car {
static int car(int car) {
int cartyre = 4;
return (car * cartyre);
}
static int bike(int bike){
int biketyre = 2;
return (bike * biketyre);
}
static int totaltyres(int noofcars ,int noofbikes){
int total = car(noofcars) + bike(noofbikes);
return total;
}
public static void main(String[] args) {
System.out.println(“enter total no of dealerships : “);
Scanner in = new Scanner(System.in);
int dealers = in.nextInt();
int[] arr = new int[dealers];
int noofcars = 0, noofbikes = 0;
for (int i = 0; i < dealers; i++) {
noofcars = in.nextInt();
noofbikes = in.nextInt();
arr [i] = totaltyres(noofcars,noofbikes);
}
System.out.println(Arrays.toString(arr));
}
}
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner t=new Scanner(System.in);
int n=t.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=t.nextInt();
int visited[]=new int[100];
for(int i=0;i<visited.length;i++)
visited[i] = 0;
int count=0;
for(int i=0;i<n;i++)
{
count=0;
if(visited[a[i]]==0)
{
for(int j=i;j<n;j++)
{
if(a[i]==a[j])
{
count++;
visited[a[i]]=1;
}
}
System.out.println(a[i]+" occurs "+count+" times");
}
}
}
}
What is the 5th question solution ?
The equation is being simplified in order to find out the optimum solution
print((a+b)**3)
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner t=new Scanner(System.in);
int n=t.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=t.nextInt();
int visited[]=new int[100];
for(int i=0;i<visited.length;i++)
visited[i] = 0;
int count=0;
for(int i=0;i<n;i++)
{
count=0;
if(visited[a[i]]==0)
{
for(int j=i;j<n;j++)
{
if(a[i]==a[j])
{
count++;
visited[a[i]]=1;
}
}
System.out.println(a[i]+" occurs "+count+" times");
}
}
}
}
public static void main(String[] args) {
System.out.println(“enter value of a and b : “);
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.println(equation(a,b));
}
}
import java.util.Scanner;
public class Solving_an_equation {
static int equation(int x,int y){
return ((x+y)*(x+y)*(x+y));
}
public static void main(String[] args) {
System.out.println(“enter value of a and b : “);
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b = in.nextInt();
System.out.println(equation(a,b));
}
}
question 4 answer:
w= int(input())
a=[int(i) for i in input().split()]
l=[]
for i in a:
c=a.count(i)
l.append(c)
d=(dict(zip(a,l)))
#print(d)
for i,j in d.items():
print(i,”occurs”,j,”items”)
where are the coding questions i have paid 700 for that there are only 6 questions over here
The coding material is provided free of cost, the mock contains the questions of rest of the sections