Capgemini Interview Questions

Top 367 Core Java Interview Questions for 2021

Capgemini Array Questions

Question 1. Move all negative elements to one side of array Move all negative elements to one side of array – Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the ...

Question 2. Sorting using trivial hash function The problem “Sorting using trivial hash function” states that you are given an integer array. An array can be containing both negative and positive numbers. The problem statement asks to sort the array using Trivial Hash Function. Example arr[] = {5,2,1,3,6} {1, 2, 3, 5, 6} arr[] = {-3, -1, ...

Question 3. Given an Array of Pairs Find all Symmetric Pairs in it Find all symmetric pairs – You are given some pairs of an array. You have to find out the symmetric pairs in it. The symmetric pair is said to be symmetric when in pairs say (a, b) and (c, d) in which ‘b’ is equal to ‘c’ and ‘a’ is ...

Question 4. Bubble sort using two Stacks Problem Statement The problem “Bubble sort using two Stacks” states that you are given an array a[ ] of size n. Create a function to sort the given array a[ ] using a bubble sort paradigm with two stack data structures. Example a[ ] = {15, 12, 44, 2, 5, ...

Question 5. Next Greater Frequency Element In the next greater frequency element problem, we have given an array a[ ] of size n containing numbers. For each number in the array print, the number to it’s right in an array with a frequency greater than that of the current number. Example Input  a[] = {1, 1, ...

Question 6. Change the Array into Permutation of Numbers From 1 to N In this problem, we have given an array A of n elements. We need to change the array into a permutation of numbers from 1 to n using minimum replacements in the array. Example Input: 2 2 3 3 Output: 2 1 3 4 Input : 3 2 1 7 ...

Question 7. Subtraction of Two Matrices Problem Statement In the “Subtraction of Two Matrices” problem, we have given two matrices a and b. We have to find the final matrix after subtracting matrix b from matrix a. If the order is the same for both the matrices then only we can subtract them otherwise we can’t. ...

Capgemini String Questions

Question 8. Reverse a String using Stack We have given a string s of length n which contains lower case letters, upper case letters, integers, and some special symbol. Reverse the given string using stack. Let’s see some examples for better understanding. Example Input  s = “TutorialCup” Output  puClairotuT Input s = “Stack” Output kcatS Using Stack ...

Question 9. Program to Toggle all Characters in a String Problem Statement In the “Program to Toggle all Characters in a String” problem we have given a string, write a program to toggle all characters of the given string. Here toggle means converting all the uppercase characters to lowercase and all lowercase characters to uppercase characters. Input Format The first ...

Question 10. Palindrome using Recursion Problem Statement In the “Recursive Palindrome Check” or “Palindrome using Recursion” problem we have given a string “s”. We have to write a program to check if the given string is palindrome or not using recursion. A palindrome is a word, number, phrase, or other sequence of characters that reads ...

Question 11. Remove Extra Spaces from a String Problem Statement In the “Remove Extra Spaces from a String” problem we have given a string “s”. Write a program to remove all extra_spaces from the given string. Input Format The first and only one line containing a string s with some spaces. Output Format Print a string after removing ...

Question 12. Removing Spaces from a String using stringstream Problem Statement In the “Removing Spaces from a String using stringstream” problem we have given a string “s”. Write a program that uses a string stream to remove spaces from the given string. Input Format The first and only one line containing a sentence/string “s”. Output Format The first line ...

Capgemini Stack Questions

Question 13. Reverse a String using Stack We have given a string s of length n which contains lower case letters, upper case letters, integers, and some special symbol. Reverse the given string using stack. Let’s see some examples for better understanding. Example Input  s = “TutorialCup” Output  puClairotuT Input s = “Stack” Output kcatS Using Stack ...

Question 14. Next Greater Frequency Element In the next greater frequency element problem, we have given an array a[ ] of size n containing numbers. For each number in the array print, the number to it’s right in an array with a frequency greater than that of the current number. Example Input  a[] = {1, 1, ...

Capgemini Matrix Questions

Question 15. Subtraction of Two Matrices Problem Statement In the “Subtraction of Two Matrices” problem, we have given two matrices a and b. We have to find the final matrix after subtracting matrix b from matrix a. If the order is the same for both the matrices then only we can subtract them otherwise we can’t. ...