Capgemini Interview Questions  

See also
Top 367 Core Java Interview Questions for 2021
Please click Like if you loved this article?

Array Questions Capgemini

Question 1. Move all Negative Numbers to Beginning and Positive to End with Constant Extra Space 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 array respectively without using extra space. This will be a ...

Read more

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, ...

Read more

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

Read more

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, ...

Read more

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, ...

Read more

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 Please click Like if you loved ...

Read more

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

Read more

String Questions Capgemini

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  Please click Like if you loved this article? puClairotuT ...

Read more

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

Read more

Question 10. Recursive Palindrome Check Problem Statement   In the “Recursive Palindrome Check” 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 sequences of characters that reads the same backward as ...

Read more

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

Read more

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

Read more

Stack Questions Capgemini

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  Please click Like if you loved this article? puClairotuT ...

Read more

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, ...

Read more

Matrix Questions Capgemini

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

Read more