Cognizant Interview Questions & Answers: Aptitude, Programming & Technical

This comprehensive guide prepares you for Cognizant's recruitment process, covering aptitude tests, logical reasoning, verbal ability, and technical interviews. We provide sample questions and answers for both on-campus and off-campus interview patterns, including detailed explanations for mathematical problems, logical puzzles, and English language sections. The technical section focuses on programming concepts in C, object-oriented programming (OOPs) principles, and common data structures. This resource equips you with the knowledge and strategies to confidently navigate Cognizant's interview process and increase your chances of success.



Cognizant Interview Questions: Aptitude and Reasoning

Cognizant's interview process typically includes aptitude tests, logical reasoning questions, verbal ability assessments, and coding challenges. The specific format varies depending on whether it's an on-campus or off-campus recruitment drive.

Cognizant On-Campus Interview Pattern

Section Questions Time (minutes) Difficulty Cut-off
Logical Reasoning 14 14 High 70%
Quantitative Aptitude 16 16 Medium 70%
Verbal Ability 25 25 Medium 70%
Automata Fix 7 20 High 70%

Cognizant Off-Campus Interview Pattern

Section Questions Time (minutes) Difficulty Cut-off
Aptitude 16 16 High 70%
Logical Reasoning 14 14 Medium 70%
English 25 25 Medium 70%
Coding 2 60 Medium 70%

Cognizant First Round: Aptitude and Logical Questions

  1. Question 1: The product of two numbers is 2028, and their HCF is 13. How many such pairs exist?
    Answer:

    2

    Solution: Let the numbers be 13a and 13b. Then 13a * 13b = 2028, so ab = 12. The pairs (a, b) are (1, 12) and (3, 4).

  2. Question 2: What's the largest number that divides 1657 and 2037 leaving remainders of 6 and 5, respectively?
    Answer:

    127

    Solution: Find the HCF of (1657 - 6) and (2037 - 5).

  3. Question 3: The LCM of two numbers is 495, and their HCF is 5. Their sum is 100. What's their difference?
    Answer:

    10

    Solution: Let the numbers be x and 100 - x. x(100 - x) = 5 * 495. Solving the quadratic equation yields x = 45 or 55.

  4. Question 4: The HCF and LCM of two numbers are 84 and 21, respectively. If their ratio is 1:4, find the larger number.
    Answer:

    84

    Solution: Let the numbers be x and 4x. x * 4x = 84 * 21. Solving for x, and then calculating 4x gives 84.

  5. Question 5: Find the smallest 4-digit number that is a perfect square and has 7936 as a factor.
    Answer:

    246016

    Solution: Find the prime factorization of 7936. Multiply by the missing factors to make it a perfect square.

  6. Question 6: P > 994 is an integer such that P - 7 is a multiple of 11. What is the largest number that always divides (P + 4)(P + 15)?
    Answer:

    242

    Solution: Since P - 7 is divisible by 11, P can be expressed as 11k + 7. Substitute into (P + 4)(P + 15) and simplify.

  7. Question 7: What's the greatest number that divides 65, 134, and 224 leaving the same remainder?
    Answer:

    3

    Solution: Find the HCF of the differences between pairs of numbers: (134-65), (224-134), (224-65).

  8. Question 8: Find the smallest 4-digit number leaving remainders of 4 and 3 when divided by 6 and 4, respectively.
    Answer:

    1013

    Solution: The number can be expressed as 6k + 4 or 4m + 3. Find the smallest such number greater than 999.

  9. Question 9: A sum of money doubles in 6 years at compound interest. How long will it take to become 8 times larger?
    Answer:

    18 years

    Solution: If it doubles in 6 years, it quadruples in 12 years, and octuples in 18 years.

  10. Question 10: A sum of money becomes Rs. 1500 in 2 years and Rs. 1726 in 4 years. Find the principal and rate of interest.
    Answer:

    Principal: Rs. 1274, Rate: 10%

    Solution: The difference between the amounts represents the interest earned in 2 years. Calculate the interest for one year and then the principal amount.

  11. Question 11: Mina travels at 80 km/h to a bus station, then 120 km/h to her office. The total distance is 92 km, and the journey takes 1 hour. What's the distance from the bus station to her office?
    Answer:

    ~84 km

    Solution: Set up an equation representing the total travel time. Solve for the distance to the bus station, then subtract that from the total distance.

  12. Question 12: The distance between two places is 3000 m. A person travels at 6/11 km/h from P to Q at 12 pm, and another travels 5/22 km/h from Q to P at 1 pm. When do they meet?
    Answer:

    Approximately 4:17 pm

    Solution: Set up an equation representing the combined distance covered. Solve for the time taken.

  13. Question 13: A 270-meter train traveling at 120 km/h crosses a second train moving in the opposite direction at 80 km/h in 9 seconds. What's the length of the second train?
    Answer:

    230 meters

    Solution: Calculate the relative speed of the two trains, then use the formula: distance = speed * time.

  14. Question 14: A 500-meter train traveling at 63 km/h crosses a man walking at 3 km/h in the same direction. How long does it take?
    Answer:

    30 seconds

    Solution: Calculate the relative speed, then use distance = speed * time.

  15. Question 15: If ax = by, then what is the relationship between log(a), log(b), x, and y?
    Answer:

    log(a) / log(b) = y / x

  16. Question 16: If log x + log y = log(x + y), then what is the relationship between x and y?
    Answer:

    y = x / (x - 1)

  17. Question 17: If 0.5(log a + log b) = log{(a + b)/3}, what's the relationship between a and b?
    Answer:

    a² + b² = 7ab

  18. Question 18: If log x = log 3 + 2 log 2 - (3/4) log 16, find the value of x.
    Answer:

    3/2

  19. Question 19: If log x = (1/2) log y = (1/5) log z, find x⁴y³z⁻².
    Answer:

    1

  20. Question 20: A man can do a job in 10 days working 8 hours a day. If a woman is 33.33% more efficient, how many women are needed to complete the job in 10 days working 6 hours a day?
    Answer:

    16

    Solution: Use the formula: (Men * Days * Hours) / Efficiency = (Women * Days * Hours) / Efficiency

  21. Question 21: How many 5-digit numbers can be formed using 0, 2, 4, 5, and 9?
    Answer:

    96

    Solution: Total permutations (5!) minus permutations starting with 0 (4!).

  22. Question 22: What's the largest number that divides 37, 59, and 74 leaving remainders 2, 3, and 4, respectively?
    Answer:

    7

    Solution: Find the greatest common divisor (GCD) of (37-2), (59-3), and (74-4).

  23. Question 23: How many times is the digit 4 used when writing numbers from 1 to 100?
    Answer:

    20

    Solution: Count occurrences in the ones and tens places separately.

  24. Question 24: The sum of two numbers is 40, and their product is 120. Find the sum of their reciprocals.
    Answer:

    1/3

    Solution: Use the formula: (a + b) / (ab).

Cognizant Aptitude Questions

  1. Question 1: Two numbers have a product of 2028 and an HCF of 13. How many such pairs are there?
    Answer:

    2

    Solution: Find the factors of 2028 / (13 * 13) = 12. The pairs of factors of 12 are (1, 12) and (3, 4).

  2. Question 2: Find the largest number that divides 1657 and 2037, leaving remainders of 6 and 5, respectively.
    Answer:

    127

    Solution: Find the greatest common divisor (GCD) of (1657 - 6) and (2037 - 5).

  3. Question 3: The LCM of two numbers is 495, and their HCF is 5. Their sum is 100. What's their difference?
    Answer:

    10

    Solution: Let the numbers be x and 100-x. Solve x(100-x) = 5 * 495.

  4. Question 4: The HCF and LCM of two numbers are 84 and 21, respectively. Their ratio is 1:4. Find the larger number.
    Answer:

    84

    Solution: Let the numbers be x and 4x. Solve x * 4x = 84 * 21.

  5. Question 5: What's the smallest 4-digit number that is a perfect square and a multiple of 7936?
    Answer:

    246016

    Solution: Find the prime factorization of 7936 and then find the smallest number to multiply by to get a perfect square.

  6. Question 6: P > 994 is an integer such that P - 7 is divisible by 11. Find the largest number that always divides (P + 4)(P + 15).
    Answer:

    242

    Solution: Express P as 11k + 7 and substitute.

  7. Question 7: What's the greatest number that divides 65, 134, and 224, leaving the same remainder?
    Answer:

    3

    Solution: Find the GCD of the differences between the numbers.

  8. Question 8: Find the smallest 4-digit number that leaves remainders 4 and 3 when divided by 6 and 4, respectively.
    Answer:

    1013

    Solution: The number is of the form 6a + 4 and 4b + 3. Solve for the smallest integer greater than 999.

  9. Question 9: A sum doubles in 6 years at compound interest. In how many years will it become 8 times larger?
    Answer:

    18 years

  10. Question 10: An amount becomes Rs. 1500 in 2 years and Rs. 1726 in 4 years. Find the principal and interest rate.
    Answer:

    Principal: 1274, Rate: 10%

    Solution: The difference in amounts is the interest earned over 2 years. Calculate interest per year and principal.

  11. Question 11: Mina drives at 80 km/h to a station, then 120 km/h to her office (total 92 km, 1-hour journey). What's the distance from the station to her office?
    Answer:

    ~84 km

    Solution: Set up a time equation (distance/speed) and solve.

  12. Question 12: Two people walk towards each other from 3 km apart (6/11 km/h and 5/22 km/h). They start at 12 pm and 1 pm respectively. When do they meet?
    Answer:

    Approximately 4:17 pm

    Solution: Calculate the combined speed and then the time it takes to cover the 3km distance.

  13. Question 13: A 270m train traveling at 120 km/h passes another train of length 'x' going in the opposite direction at 80 km/h in 9 seconds. What is x?
    Answer:

    230 meters

    Solution: Use relative speed and the formula distance = speed * time.

  14. Question 14: A 500m train at 63 km/h passes a man walking at 3 km/h in the same direction. How long does it take?
    Answer:

    30 seconds

    Solution: Calculate the relative speed of the train and man, then use distance = speed * time.

  15. Question 15: If ax = by, then what is the relationship between log(a), log(b), x, and y?
    Answer:

    log(a)/log(b) = y/x

  16. Question 16: If log x + log y = log(x + y), solve for y in terms of x.
    Answer:

    y = x/(x - 1)

  17. Question 17: If 0.5(log a + log b) = log[(a + b)/3], what is the relationship between a and b?
    Answer:

    a² + b² = 7ab

  18. Question 18: If log x = log 3 + 2 log 2 - (3/4) log 16, what is x?
    Answer:

    3/2

  19. Question 19: If log x = (1/2) log y = (1/5) log z, find the value of x⁴y³z⁻².
    Answer:

    1

  20. Question 20: A man completes a job in 10 days (8 hours/day). A woman is 33.33% more efficient. How many women are needed to complete the job in 10 days (6 hours/day)?
    Answer:

    16

    Solution: Use ratios of work done (people * days * hours) / efficiency.

Cognizant Verbal Ability Questions

Analogies

  1. slur : speech :: smudge : ?
    Answer:

    writing

  2. epaulet : shoulder :: ring : ?
    Answer:

    finger

  3. vernacular : place :: fingerprint : ?
    Answer:

    person

Opposites

  1. Corpulent
    Answer:

    slim

  2. Adulterate
    Answer:

    purify

  3. Ambidextrous
    Answer:

    clumsy/unskilled

Error Identification

  1. Physicians point out that there are human processes which do not involve the use of the sentence.
    Answer:

    Error in part C. Should be "which do not involve."

  2. Jack ordered for two plates chicken and a glass of water.
    Answer:

    Error in part B. Should be "two plates of chicken."

Cognizant Technical Interview Questions

Cognizant technical interviews often cover C programming, C++ or Java, object-oriented programming (OOP) concepts, software engineering principles, and optionally, databases, operating systems, and data structures.

Cognizant C Programming Interview Questions

  1. What is a pointer?
    Answer:

    A variable that stores the memory address of another variable.

  2. What is a dangling pointer?
    Answer:

    A pointer that points to memory that has been freed or deallocated.

  3. What is a memory leak?
    Answer:

    Allocated memory that is no longer accessible by the program.

  4. What is a data type?
    Answer:

    A classification that specifies the kind of values a variable can hold and the operations that can be performed on it.

  5. What is the size of an integer?
    Answer:

    Typically 2 or 4 bytes.

  6. What is malloc()?
    Answer:

    A function for dynamic memory allocation.

  7. What is a string?
    Answer:

    A sequence of characters.

  8. What is the purpose of '\0' in a C string?
    Answer:

    It marks the end of the string.

  9. What is recursion?
    Answer:

    A function calling itself.

Cognizant Interview Questions: OOPs, Data Structures, and Programming

Behavioral Interview Questions

These questions assess your approach to situations. Remember to use the STAR method (Situation, Task, Action, Result) to structure your answers, providing context, your actions, and the outcome.

Prioritizing Work Tasks

When describing your work prioritization, mention your methods (to-do lists, project management tools, etc.). Share a real-life example showing how you balanced competing priorities and communicated with your team and manager.

Handling Stressful Situations

Discuss your stress-management techniques and how you approach challenges. A concrete example is best, showing your ability to stay calm, organized, and focused under pressure.

Defining Success

Highlight a specific professional achievement that demonstrates your skills and abilities. Use the STAR method and clearly explain the context, your actions, the results, and what you learned.

Asking Questions in an Interview

Asking insightful questions shows your genuine interest. Prepare questions that demonstrate you've researched the company and the role. Focus on questions that reveal information not readily available online.

Compensation Expectations

Research salary ranges for similar roles in your area. Have a salary range in mind, but be open to discussion. You might consider:

  • Providing a salary range (aiming for the higher end).
  • Asking the interviewer for the salary range.
  • Postponing the discussion until after learning more about the role.

Motivational Factors

Be prepared to describe your professional motivations. Connect these to the job and company, demonstrating your enthusiasm and long-term career goals.

Cognizant OOPs Interview Questions

Virtual Functions

A virtual function in object-oriented programming allows for runtime polymorphism. It means that the correct method to be called is determined at runtime, not at compile time, based on the object's type.

Method Overloading

Method overloading enables multiple methods with the same name but different parameters within a class. The compiler selects the appropriate method based on the arguments.

Method Overriding

Method overriding allows a subclass to provide a specific implementation for a method already defined in its superclass.

Polymorphism

Polymorphism allows objects of different classes to be treated as objects of a common type. This enables flexible and dynamic code where the specific behavior is determined at runtime.

Data Abstraction

Data abstraction hides complex implementation details, showing only essential information to the user. This simplifies interactions and reduces complexity.

Encapsulation

Encapsulation bundles data and the methods that operate on that data within a class. It protects the internal state of an object and promotes modularity.

Inheritance

Inheritance allows classes to inherit properties and methods from other classes (parent or superclasses). This promotes code reuse and establishes relationships between classes.

Constructors and Destructors

  • Constructor: Initializes an object when it is created.
  • Destructor: Performs cleanup tasks when an object is destroyed.

Cognizant Data Structures Interview Questions

Data Structures

Data structures are ways of organizing and storing data in a computer so that it can be used efficiently. Different data structures are suited to different tasks.

Linked Lists

A linked list is a linear data structure where elements are linked together. Each element (node) points to the next element in the sequence, making insertion and deletion of elements efficient.

Arrays as Data Structures

Yes, arrays are a fundamental data structure.

Binary Search Tree (BST)

A BST is a binary tree where each node's left subtree contains only nodes with values less than the node's value, and the right subtree contains only nodes with values greater than the node's value.

Binary Trees

A binary tree is a hierarchical data structure where each node has at most two children (left and right).

Stack (LIFO) Operations: Push and Pop

  • Push: Adds an element to the top of the stack.
  • Pop: Removes and returns the top element from the stack.

Stack vs. Array

Stack Array
LIFO (Last-In, First-Out) data structure. Elements are accessed by index.

Doubly Linked Lists

In a doubly linked list, each node points to both the next and previous nodes, enabling bidirectional traversal.

Queues (FIFO)

A queue is a FIFO (First-In, First-Out) data structure. Elements are added to the rear and removed from the front.

Stacks (LIFO)

A stack is a LIFO (Last-In, First-Out) data structure. Elements are added and removed from the top.

Graphs

A graph is a data structure consisting of nodes (vertices) and connections (edges) between them. Graphs are used to model relationships between objects.

Priority Queues

A priority queue is a queue where each element has a priority associated with it. Higher-priority elements are processed first.

Time Complexity of Linked List Insertion

The time complexity of inserting into a singly linked list is O(1) at the beginning or O(n) at the end (where n is the number of nodes).

Cognizant Programming Questions

Reversing a Number (Java)

Java Code

package javaapplication6;
import java.util.Scanner;

public class JavaApplication6 {
    public static void main(String[] args) {
        int i, temp, sum = 0, n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        temp = n;
        while (n > 0) {
            int r = n % 10;
            sum = sum * 10 + r;
            n = n / 10;
        }
        System.out.println("Reverse of Number is:-" + sum);
        if (temp == sum) {
            System.out.println("Palindrome");
        } else {
            System.out.println("Not Palindrome");
        }
    }
}
        

Cognizant Programming Interview Questions

Summing Digits of a Number (Java)

Java Code

package javaapplication6;
import java.util.Scanner;

public class JavaApplication6 {
    public static void main(String[] args) {
        int i, temp, sum = 0, n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        temp = n;
        while (n > 0) {
            int r = n % 10;
            sum = sum + r;
            n = n / 10;
        }
        System.out.println("Sum of digits is:-" + sum);
    }
}
        

Calculating the Power of a Number (Java)

Java Code

package javaapplication6;
import java.util.Scanner;

public class JavaApplication6 {
    public static void main(String[] args) {
        int result = 1, n;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the exponent:");
        n = sc.nextInt();
        System.out.println("Enter the base:");
        int base = sc.nextInt();
        while (n != 0) {
            result *= base;
            --n;
        }
        System.out.println("Result: " + result);
    }
}
        

Adding Two Numbers Without the + Operator (Java)

Java Code

package javaapplication6;
import java.util.Scanner;

public class JavaApplication6 {
    static int Add(int x, int y) {
        while (y != 0) {
            int carry = x & y;
            x = x ^ y;
            y = carry << 1;
        }
        return x;
    }

    public static void main(String arg[]) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter first number:");
        int a = sc.nextInt();
        System.out.println("Enter second number:");
        int b = sc.nextInt();
        System.out.println("Sum: " + Add(a, b));
    }
}
        

Subtracting Two Numbers Without the - Operator (Java)

Java Code

package javaapplication6;
import java.util.Scanner;

public class JavaApplication6 {
    static int Subtract(int x, int y) {
        while (y != 0) {
            int borrow = ~x & y;
            x = x ^ y;
            y = borrow << 1;
        }
        return x;
    }

    public static void main(String arg[]) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter first number:");
        int a = sc.nextInt();
        System.out.println("Enter second number:");
        int b = sc.nextInt();
        System.out.println("Difference: " + Subtract(a, b));
    }
}
        

Finding the Largest of Three Numbers (Java) using Bitwise Operators

Java Code

package javaapplication9;
import java.util.Scanner;

public class JavaApplication9 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        if (a - b > 0 && a - c > 0)
            System.out.println("Greatest is a: " + a);
        else if (b - c > 0)
            System.out.println("Greatest is b: " + b);
        else
            System.out.println("Greatest is c: " + c);
    }
}
        

Finding the Largest of Three Numbers (Java) using Conditional Operator

Java Code

package javaapplication9;
import java.util.Scanner;

public class JavaApplication9 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        int c = s.nextInt();
        int big = a > b ? (a > c ? a : c) : (b > c ? b : c);
        System.out.println("Greatest is: " + big);
    }
}
        

Finding the Generic Root of a Number (Java)

Java Code

package javaapplication9;
import java.util.Scanner;

public class JavaApplication9 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = 0, c;
        while (a > 9) {
            b = 0;
            while (a > 0) {
                c = a % 10;
                a = a / 10;
                b += c;
            }
            a = b;
        }
        System.out.println("Generic root: " + b);
    }
}
        

Finding Prime Factors of a Number (Java)

Java Code

package javaapplication9;
import java.util.Scanner;

public class JavaApplication9 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = 0, c, j, i, isPrime;
        for (i = 2; i <= a; i++) {
            if (a % i == 0) {
                isPrime = 1;
                for (j = 2; j <= i / 2; j++) {
                    if (i % j == 0) {
                        isPrime = 0;
                        break;
                    }
                }
                if (isPrime == 1) {
                    System.out.println(i);
                }
            }
        }
    }
}

        

Cognizant HR Interview Questions

These questions assess your personality, communication skills, and suitability for the company culture. Be prepared to answer questions about your background, career aspirations, strengths, weaknesses, and reasons for wanting to work at Cognizant.

  • Tell me about yourself.
  • What do you know about Cognizant?
  • Why should we hire you?
  • How long do you plan to work here?
  • Rate yourself on a scale of 1-10.
  • What are your greatest achievements?
  • What are your life goals?
  • What are your strengths and weaknesses?
  • What are your hobbies?
  • How will you contribute to Cognizant?
  • What are your salary expectations?