Skip to content

Cognizant Coding Questions 2025 - GenC, GenC Pro & GenC Elevate Problems

Practice 25+ Cognizant placement paper coding questions with detailed solutions. Access Cognizant GenC, GenC Pro, GenC Elevate coding problems in C, C++, Java, Python for Cognizant placement 2025-2026.

Cognizant Placement Paper Coding Questions - Complete Guide

Section titled “Cognizant Placement Paper Coding Questions - Complete Guide”

Practice with 25+ Cognizant placement paper coding questions covering the Cognizant GenC, GenC Pro, and GenC Elevate online assessment. These questions are representative of what you’ll encounter in Cognizant’s coding test.

What’s Included:

  • 25+ Coding Problems: Easy and Medium level problems with solutions
  • Multiple Language Solutions: C, C++, Java, and Python solutions
  • Time Complexity Analysis: Every solution includes complexity analysis
  • Role-Specific Patterns: GenC (basic), GenC Pro (intermediate), GenC Elevate (advanced)

Cognizant Placement Papers 2024

Access 2024 Cognizant GenC/Pro/Elevate questions with solutions and exam pattern analysis.


View 2024 Papers →

Cognizant Placement Papers 2025

Practice latest 2025 Cognizant questions with updated patterns.


View 2025 Papers →

Complete Cognizant Guide

Access complete Cognizant placement papers guide with eligibility, process, and preparation strategy.


View Complete Guide →

Cognizant Assessment Coding Section by Role:

RoleProblemsTimeDifficultyFocus Areas
GenC1-230 minEasyBasic programming, arrays, strings
GenC Pro245 minMediumDSA, recursion, sorting
GenC Elevate2-360 minMedium-HardAdvanced DSA, DP, graphs

Languages Allowed: C, C++, Java, Python

Sum of Array Elements

Problem: Find the sum of all elements in an array.

Example:

Input: [1, 2, 3, 4, 5]
Output: 15

Solution (Java):

public int arraySum(int[] arr) {
int sum = 0;
for (int num : arr) {
sum += num;
}
return sum;
}

Solution (Python):

def array_sum(arr):
return sum(arr)

Solution (C):

int arraySum(int arr[], int n) {
int sum = 0;
for (int i = 0; i < n; i++) {
sum += arr[i];
}
return sum;
}

Time Complexity: O(n) | Space Complexity: O(1)

Reverse a String

Problem: Reverse a given string.

Example:

Input: "hello"
Output: "olleh"

Solution (Java):

public String reverseString(String s) {
char[] chars = s.toCharArray();
int left = 0, right = chars.length - 1;
while (left < right) {
char temp = chars[left];
chars[left] = chars[right];
chars[right] = temp;
left++;
right--;
}
return new String(chars);
}

Solution (Python):

def reverse_string(s):
return s[::-1]

Time Complexity: O(n) | Space Complexity: O(n)

Check Prime Number

Problem: Determine if a number is prime.

Example:

Input: 17
Output: true

Solution (Java):

public boolean isPrime(int n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) return false;
}
return true;
}

Solution (Python):

def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True

Time Complexity: O(√n) | Space Complexity: O(1)

Factorial

Problem: Calculate factorial of a number.

Example:

Input: 5
Output: 120

Solution (Java):

public long factorial(int n) {
if (n <= 1) return 1;
long result = 1;
for (int i = 2; i <= n; i++) {
result *= i;
}
return result;
}

Solution (Python):

def factorial(n):
result = 1
for i in range(2, n + 1):
result *= i
return result

Time Complexity: O(n) | Space Complexity: O(1)

Palindrome Check

Problem: Check if a string is palindrome.

Example:

Input: "madam"
Output: true

Solution (Java):

public boolean isPalindrome(String s) {
s = s.toLowerCase();
int left = 0, right = s.length() - 1;
while (left < right) {
if (s.charAt(left) != s.charAt(right)) {
return false;
}
left++;
right--;
}
return true;
}

Solution (Python):

def is_palindrome(s):
s = s.lower()
return s == s[::-1]

Time Complexity: O(n) | Space Complexity: O(1)

Find Maximum Element

Problem: Find maximum element in array.

Solution (Java):

public int findMax(int[] arr) {
int max = arr[0];
for (int num : arr) {
if (num > max) max = num;
}
return max;
}

Solution (Python):

def find_max(arr):
return max(arr)

Time Complexity: O(n) | Space Complexity: O(1)

Count Vowels

Problem: Count vowels in a string.

Solution (Java):

public int countVowels(String s) {
int count = 0;
s = s.toLowerCase();
for (char c : s.toCharArray()) {
if ("aeiou".indexOf(c) != -1) count++;
}
return count;
}

Solution (Python):

def count_vowels(s):
return sum(1 for c in s.lower() if c in 'aeiou')

Time Complexity: O(n) | Space Complexity: O(1)

Know Your Role

  • GenC: Focus on basic programming
  • GenC Pro: Practice DSA fundamentals
  • GenC Elevate: Master algorithms & DP

Master One Language

  • Choose C, C++, Java, or Python
  • Know standard library functions
  • Practice writing code quickly
  • Handle I/O properly

Time Management

  • Read problem carefully
  • Write solution step by step
  • Test with given examples
  • Handle edge cases

Common Mistakes to Avoid

  • Off-by-one errors
  • Not handling empty inputs
  • Integer overflow
  • Wrong output format
Practice More Cognizant Coding Questions →

Practice Cognizant coding questions regularly! Focus on problems matching your target role (GenC/Pro/Elevate). Cognizant values working code that handles all test cases.

Pro Tip: For GenC Elevate, also prepare for behavioral and case study rounds along with coding.

Last updated: February 2026