Table of content:
- What is the Cognizant GenC Elevate Coding Assessment?
- Top 5 Cognizant GenC Elevate Coding Questions with Answers
- Preparation Strategies for GenC Elevate Coding Assessment
- Conclusion
- Frequently Asked Questions (FAQs)
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:
- 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.
- 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.
- 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.
-
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++
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
//cin.tie(NULL);
//#ifndef ONLINE_JUDGE
//freopen("IO files/Sample_input_01.txt", "r", stdin);
//freopen("IO files/Sample_output_01.txt", "w", stdout);
//#endif
int n;
int64_t x;
cin >> n >> x;
vector<int> ar(n);
for (auto& it : ar)
cin >> it;
sort(ar.begin(), ar.end());
vector<bool> vis(n);
int j = 0, q = 0;
int ans = 0;
for (int i = 0; i < n; ++i) {
if (vis[i])
continue;
if (ar[i] * x > ar[j]) {
while (ar[i] * x >= ar[j] && j < n)
q = ++j;
q = --j;
}
if (i < q && ar[i] * x == ar[q])
vis[q--] = 1;
else
ans++;
}
cout << ans << "\n";
return 0;
}
Solution Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Read inputs
int n = scanner.nextInt();
long x = scanner.nextLong();
int[] ar = new int[n];
for (int i = 0; i < n; i++) {
ar[i] = scanner.nextInt();
}
// Sort the array
Arrays.sort(ar);
boolean[] vis = new boolean[n];
int j = 0, q = 0;
int ans = 0;
for (int i = 0; i < n; i++) {
if (vis[i]) {
continue;
}
if (ar[i] * x > ar[j]) {
while (j < n && ar[i] * x >= ar[j]) {
q = ++j;
}
q = --j;
}
if (i < q && ar[i] * x == ar[q]) {
vis[q--] = true;
} else {
ans++;
}
}
System.out.println(ans);
}
}
Solution Python
def main():
# Read inputs
n, x = map(int, input().split())
ar = list(map(int, input().split())) # Input array elements
# Sort the array
ar.sort()
# Initialize a list to track visited elements
vis = [False] * n
j = 0
ans = 0
# Iterate through the array
for i in range(n):
if vis[i]:
continue
# Ensure j is within bounds before accessing ar[j]
while j < n and ar[i] * x > ar[j]:
j += 1
# If the current element multiplied by x matches ar[j]
if j < n and ar[i] * x == ar[j]:
vis[j] = True
j += 1
else:
ans += 1
print(ans)
if __name__ == "__main__":
main()
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++
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> arr(n);
for(int i=0; i<n; i++)
cin>>arr[i];
int cnt = 0;
unordered_map<int,int> mp; //map to store the prefix sum
mp[0]++; //storing the sum of empty array
int pref = 0; //for calculation of the prefix
for(int i=0; i<n; i++)
{
pref += arr[i];
if(mp.count(pref)) //if previous pref existed means there exists a subarray whose sum is 0
cnt += mp[pref]; //incrementing the number of such subarrays
mp[pref]++; //hashing the current value of prefix
}
cout<<cnt<<endl; //printing the ans
return 0;
}
Solution Java
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Input the size of the array
int n = sc.nextInt();
// Input the array elements
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int cnt = 0; // Initialize the count of subarrays with sum 0
// HashMap to store the prefix sum and its frequency
HashMap<Integer, Integer> mp = new HashMap<>();
mp.put(0, 1); // Storing the sum of an empty array
int pref = 0; // For calculating the prefix sum
for (int i = 0; i < n; i++) {
pref += arr[i]; // Calculating prefix sum
// If the prefix sum already exists, increment the count
if (mp.containsKey(pref)) {
cnt += mp.get(pref);
}
// Update the frequency of the current prefix sum
mp.put(pref, mp.getOrDefault(pref, 0) + 1);
}
// Output the count of subarrays with sum 0
System.out.println(cnt);
}
}
Solution Python
# Input the size of the array
n = int(input())
# Input the array elements
arr = list(map(int, input().split()))
cnt = 0 # Initialize the count of subarrays with sum 0
# Dictionary to store the prefix sum and its frequency
mp = {0: 1} # Storing the sum of an empty array
pref = 0 # For calculating the prefix sum
for i in range(n):
pref += arr[i] # Calculating prefix sum
# If the prefix sum already exists, increment the count
if pref in mp:
cnt += mp[pref]
# Update the frequency of the current prefix sum
mp[pref] = mp.get(pref, 0) + 1
# Output the count of subarrays with sum 0
print(cnt)
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++
#include <bits/stdc++.h>
using namespace std;
int main(){
// read inputs
int n, m;
cin >> n >> m;
vector<int> a(n);
for(int i = 0; i < n; i++)
cin >> a[i];
// vector to store results
vector<int> res;
// maximum element in the given array
int mx = *max_element(a.begin(), a.end());
// find the answer for each element
for(int i = 0; i < n; i++){
bool ok = true;
// if the maximum element in the array
// is more than the sum of current element
// and spare balls, answer will be false
if(a[i] + m < mx)
ok = false;
// based on the result, push 1 or 0 in
// the resultant vector
if(ok)
res.push_back(1);
else
res.push_back(0);
}
// print the result
for(int i: res)
cout << i << ' ';
return 0;
}
Solution Java
import java.util.*;
public class Main {
public static void main(String[] args) {
// Read inputs
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
// Array to store results
int[] res = new int[n];
// Find the maximum element in the array
int mx = Arrays.stream(a).max().getAsInt();
// Find the answer for each element
for (int i = 0; i < n; i++) {
boolean ok = true;
// If the maximum element in the array
// is more than the sum of the current element
// and spare balls, answer will be false
if (a[i] + m < mx)
ok = false;
// Based on the result, store 1 or 0 in the result array
res[i] = ok ? 1 : 0;
}
// Print the result
for (int r : res) {
System.out.print(r + " ");
}
}
}
Solution Python
def main():
import sys
input = sys.stdin.read
data = input().split()
# Read inputs
n = int(data[0])
m = int(data[1])
a = list(map(int, data[2:2+n]))
# List to store results
res = []
# Find the maximum element in the array
mx = max(a)
# Find the answer for each element
for balls in a:
# If the maximum element in the array
# is more than the sum of the current element
# and spare balls, answer will be false
if balls + m >= mx:
res.append(1)
else:
res.append(0)
# Print the result
print(' '.join(map(str, res)))
if __name__ == "__main__":
main()
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++
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstdlib> // For std::abs
using namespace std;
void calculate_difference(vector<int>& arr) {
// Filter out forts with power less than or equal to 0
vector<int> filtered_forts;
for (int power : arr) {
if (power > 0) {
filtered_forts.push_back(power);
}
}
if (filtered_forts.empty()) {
cout << -1 << endl;
exit(0);
}
// Sort the filtered forts in increasing order
sort(filtered_forts.begin(), filtered_forts.end());
int max_length_sequence = 0;
int current_length = 0;
int last_attacked = -1;
int final_last_attacked = -1;
for (int power : filtered_forts) {
if (last_attacked == -1 || power - last_attacked == 1) {
current_length++;
last_attacked = power;
} else {
current_length = 1;
last_attacked = power;
}
if (current_length > max_length_sequence) {
max_length_sequence = current_length;
final_last_attacked = last_attacked;
}
}
int max_power = filtered_forts.back();
int difference = abs(final_last_attacked + 1 - max_power);
cout << difference << endl;
}
int main() {
int n;
cin >> n;
set<int> arr_set;
for (int i = 0; i < n; ++i) {
int power;
cin >> power;
arr_set.insert(power);
}
vector<int> arr(arr_set.begin(), arr_set.end());
// Calculating the difference
calculate_difference(arr);
return 0;
}
Solution Java
import java.util.*;
public class Main {
public static void calculateDifference(List<Integer> arr) {
// Filter out forts with power less than or equal to 0
List<Integer> filteredForts = new ArrayList<>();
for (int power : arr) {
if (power > 0) {
filteredForts.add(power);
}
}
if (filteredForts.isEmpty()) {
System.out.println(-1);
return;
}
// Sort the filtered forts in increasing order
Collections.sort(filteredForts);
int maxLengthSequence = 0;
int currentLength = 0;
Integer lastAttacked = null;
int finalLastAttacked = 0;
for (int power : filteredForts) {
if (lastAttacked == null || power - lastAttacked == 1) {
currentLength += 1;
lastAttacked = power;
} else {
currentLength = 1;
lastAttacked = power;
}
if (currentLength > maxLengthSequence) {
maxLengthSequence = currentLength;
finalLastAttacked = lastAttacked;
}
}
int maxPower = Collections.max(filteredForts);
int difference = Math.abs((finalLastAttacked + 1) - maxPower);
System.out.println(difference);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Taking input from the user
int n = scanner.nextInt();
Set<Integer> arrSet = new HashSet<>();
for (int i = 0; i < n; i++) {
arrSet.add(scanner.nextInt());
}
List<Integer> arr = new ArrayList<>(arrSet);
// Calculating the difference
calculateDifference(arr);
scanner.close();
}
}
Solution Python
def calculate_difference(arr):
# Filter out forts with power less than or equal to 0
filtered_forts = [power for power in arr if power > 0]
if not filtered_forts:
print(-1)
exit(0)
# Sort the filtered forts in increasing order
filtered_forts.sort()
max_length_sequence = 0
current_length = 0
last_attacked = None
for power in filtered_forts:
if last_attacked is None or power - last_attacked == 1:
current_length += 1
last_attacked = power
else:
current_length = 1
last_attacked = power
if current_length > max_length_sequence:
max_length_sequence = current_length
final_last_attacked = last_attacked
max_power = max(filtered_forts)
difference = abs((final_last_attacked + 1) - max_power)
print(difference)
# Taking input from the user
n = int(input())
arr = list(map(int, input().split()))
arr = set(arr)
arr = list(arr)
# Calculating the difference
calculate_difference(arr)
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++
#include <bits/stdc++.h>
using namespace std;
// Function to swap integers present at ith and jth index
void swap(vector<int> &arr, int i, int j)
{
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
// This function will put Kth largest element at its correct position similar to quicksort partition algorithm
int choose(vector<int> &arr, int low, int high, int k)
{
int pivot = low;
for (int j = low; j < high; j++)
{
if (arr[j] <= arr[high])
{
swap(arr, pivot++, j);
}
}
swap(arr, pivot, high);
// Count the numbers that are greater then pivot from high
int count = high - pivot + 1;
// If pivot is the Kth largest then return it
if (count == k)
{
return arr[pivot];
}
// If pivot is too small, so Kth largest must be on the right
if (count > k)
{
return choose(arr, pivot + 1, high, k);
}
else
{
// If pivot is too big, so Kth larges must be on the left
return choose(arr, low, pivot - 1, k - count);
}
}
vector<int> eligible(vector<int> &arr, int k, int n)
{
// It will store K largest element
vector<int> answer(k);
// Put the Kth largest at its correct position and partition the array around it
choose(arr, 0, n - 1, k);
// Putting K largest element in answer
for (int i = n - k, j = 0; j < k; ++i, ++j)
{
answer[j] = arr[i];
}
// But these integers are present in random order so we need to sort them
sort(answer.begin(), answer.end());
return answer;
}
vector<int> remove_divisible(vector<int>&arr)
{
vector<int>temp;
for(auto i : arr)
{
if(i%5!=0)
temp.push_back(i);
}
return temp;
}
int main()
{
int n;
cin>>n;
vector<int>ans(n);
for(int i=0;i<n;i++)
cin>>ans[i];
int k;
cin>>k;
ans = remove_divisible(ans);
vector<int>answer;
answer=eligible(ans,k,n);
for(int i=0;i<answer.size();i++)
{
cout<<answer[i]<<" ";
}
return 0;
}
Solution Java
import java.util.*;
public class Main {
// Function to swap elements in the array
public static void swap(List<Integer> arr, int i, int j) {
int temp = arr.get(i);
arr.set(i, arr.get(j));
arr.set(j, temp);
}
// Quickselect to find the kth largest element
public static int choose(List<Integer> arr, int low, int high, int k) {
int pivot = low;
for (int j = low; j < high; j++) {
if (arr.get(j) <= arr.get(high)) {
swap(arr, pivot++, j);
}
}
swap(arr, pivot, high);
int count = high - pivot + 1;
if (count == k) {
return arr.get(pivot);
}
if (count > k) {
return choose(arr, pivot + 1, high, k);
} else {
return choose(arr, low, pivot - 1, k - count);
}
}
// Function to get k largest eligible marks
public static List<Integer> eligible(List<Integer> arr, int k) {
int n = arr.size();
List<Integer> answer = new ArrayList<>(k);
// Put the k largest elements at their correct positions
choose(arr, 0, n - 1, k);
// Copy the last k elements (the largest ones) to the answer
for (int i = n - k; i < n; i++) {
answer.add(arr.get(i));
}
// Sort the answer before returning
Collections.sort(answer);
return answer;
}
// Function to remove marks divisible by 5
public static List<Integer> removeDivisible(List<Integer> arr) {
List<Integer> temp = new ArrayList<>();
for (int mark : arr) {
if (mark % 5 != 0) {
temp.add(mark);
}
}
return temp;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
List<Integer> arr = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
arr.add(sc.nextInt());
}
int k = sc.nextInt();
// Remove marks divisible by 5
arr = removeDivisible(arr);
// Get the eligible marks
List<Integer> answer = eligible(arr, k);
// Print the result
for (int mark : answer) {
System.out.print(mark + " ");
}
}
}
Solution Python
def swap(arr, i, j):
arr[i], arr[j] = arr[j], arr[i]
# Quickselect algorithm to find the kth largest element
def choose(arr, low, high, k):
pivot = low
for j in range(low, high):
if arr[j] <= arr[high]:
swap(arr, pivot, j)
pivot += 1
swap(arr, pivot, high)
count = high - pivot + 1
if count == k:
return arr[pivot]
if count > k:
return choose(arr, pivot + 1, high, k)
else:
return choose(arr, low, pivot - 1, k - count)
# Function to return k largest eligible marks
def eligible(arr, k):
n = len(arr)
# Get the kth largest element using quickselect
choose(arr, 0, n - 1, k)
# Collect the k largest elements
answer = arr[-k:]
# Sort the answer before returning
answer.sort()
return answer
# Function to remove marks divisible by 5
def remove_divisible(arr):
return [x for x in arr if x % 5 != 0]
def main():
# Input number of students
n = int(input())
# Input the marks of the students
arr = list(map(int, input().split()))
# Input the value of k
k = int(input())
# Remove marks divisible by 5
arr = remove_divisible(arr)
# Get the eligible marks
answer = eligible(arr, k)
# Print the eligible marks in ascending order
print(" ".join(map(str, answer)))
if __name__ == "__main__":
main()
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:
- 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. - 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. - Mock Assessments:
Taking mock tests simulates real exam conditions and improves your time management. - 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. - 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:
- Cognizant GenC Elevate Previous Year Papers with Sample Questions
- Cognizant GenC Elevate Exam Pattern & Syllabus for Freshers 2025
- Juspay Coding Questions and Answers with Tips for Freshers 2025
- ADP Selected Coding Questions, Answers and Tips for Freshers 2025
- Cognizant GenC Next Coding Questions and Answers for Freshers 2025
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!
Login to continue reading
And access exclusive content, personalized recommendations, and career-boosting opportunities.
Blogs you need to hog!

55+ Data Structure Interview Questions For 2025 (Detailed Answers)

How To Negotiate Salary With HR: Tips And Insider Advice

Best 80+ TCS NQT Most Commonly Asked Interview Questions for 2025

Comments
Add comment