Home Get Hired Cognizant GenC Elevate Coding Questions & Answers for Freshers 2025

Table of content:

Cognizant GenC Elevate Coding Questions & Answers for Freshers 2025

As part of the GenC Elevate program, Cognizant offers freshers a fantastic opportunity to build a career in technology. However, the selection process is highly competitive, especially the coding assessment. To help you excel and secure your place in this prestigious program, this article will provide you with some important aspects you need to know about Cognizant GenC Elevate coding questions. 

We'll also break down key strategies, share important tips, and highlight crucial topics, ensuring you're prepared to succeed.

What is the Cognizant GenC Elevate Coding Assessment?

The Cognizant GenC Elevate coding assessment is designed to test your problem-solving and coding abilities, evaluating your skills in algorithms, data structures, and programming languages. Here’s an overview of what you can expect:

Aspect

Details

Total Questions

4 coding questions

Time Duration

60 minutes

Difficulty Level

Moderate to High Difficulty

Languages Allowed

Java, Python, C, C++ (most commonly Java and Python)

Focus Areas

Data Structures, Algorithms, Problem-solving, Object-Oriented Concepts

Key Topics

The coding questions in the GenC Elevate assessment focus on core programming concepts. Here's a list of topics you need to be well-versed in:

  1. Data Structures and Algorithms (DSA)
    Understanding DSA is critical for solving problems efficiently.
    • Arrays: Searching, sorting, and manipulation techniques.
    • Linked Lists: Operations such as insertion, deletion, and reversal.
    • Stacks & Queues: Used to solve problems related to backtracking and recursion.
    • Trees & Graphs: Traversals (preorder, inorder, postorder), Binary Search Trees (BST), and Graph traversal algorithms.
    • Searching & Sorting Algorithms: Binary search, Merge Sort, Quick Sort, and Heap Sort.
    • Dynamic Programming (DP): Solve optimization problems like Knapsack, Longest Common Subsequence, etc.
  2. Object-Oriented Programming (OOP)
    OOP is a cornerstone of software engineering, and proficiency in its concepts is crucial for solving complex problems.
    • Classes and Objects: The building blocks of any OOP language.
    • Inheritance, Polymorphism, Encapsulation, and Abstraction: Principles that allow for modular and reusable code.
  3. Database Management Systems (DBMS)
    Though it’s secondary to coding, having a basic understanding of SQL and databases can be helpful.
    • SQL Queries: Creating, updating, and querying databases.
    • Normalization: Ensuring data integrity and avoiding redundancy.
    • Joins and Subqueries: Mastery of these concepts is crucial for database-related coding problems.
  4. Mathematics and Logic

    • Bit Manipulation: Performing operations at the bit level.
    • Number Theory: GCD, LCM, prime number generation, etc.

Top 5 Cognizant GenC Elevate Coding Questions with Answers

Problem Statement 1

A sequence of positive integers is called "great" for a number X if we can divide it into pairs such that, for each pair, multiplying the first number by X equals the second number. More formally, a sequence A of size N is "great" for X if N is even and there exists a permutation P of size N such that for each i (1 ≤ i ≤ (N/2)), we can rearrange it so that for every pair (Ai, Aj), we have ( Ai * x = Aj ).

Ram has a sequence A and a number X. Help Ram make the sequence "great" by determining the minimum number of positive integers that should be added to the sequence A so that it becomes "great" for the number X.

Input Format

The first line of input contains two integers N, X representing the size of the sequence and the integer X respectively.

The next line of input contains N space-seperated integers a1,a2,……an, representing the elements of the sequence A.

Output Format

Print a single integer representing the minimum number of integers that need to be appended to the end of list A in order to make it a great sequence for the number X.

Solution C++
Solution Java
Solution Python

Problem Statement 2

Polycarp was learning a new data structure called an array. He found that arrays are a continuous allocation of the same type of data. He later began playing with different integer arrays. He was solving problems involving integer arrays from a famous problem portal on the internet when he got stuck on a problem. He approached you for help.

You are given an array arr; you need to find the number of empty subarrays in the given array. An empty subarray is defined as a non-empty array whose sum is zero. Help Polycarp in solving the problem.

Input Format

The first line of input contains an integer N representing the number of elements in the array.

The following line contains N integers arr[i] denoting the elements of the given array.

Output Format

Print the number of empty subarrays present in the given array.

Solution C++
Solution Java
Solution Python

Problem Statement 3

You have N boxes numbered from 1 to N. Each box contains a certain number of balls. Additionally, you have M spare balls, and you can choose to put all of them into any one of the boxes.

For each box, determine if adding all the spare balls to that box will make it the box with the largest number of balls. Note that multiple boxes can have the maximum number of balls.

Input Format

The first line of the input contains two integers N (number of boxes) and M (number of spare balls).

The second line of the input contains N space-separated integers a1, a2, …, an, where ai represents the number of balls in the ith box.

Output Format

For each box, print “1” if it will be the box with the largest number of balls after adding the spare balls and “0” if not.

Solution C++
Solution Java
Solution Python 

Problem Statement 4

There are n forts in an enemy kingdom with different power levels in the array arr. The army must:

Not attack forts with a power of 0 or less.

Attack forts in increasing order of power where the power difference between the last attacked fort and the next to be attacked is exactly 1.

The army can attack any fort at any time but can only attack each fort once.

Your task is to maximize the number of attacked forts and determine the absolute difference between (last attacked fort power + 1) and the fort with the maximum power. If no fort is attacked, print -1.

Note: If there are multiple orders with the maximum number of attacked forts, then the last attacked fort will be the minimum from all such orders.

Input Format

The first line contains a single integer n denoting the number of elements in array arr.

The second line contains n space-separated integers denoting elements of array arr.

Output Format

Print the integer denoting the absolute difference between (last attacked fort power + 1) and the fort with the maximum power. If no fort is attacked, print -1.

Solution C++
Solution Java
Solution Python 

Problem Statement 5

The teacher needs to choose a class representative for her class. She asks you to find the eligible students based on their marks. You are given the array arr that represents the marks of the N students and an integer K. 

Eligibility criteria:

Only K number of students having greater marks will be chosen. 

Students whose marks are multiples of 5 are not eligible.

You are required to print the marks of the eligible students.

Note: You need to return the marks in ascending order.

Input Format

The first line contains a single integer N.

The second line contains N space-separated integers denoting the array arr.

The third line contains an integer K.

Output Format

Print the marks in ascending order.

Solution C++
Solution Java
Solution Python 

Are you looking for coding assessment questions related to job placement? Click here to access coding practice sessions from moderate to challenging levels.

Preparation Strategies for GenC Elevate Coding Assessment

Here are some proven strategies to help you prepare effectively:

  1. Learn by Solving Problems:
    Regular practice on free, available online platforms to improve your problem-solving speed and increase your familiarity with common coding patterns.
  2. Master the Basics:
    Ensure you have a strong foundation in data structures (arrays, linked lists, trees) and algorithms (searching, sorting, dynamic programming). These concepts are essential for tackling difficult coding problems.
  3. Mock Assessments:
    Taking mock tests simulates real exam conditions and improves your time management. 
  4. Review Past Coding Questions:
    Analyzing previous years’ questions will help you recognize recurring patterns and types of problems. This also gives you an idea of the difficulty level.
  5. Understand Problem-Solving Techniques:
    It’s not just about writing code. Break down each problem, develop a plan, and then code it. Try to write clean, efficient code, as readability is important.

Conclusion

The journey from a fresher to a full-fledged corporate professional in a prestigious company like Cognizant is filled with learning and growth. The GenC Elevate coding assessment serves as an important milestone in this journey. By focusing on the right topics, practicing consistently, and honing your coding skills, you can ace this assessment and unlock a world of opportunities in one of the leading tech companies globally. 

Stay focused, practice smartly, and success will follow. Best of luck with your GenC Elevate journey!

Frequently Asked Questions (FAQs)

1. What is the difficulty level of the GenC Elevate coding assessment?

The questions range from moderate to high difficulty. They test your coding ability, as well as your problem-solving skills and efficiency.

2. How many coding questions are there in the GenC Elevate assessment?

There are four coding questions to be solved within 60 minutes. Time management is key to success.

3. Which programming languages are allowed in the assessment?

Java, Python, C, and C++ are allowed, though it's recommended to be proficient in Java or Python.

4. How do I improve my coding skills for this assessment?

Regular practice on coding platforms, solving mock assessments, and revisiting core data structures and algorithms are the most effective preparation methods.

Disclaimer: While we strive for accuracy, we do not guarantee its completeness or reliability. Readers are encouraged to verify all facts and statistics from the official company website or check independently before making decisions.

Suggested reads:

Kaihrii Thomas
Associate Content Writer

Instinctively, I fall for nature, music, humour, reading, writing, listening, travelling, observing, learning, unlearning, friendship, exercise, etc., all these from the cradle to the grave- that's ME! It's my irrefutable belief in the uniqueness of all. I'll vehemently defend your right to be your best while I expect the same from you!

TAGS
Placement
Updated On: 16 Dec'24, 05:52 PM IST