• Articles
  • Interview Questions

Cognizant GenC Interview Questions and Answers

CTA

Cognizant is an IT service company and the GenC program at Cognizant provides excellent opportunities for freshers to get hired and trained on the latest skills in technology and consulting. Today, Cognizant employs over 350,000 professionals worldwide at a salary scale ranging from ₹4 to ₹12 lakhs per year for freshers in the GenC program. Here are some important interview questions to crack your Cognizant GenC interview.

Cognizant GenC Aptitude-Based Questions

1. Ramu and Shamu started a business by investing Rs. 36,000 and RS. 63,000. Find the share of each, out of the annual profit of Rs. 5500.

Ans: Rs. 2000 and Rs. 3500 respectively

Explanation:

Step 1: Calculate the total investment

Total Investment = Ramu’s Investment + Shamu’s Investment

Total Investment = Rs. 36,000 + Rs. 63,000

Total Investment = Rs. 99,000

Step 2: Find the ratio of their investments

Ramu’s Ratio = Ramu’s Investment / Total Investment

Ramu’s Ratio = Rs. 36,000 / Rs. 99,000

Ramu’s Ratio = 4 / 11

Shamu’s Ratio = Shamu’s Investment / Total Investment

Shamu’s Ratio = Rs. 63,000 / Rs. 99,000

Shamu’s Ratio = 7 / 11

Step 3: Calculate their shares of the annual profit

Ramu’s Share = Ramu’s Ratio * Annual Profit

Ramu’s Share = 4 / 11 * Rs. 5,500

Ramu’s Share = Rs. 2,000 (rounded to the nearest rupee)

Shamu’s Share = Shamu’s Ratio * Annual Profit

Shamu’s Share = 7 / 11 * Rs. 5,500

Shamu’s Share = Rs. 3,500 (rounded to the nearest rupee)

So, Ramu’s share of the annual profit is approximately Rs. 2,000, and Shamu’s share is approximately Rs. 3,500.

2. A train is moving at a speed of 132 kmph. If the length of the train is 110 meters, how long will it take to cross a railway platform 165 m long?

Ans: 7.5 s

Explanation:

Step 1: Convert the speed of the train from km/h to m/s.

Given, speed of the train = 132 kmph

To convert km/h to m/s, we use the conversion: 1 km/h = 1000 m / 3600 s (since 1 hour = 3600 seconds)

Speed of the train in m/s = 132 km/h * (1000 m / 3600 s)

Speed of the train in m/s = 36.67 m/s (rounded to two decimal places)

Step 2: Calculate the total distance the train travels while crossing the platform.

The total distance covered by the train while crossing the platform is equal to the length of the train plus the length of the platform.

Total distance = Length of the train + Length of the platform

Total distance = 110 meters + 165 meters

Total distance = 275 meters

Step 3: Calculate the time taken to cover the total distance.

Time (t) = Distance / Speed

Time taken to cross the platform = Total distance / Speed of the train

Time taken to cross the platform = 275 meters / 36.67 m/s

Time taken to cross the platform = 7.50 seconds (rounded to two decimal places)

So, it will take 7.50 seconds for the train to cross the railway platform.

3. The difference between the value of the number increased by 20 % and the value of the number decreased by 25 % is 36. What is the number?

Ans: 80

Explanation:

Let’s assume the required number as “x.”

Step 1: Calculate the value of the number increased by 20%

Value after 20% increase = x + 0.20x

Value after 20% increase = 1.20x

Step 2: Calculate the value of the number decreased by 25%

Value after 25% decrease = x – 0.25x

Value after 25% decrease = 0.75x

Step 3: Set up the equation based on the given information

The difference between the two values is given as 36. So, we have:

1.20x – 0.75x = 36

Step 4: Solve the equation for “x”

Combine like terms:

0.45x = 36

Now, isolate “x” by dividing both sides by 0.45:

x = 36 / 0.45

x = 80

Step 5: Check the solution

Let’s verify that the difference between the value increased by 20% and the value decreased by 25% is indeed 36:

Value after 20% increase = 1.20 * 80 = 96

Value after 25% decrease = 0.75 * 80 = 60

Difference = 96 – 60 = 36

Since the difference matches the given information, the number is indeed 80.

4. 40 % is the passing marks. A student gets 250 marks yet fails by 38 marks. What are the maximum marks?

Ans: 720

Explanation:

Let’s assume the maximum marks in the exam as “M.”

Step 1: Calculate the passing marks (40% of the maximum marks)

Passing Marks = 0.40 * M

Step 2: Calculate the marks obtained by the student (250 marks)

Marks Obtained = 250

Step 3: Calculate the marks required to pass

Marks Required to Pass = Passing Marks – Marks Obtained

Marks Required to Pass = 0.40 * M – 250

Step 4: It is given that the student fails by 38 marks. So, set up the equation:

Marks Required to Pass = 38

Step 5: Combine the equations and solve for “M”

0.40 * M – 250 = 38

Step 6: Solve for “M”

Add 250 to both sides to isolate 0.40 * M:

0.40 * M = 38 + 250

0.40 * M = 288

Now, divide both sides by 0.40 to find the value of “M”:

M = 288 / 0.40

M = 720

So, the maximum marks in the exam are 720.

Get ready to ace your technical support interview with our ultimate guide to Technical Support Interview Questions.

5. The sum of the ages of 5 children born at the intervals of 3 years each is 50 years. What is the age of the youngest child?

Ans: 4 years old

Explanation:

Let’s represent the age of the youngest child as “x” years.

Since there are 5 children with ages at intervals of 3 years each, we can set up the following equations:

1st child’s age = x

2nd child’s age = x + 3 (3 years older than the youngest)

3rd child’s age = x + 6 (3 years older than the second child)

4th child’s age = x + 9 (3 years older than the third child)

5th child’s age = x + 12 (3 years older than the fourth child)

Now, the sum of their ages is given as 50 years:

x + (x + 3) + (x + 6) + (x + 9) + (x + 12) = 50

Let’s solve for “x”:

5x + 30 = 50

5x = 20

x = 4

Therefore, the age of the youngest child (1st child) is 4 years old.

Cognizant GenC DSA-Based Questions

6. What is a data structure, and how many types are there? Explain

A data structure is a way of organizing and storing data in a computer’s memory to facilitate efficient operations and manipulations of that data. Data structures provide a means of representing and managing data in a structured and organized manner.

There are two types of data structures:

1) Linear data structure

2) Non-linear data structure

  • Linear Data Structure: A data structure that includes data elements arranged sequentially or linearly, where each element is connected to its previous and next nearest elements, is referred to as a linear data structure. Arrays and linked lists are two examples of linear data structures.
  • Non-Linear Data Structure: Non-linear data structures are data structures in which data elements are not arranged linearly or sequentially. In a non-linear data structure, we cannot walk through all elements in one pass, as in a linear data structure. Trees and graphs are two examples of non-linear data structures.

7. What is a linked list? Explain its types.

A linked list is a linear data structure in which elements are stored as separate nodes, each containing a reference to the next node, forming a chain-like structure that allows efficient insertion and deletion operations.

There are three types of linked lists: singly linked lists, doubly linked lists, and circular linked lists.

  • Singly Linked List: In this type of linked list, every node stores the address or reference of the next node in the list, and the last node has the next address or reference as NULL.
  • Doubly Linked List: Two references are associated with each node. One of the reference points is to the next node, and one is to the previous node.
  • Circular Linked List: A circular linked list is a type of linked list in which all nodes are interconnected to form a circle. There is no NULL node at the end. This type of linked list can take the form of either a singly circular linked list or a doubly circular linked list.

8. What is a stack, and where can it be used?

An abstract data type that adheres to the Last-In-First-Out (LIFO) rule is a stack. It is a linear data structure in which components are added to and subtracted from the top end.

Stacks are useful for organizing function calls in programming languages, evaluating expressions, backtracking algorithms, and undoing actions in text editors, among other things.

Go through these Google Interview Questions to crack your interview!

9. What is a queue, and where can it be used?

An abstract data type that adheres to the First-In-First-Out (FIFO) rule is a queue.. Elements are inserted toward the back and withdrawn from the front in a linear data structure.

For synchronized communication, queues are used in a variety of applications, including task scheduling, printer spooling, event handling, graph traversal, and data buffering.

10. What is binary search?

A frequently used approach for finding a specific element within a sorted collection of data is a binary search. It employs a divide-and-conquer strategy to successfully find the desired ingredient. By comparing the target element with the middle element of the sorted collection, the algorithm reduces the search space in half again and again. The search is carried out in the bottom or higher half, depending on the comparison, until the target element is located or the search space is reduced to zero. With a time complexity of O(log n), binary search is a quick search technique for sizable, sorted datasets.

Cognizant GenC Java-Based Questions

11. How do you reverse a string in Java?

public class StringPrograms {
public static void main(String[] args) {
String str = "123";
System.out.println(reverse(str));
}
public static String reverse(String in) {
if (in == null)
throw new IllegalArgumentException("Null is not valid input");
StringBuilder out = new StringBuilder();
char[] chars = in.toCharArray();
for (int i = chars.length - 1; i >= 0; i--)
out.append(chars[i]);
return out.toString();
}
}

Go through these HR Interview Questions to crack your interview!

12. How do you swap two numbers without using a third variable in Java?

public class SwapNumbers {
public static void main(String[] args) {
int a = 10;
int b = 20;
System.out.println("a is " + a + " and b is " + b);
a = a + b;
b = a - b;
a = a - b;
System.out.println("After swapping, a is " + a + " and b is " + b);
}
}

13. Write a Java program to check if the given number is a prime number.

public class PrimeNumberCheck {
public static void main(String[] args) {
System.out.println(isPrime(19)); // true
System.out.println(isPrime(49)); // false
}
public static boolean isPrime(int n) {
if (n == 0 || n == 1) {
return false;
}
if (n == 2) {
return true;
}
for (int i = 2; i <= n / 2; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}

14. Write a Java program to print a Fibonacci sequence using a loop.

public class PrintFibonacci {
public static void printFibonacciSequence(int count) {
int a = 0;
int b = 1;
int c = 1;
for (int i = 1; i <= count; i++) {
System.out.print(a + ", ");
a = b;
b = c;
c = a + b;
}
}
public static void main(String[] args) {
printFibonacciSequence(10);
}
}

15. How do you check whether a string is a palindrome in Java?

boolean checkPalindromeString(String input) {
boolean result = true;
int length = input.length();
for (int i = 0; i < length/2; i++) {
if (input.charAt(i) != input.charAt(length - i - 1)) {
result = false;
break;
}
}
return result;
}

Cognizant GenC Concept-Based Questions

16. List the features of the Java programming language.

  • Object-Oriented: Java adheres to the principles of object-oriented programming. We create classes and objects to access Java.
  • Portable: It is the ability to execute Java programs on various machines. When you write a Java program (.java), it is converted into bytecode (.class), which can be seamlessly executed on any machine without the need for a specific platform.
  • Platform-Independent: Programming in Java is platform-neutral. This sets Java apart from languages like C and C++, which necessitate a specific platform for execution. Moreover, Java includes its own platform for running programs, making it self-contained. Java comes with a platform that is used to run its programs. Java can be run independently of an operating system.
  • Secured: Java’s incorporation of ByteCode and Exception handling enhances its security features.
  • Robust: Java is considered a robust language because of its strong type checking, built-in exception handling, automatic memory management, platform independence through the JVM, and support for object-oriented programming. These features contribute to its reliability, stability, and ability to handle errors effectively.

17. What do you understand about Java Virtual Machine?

The computer can run Java programs thanks to the Java Virtual Machine (JVM). The main method contained in the Java code is called JVM, which functions as a run-time engine. The computer system needs to implement the JVM specification. The Java code is converted by the JVM into a Bytecode that is similar to native code and independent of the target machine.

Go through these Behavioural Interview Questions to crack your interview!

18. What are objects and classes?

  • Classes: A class in Java is a blueprint or template that specifies the characteristics and operations of an object. It acts as a guide for developing instances of the class, referred to as objects, which are particular examples of the class. A class allows you to construct reusable and modular code structures by encapsulating data and methods associated with that data.
  • Objects: Instances of a class are objects. They have their own data and methodologies and represent real-world entities or concepts. Using the ‘new’ keyword, objects are generated from classes and can communicate with one another by calling methods for accessing data specified in those classes. You can interact with particular instances of an object and take actions based on their behavior and data. They are key building blocks of Java’s object-oriented programming paradigm.

19. What is a constructor in Java?

In Java, an object’s constructor is a particular method used to create and initialize it. When an object is formed, it is immediately called and shares the same name as the class. Setting initial values for the object’s data members and carrying out any necessary setup must be done by the constructor. By allowing constructors to be overloaded, it makes sure that objects are correctly initialized before being used and offers a variety of ways to create objects with varied arguments.

20. What is overloading and overriding?

  • Overloading: The ability to define numerous methods with the same name but different parameters within a class is known as method overloading in Java. It enables flexibility in how methods are invoked by allowing a class to have numerous methods with the same name but different parameter lists. The quantity, nature, and arrangement of the arguments all affect method overloading. Based on the inputs supplied at the call site, the proper overloaded method to execute is determined during compilation.
  • Overriding: In Java, when a subclass provides its own implementation of a method that is already defined in its superclass, this process is referred to as method overriding. The name, return type, and parameter list of the method in the subclass must match those of the method in the superclass. A subclass can modify or add special behavior to the inherited method from the superclass by overriding the method. When a method that is overridden is called on a subclass instance, the subclass’s implementation of the method is used instead of the one that was inherited from the superclass.

Cognizant GenC SQL-Based Questions

21. What is the difference between INNER JOIN and OUTER JOIN?

INNER JOIN returns only the matched records from both tables based on the specified condition.

OUTER JOIN returns all the records from one table and the matched records from the other table(s), or NULL values if there is no match.

22. What is the difference between UNION and UNION ALL?

UNION combines the result sets of two or more SELECT statements, removing duplicates.

UNION ALL also combines result sets but includes all rows, including duplicates.

23. What is a primary key?

A primary key is a unique identifier for each row in a table. It ensures data integrity and serves as a reference for relationships with other tables.

24. What is a subquery?

A subquery is a query nested within another query. It can be used to retrieve data used for filters and calculations, or as a data source for another query.

25. What is the difference between a view and a table?

A table is a physical structure that stores data in a database.

A view is a virtual table derived from one or more tables or views that does not store data but presents a customized representation of the data.

26. Write a SQL query to filter records based on a condition.

SELECT * FROM table_name WHERE condition;

27. Write a SQL query to sort records in ascending or descending order.

SELECT * FROM table_name ORDER BY column_name ASC/DESC;

28. Write a SQL query to perform aggregation (e.g., calculate the sum, average, count) on a column.

SELECT aggregate_function(column_name) FROM table_name;

29. Write a SQL query to join two or more tables based on a common column.

SELECT * FROM table1 JOIN table2 ON table1.column = table2.column;

30. Write a SQL query to retrieve records based on multiple conditions using logical operators.

SELECT * FROM table_name WHERE condition1 AND/OR condition2;

Course Schedule

Name Date Details
Data Analytics Courses 12 Oct 2024(Sat-Sun) Weekend Batch
View Details
Data Analytics Courses 19 Oct 2024(Sat-Sun) Weekend Batch
View Details
Data Analytics Courses 26 Oct 2024(Sat-Sun) Weekend Batch
View Details

About the Author

Techical Research Analyst - Front End Development

As a Technical Research Analyst, Kislaya specializes in Front End Development. He is a Full Stack Developer, known for crafting scalable architectures and user-centric interfaces. He has a massive international client base and is an expert in cloud computing, Linux, and Java Script, personifying a commitment to quality and information sharing.