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

Capgemini Coding Questions and Answers 2021-22

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”


  • Asif Basheer

    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”));

    }
    }


  • kapilsingh

    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);


  • swapnil

    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());
    }

    }
    }


  • NISHANT

    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);
    }

    }
    }


  • NISHANT

    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);
    }

    }
    }


  • Maths

    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)


  • rajkanyam02

    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))


  • saragada

    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)


  • Santosh

    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));
    }
    }


  • Asif

    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");
    }
    }
    }
    }


    • Asif

      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");
      }
      }
      }
      }


    • Santosh

      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));
      }
      }


    • Santosh

      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));
      }
      }


    • saragada

      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”)


  • Sainithin

    where are the coding questions i have paid 700 for that there are only 6 questions over here