Top 10 Capgemini Interview Coding Questions

You will have a hard time in finding the interview round information about Top 10 Capgemini Interview Coding Questions, but relax we have collected the Latest Capgemini Interview Information from the previous drive students who were selected in the company, so please go through this page carefully while preparing for the Capgemini Interview Round

  • After completing the first two rounds of the placement.
  • You will be sitting in a personal interview round.
  • Where you will be facing a panel of 3-4 executives.

This round can be further divided into 2 parts

  • Technical Round
  • HR Round

It depends on the executives what they may ask you, they can ask you only about your technical background and projects that you have mentioned in your resume, or else they can ask you only situation based HR questions. So you need to be well prepared for all the scenarios, below this page you can find some frequently asked questions in the interview round.

Top 10 Capgemini Interview Coding Questions

Questions 1 Problem Statement – Bela teaches her daughter to find the factors of a given number. When she provides a number to her daughter, she should tell the factors of that number. Help her to do this, by writing a program. Write a class FindFactor.java and write the main method in it.
Note :

  • If the input provided is negative, ignore the sign and provide the output. If the input is zero
  • If the input is zero the output should be “No Factors”.

Sample Input 1:
54

Sample Output 1:
1, 2, 3, 6, 9, 18, 27, 54

Sample Input 2:
-1869

Sample Output 2 :
1, 3, 7, 21, 89, 267, 623, 1869

#include

using namespace std;
int main ()
{

int n;

cin >> n;
n = abs (n);

if (n == 0)
cout << "No factors";

else
{

for (int i = 1; i < n; i++)
{

if (n % i == 0)
cout << i << ",";

}

cout << n;
}
return 0;
}

Question 2 Problem Statement – Raj wants to know the maximum marks scored by him in each semester. The mark should be between 0 to 100 ,if it goes beyond the range display “You have entered invalid mark.”

Sample Input 1:

  • Enter no of semester:
    3
  • Enter no of subjects in 1 semester:
    3
  • Enter no of subjects in 2 semester:
    4
  • Enter no of subjects in 3 semester:
    2
  • Marks obtained in semester 1:
    50
    60
    70
  • Marks obtained in semester 2:
    90
    98
    76
    67
  • Marks obtained in semester 3:
    89
    76

Sample Output 1:

  • Maximum mark in 1 semester:70
  • Maximum mark in 2 semester:98
  • Maximum mark in 3 semester:89

Sample Input 2:

  • Enter no of semester:
    3
  • Enter no of subjects in 1 semester:
    3
  • Enter no of subjects in 2 semester:
    4
  • Enter no of subjects in 3 semester:
    2
  • Marks obtained in semester 1:
    55
    67
    98
  • Marks obtained in semester 2:
    67
    (-)98

Sample Output 2:
You have entered invalid mark.

#include
using namespace std;
int main ()
{

int n;

cout << "Enter the number of semester: ";
cin >> n;

vector < int >sem (n);

for (int i = 0; i < n; i++)
{

cout << "\nEnter number of subjects in " << i + 1 << " semester :";
cin >> sem[i];

}

for (int i = 0; i < n; i++)
{
cout << "\nMarks obtained in " << i + 1 << " semester :";

int maxi = 0, mark;

while (sem[i]--)
{
cin >> mark;

if(!(mark <= 100 and mark >= 0))
{
cout << "\nYou have entered invalid marks.";
goto r;
}

maxi = max (maxi, mark);
}

cout << "\nMaximum mark in " << i + 1 << " semester :" << maxi;

}

return 0;
}

Question 3 Problem Statement – Mayuri buys “N” no of products from a shop. The shop offers a different percentage of discount on each item. She wants to know the item that has the minimum discount offer, so that she can avoid buying that and save money.
[Input Format: The first input refers to the no of items; the second input is the item name, price and discount percentage separated by comma(,)]
Assume the minimum discount offer is in the form of Integer.

Note: There can be more than one product with a minimum discount.

Sample Input 1:
4
mobile,10000,20
shoe,5000,10
watch,6000,15
laptop,35000,5
Sample Output 1:
shoe

Explanation: The discount on the mobile is 2000, the discount on the shoe is 500, the discount on the watch is 900 and the discount on the laptop is 1750. So the discount on the shoe is the minimum.
Sample Input 2:
4
Mobile,5000,10
shoe,5000,10
WATCH,5000,10
Laptop,5000,10
Sample Output 2:
Mobile
shoe
WATCH
Laptop

#include
using namespace std;
int main ()
{
int n;
cin >> n;

vector vec(n);

for(int i=0; i>vec[i];

mapres;

int mini=INT_MAX;

for(int i=0; isecond==mini)
cout
						 

Questions 4 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 
#include 
 
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;
}

Question 5 Problem Statement –
Capgemini in its online written test has 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

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
						 

Question 6 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
 
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=cs; --i)
            { 
                printf("%d\t", a[re - 1][i]); 
            } 
            re--; 
        } 
        
         if(cs=rs; --i)
            { 
                printf("%d\t", a[i][cs]); 
            } 
            cs++; 
        } 
    }
    return 0;
}

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

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
						 

Question 8 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 
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int sum;
    sum=(a+b)*(a+b)*(a+b);
    cout<
						 

Question 9 Problem Statement –
IIHM institution is offering a variety of courses to students. Students have a facility to check whether a particular course is available in the institution. Write a program to help the institution accomplish this task. If the number is less than or equal to zero display “Invalid Range”.
Assume the maximum number of courses is 20.

Sample Input 1:

  • Enter no of course:
    5
  • Enter course names:
    Java
    Oracle
    C++
    Mysql
    Dotnet
  • Enter the course to be searched:
    C++

Sample Output 1:
C++ course is available

Sample Input 2:

  • Enter no of course:
    3
  • Enter course names:
    Java
    Oracle
    Dotnet
  • Enter the course to be searched:
    C++

Sample Output 2:
C++ course is not available

Sample Input 3:

  • Enter no of course:
    0

Sample Output 3:
Invalid Range

import java.util.*;
class Main
{

public static void main(String[] args)

{

int n=0,flag=0;

String courseSearch;

Scanner sc = new Scanner (System.in);

System.out.println("Enter no of course:");

n= sc.nextInt();

if(n<=0||n>20)

{

System.out.println("Invalid Range");

System.exit(0);

}

System.out.println("Enter course names:");

String[] course = new String[n];

sc.nextLine();

for (int i = 0; i < course.length; i++)

{

course[i] = sc.nextLine();

}

System.out.println("Enter the course to be searched:");

courseSearch=sc.nextLine();

for (int i = 0; i < course.length; i++)

{

if(course[i].equals(courseSearch))

{

flag=1;

}

}

if(flag==1)

{

System.out.println(courseSearch+" course is available");

}

else

{

System.out.println(courseSearch+" course is not available");

}

}

}

Question 10. Shraddha Kapoor’s professor suggested that she study hard and prepare well for the lesson on seasons. If her professor says month then, she has to tell the name of the season corresponding to that month. So write the program to get the solution to the above task?

  • March to May – Spring Season
  • June to August – Summer Season
  • September to November – Autumn Season
  • December to February – Winter Season

Note: The entered month should be in the range of 1 to 12. If the user enters a month less than 1 or greater than 12 then the message “Invalid Month Entered” should get displayed.

Sample Input 1:
Enter month: 6

Sample Output 1:
Season: Summer

Sample Input 2:
Enter month: 15

Sample Output 2:
Invalid Month Entered


#include
#include 
int main () 
{
printf ("Enter the month:\n");
int entry;
scanf ("%d", &entry);
switch (entry)
{
case 12:
case 1:
case 2:
printf ("Season: Winter");
break;
case 3:
case 4:
case 5:
printf ("Season: Spring");
break;
case 6:
case 7:
case 8:
printf ("Season: Summer");
break;
case 9:
case 10:
case 11:
printf ("Season: Autumn");
break;
default:
printf ("Invalid month Entered");
}
return 0;
}

Top 10 Capgemini Interview Coding Questions FAQs

Q.1 What is the Purpose of this Coding Round?

Ans: Capgemini started conducting coding rounds this year to check the problem-solving skills of candidates.

Q.2 How many Questions are there in Capgemini?
Ans: A total of 3 questions are asked and you’ve to solve them in the time period of 75 minutes.

Q.3 What is the difficulty of Coding Questions?
Ans: The candidates who clear this round will get a package of 7.5 LPA. That’s why the difficulty level of this round is high and difficult.

Q.4 On which platform this coding round will be conducted?
Ans: Capgemini is using the Cocubes platform to conduct all their tests.

Q.5 Does Capgemini Ask Coding Questions?
Ans: Yes Capgemini asks coding questions for those who’ve applied for higher posts such as analysts with 7.5 LPA.

Q.6 Is their Coding Round in Capgemini?
Ans: Yes, Capgemini also conducts coding rounds for higher posts which consist of 3 questions with a time of 75 minutes.

Q.7 Does Capgemini take the Coding Test?
Ans: Yes, from this year onwards Capgemini is taking the Coding test to check the problem-solving ability of the candidates.

This article tried to discuss the Top 10 Capgemini Interview Coding Question . Hope this blog helps you understand and solve the problem. To practice more problems you can check out MYCODE | Competitive Programming at Prepbytes.

Leave a Reply

Your email address will not be published. Required fields are marked *