Capgemini Pseudo Code Questions With Answer
Capgemini Pseudo Code Questions With Answer
Output: "inimegpaC"
Explanation: The program should take a string and return the reverse of the
string.
Pseudo Code:
3. For each character ch in str from the end to the beginning, append ch to
reversed .
4. Return reversed .
Output: true
Output: 0 1 1 2 3
Pseudo Code:
2. Initialize a to 0 and b to 1.
3. Print a and b .
Set c to a + b .
Print c .
Set a to b and b to c .
Input: 5
Output: 120
Pseudo Code:
2. Initialize result to 1.
Multiply result by i .
1. Return result .
Output: true
Pseudo Code:
If n % i is 0, return false.
Input: 54, 24
Output: 6
Explanation: The greatest common divisor (GCD) of two numbers is the largest
positive integer that divides both numbers without a remainder.
Set temp to b .
Set b to a % b .
Set a to temp .
1. Return a .
Input: "Hello"
Output: 2
1. Return count .
Output: "Helo"
Pseudo Code:
1. Return result .
Output: 8
Explanation: Iterate through the array and keep track of the largest element.
Pseudo Code:
1. Return max .
Output: 1
Explanation: Iterate through the array and keep track of the smallest element.
Pseudo Code:
1. Return min .
Output: true
Explanation: Two strings are anagrams if they contain the same characters in
the same frequencies.
Pseudo Code:
import java.util.Arrays;
Output: [1, 2, 3, 4, 5, 6]
Explanation: Merge two sorted arrays while maintaining the sorted order.
Pseudo Code:
4. While i is less than the length of arr1 and j is less than the length of
arr2 , do:
2. Return result .
import java.util.Arrays;
Output: 2
Explanation: Perform a binary search to find the index of the given key in the
sorted array.
Pseudo Code:
Output: [2, 3, 4, 5, 8]
2. Initialize n to arr.length .
Output: [2, 3, 4, 5, 8]
Set j to i - 1 .
Decrement j .
Output: [2, 3, 4, 5, 8]
import java.util.Arrays;
Output: [2, 3, 4, 5, 8]
Output: 5
Pseudo Code:
Output: 30.0
Pseudo Code:
2. Initialize sum to 0.
Output: 3
Explanation: Identify the missing number in the array where the numbers range
from 1 to n.
+ 1) / 2 .
You can download Java technical interview programming questions that were
asked in Tech Mahindra, TCS, Wipro, Infosys, Accenture, Capgemini, and many
other service and product-based companies.