Add office photos
Cognizant logo
Engaged Employer

Cognizant

Verified
3.7
based on 50.6k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
Clear (1)

200+ Cognizant Programmer Analyst Trainee Interview Questions and Answers

Updated 10 Mar 2025

Q101. Wap to find Prime Number

Ans.

A prime number is a number that is only divisible by 1 and itself.

  • Start by checking if the number is less than 2, as prime numbers start from 2.

  • Iterate from 2 to the square root of the number and check if any number divides it evenly.

  • If no number divides it evenly, then it is a prime number.

Add your answer
right arrow

Q102. Difference between oop and pop.

Ans.

OOP is Object-Oriented Programming and POP is Procedural-Oriented Programming.

  • OOP focuses on objects and classes, promoting code reusability and modularity.

  • POP focuses on procedures and functions, with a linear flow of execution.

  • OOP allows for encapsulation, inheritance, and polymorphism.

  • POP is simpler and more straightforward, suitable for smaller programs.

  • Examples of OOP languages include Java, C++, and Python.

  • Examples of POP languages include C, Pascal, and Fortran.

View 1 answer
right arrow
Cognizant Programmer Analyst Trainee Interview Questions and Answers for Freshers
illustration image

Q103. What are different types of loops in c

Ans.

There are three types of loops in C: for, while, and do-while.

  • For loop is used when the number of iterations is known beforehand.

  • While loop is used when the number of iterations is not known beforehand.

  • Do-while loop is similar to while loop, but it executes the code block at least once before checking the condition.

Add your answer
right arrow

Q104. Difference between union and union all

Ans.

Union combines and removes duplicates, Union All combines all rows including duplicates.

  • Union is used to combine the result sets of two or more SELECT statements into a single result set.

  • Union removes duplicates from the result set.

  • Union All combines all rows from the result sets of two or more SELECT statements, including duplicates.

  • Union is slower than Union All as it has to remove duplicates.

  • Example: SELECT column1 FROM table1 UNION SELECT column1 FROM table2;

  • Example: SELE...read more

Add your answer
right arrow
Discover Cognizant interview dos and don'ts from real experiences

Q105. Insert node in Linked list at tail ?

Ans.

To insert a node at the tail of a linked list, traverse the list to the end and add the new node.

  • Traverse the linked list to the end

  • Create a new node with the given data

  • Set the next pointer of the last node to the new node

  • Set the new node's next pointer to NULL

Add your answer
right arrow

Q106. Can you reverse a string ?

Ans.

Yes, a string can be reversed by iterating through the characters and swapping them from start to end.

  • Iterate through the characters of the string from start to end

  • Swap the characters at the start and end positions until reaching the middle

  • Example: 'hello' can be reversed to 'olleh'

Add your answer
right arrow
Are these interview questions helpful?

Q107. 1 aptitude problem What are pointers Explain OOPS Concepts

Ans.

Pointers are variables that store memory addresses of other variables. OOPS concepts include inheritance, polymorphism, encapsulation, and abstraction.

  • Pointers are used to store memory addresses of variables.

  • They allow for dynamic memory allocation and deallocation.

  • Example: int *ptr; ptr = # // ptr now stores the memory address of num

Add your answer
right arrow

Q108. Have you heard of Blockchain?

Ans.

Yes, Blockchain is a decentralized digital ledger technology used for secure and transparent transactions.

  • Blockchain is a distributed database that stores information across a network of computers

  • It uses cryptography to secure and verify transactions

  • It is used in cryptocurrencies like Bitcoin and Ethereum

  • It has potential applications in various industries like finance, healthcare, and supply chain management

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q109. What is sql code

Ans.

SQL code is a programming language used to manage and manipulate relational databases.

  • SQL stands for Structured Query Language

  • SQL code is used to create, modify, and query databases

  • Examples of SQL code include SELECT, INSERT, UPDATE, and DELETE statements

Add your answer
right arrow

Q110. Write a code to explain method overriding.

Ans.

Method overriding is when a subclass provides a specific implementation of a method that is already provided by its parent class.

  • In method overriding, the method in the subclass has the same name, return type, and parameters as the method in the parent class.

  • The overridden method in the subclass should have the same or broader access modifier than the method in the parent class.

  • Example: class Animal { void sound() { System.out.println('Animal sound'); } } class Dog extends An...read more

Add your answer
right arrow

Q111. Write a code to find factorial of a number.

Ans.

Code to find factorial of a number

  • Use a loop to multiply numbers from 1 to the given number

  • Handle edge cases like 0 and negative numbers

  • Factorial of 0 is 1

Add your answer
right arrow

Q112. What is the data type of 0 and 1

Ans.

0 and 1 are integers and their data type is typically 'int' in programming languages.

  • Data type of 0 and 1 is 'int' in most programming languages like C, C++, Java, etc.

  • In some languages like Python, 0 and 1 are considered as 'bool' type for boolean values.

  • In SQL, 0 and 1 can be used as values for boolean data types like 'BIT'.

Add your answer
right arrow

Q113. What are constructors?

Ans.

Constructors are special methods used to initialize objects in a class.

  • Constructors have the same name as the class they belong to.

  • They are called automatically when an object is created.

  • Constructors can have parameters to initialize object properties.

  • They can be overloaded to have multiple versions with different parameters.

  • Constructors can also call other constructors using the 'this' keyword.

View 1 answer
right arrow

Q114. Write the code of Fibonacci series in c

Ans.

Fibonacci series is a sequence of numbers where each number is the sum of the two preceding ones.

  • Declare variables for first, second and next numbers

  • Initialize first and second numbers as 0 and 1 respectively

  • Use a loop to generate the next number by adding the previous two numbers

  • Print the generated numbers

Add your answer
right arrow

Q115. Code of square root of any number in c++

Ans.

Code for square root of any number in C++

  • Include the library

  • Use the sqrt() function to calculate the square root

  • Example: double result = sqrt(25);

  • Print the result using cout or printf

Add your answer
right arrow

Q116. Swap two number without using pointer?

Ans.

Swapping two numbers without using pointers

  • Use arithmetic operations to swap the values

  • Use XOR operator to swap the values

  • Use temporary variable to swap the values

Add your answer
right arrow

Q117. Difference between c and python

Ans.

C is a compiled language with low-level memory access while Python is an interpreted language with high-level data structures.

  • C is faster and more efficient for low-level programming

  • Python is easier to learn and has a simpler syntax

  • C requires manual memory management while Python has automatic garbage collection

  • Python has built-in support for high-level data structures like lists and dictionaries

  • C is commonly used for system programming and embedded systems while Python is us...read more

Add your answer
right arrow

Q118. Explain project with real world application.

Ans.

Developed a mobile app for tracking daily water intake to promote hydration.

  • Designed user-friendly interface for inputting water consumption

  • Implemented reminder notifications to encourage regular hydration

  • Utilized database to store user data for tracking and analysis

Add your answer
right arrow

Q119. What are the types of exception

Ans.

Types of exceptions include checked, unchecked, error, and runtime exceptions.

  • Checked exceptions are checked at compile time and must be handled by the programmer.

  • Unchecked exceptions are not checked at compile time and can be handled or left to propagate.

  • Errors are exceptional conditions that are not expected to be caught or handled by the programmer.

  • Runtime exceptions are unchecked exceptions that occur at runtime, often due to programming errors.

Add your answer
right arrow

Q120. say ABT PROJECT any software skills acquired

Ans.

I have acquired software skills in Java, SQL, and Python through various projects.

  • Proficient in Java programming language

  • Experience with SQL databases

  • Familiar with Python scripting

Add your answer
right arrow

Q121. Swap Two no. without using third variable.

Ans.

Swap two numbers without using a third variable

  • Use arithmetic operations to swap the numbers

  • Example: a = 5, b = 10. After swapping, a = 10, b = 5

Add your answer
right arrow

Q122. Remove duplicate words from a given string.

Ans.

Remove duplicate words from a given string.

  • Split the string into an array of words

  • Use a Set to store unique words

  • Join the Set back into a string

Add your answer
right arrow

Q123. Swapping 2 numbers without using a third variable

Ans.

Swapping 2 numbers without using a third variable can be done using arithmetic operations.

  • Use addition and subtraction to swap the numbers

  • Example: a = 5, b = 10. a = a + b (a = 15), b = a - b (b = 5), a = a - b (a = 10)

Add your answer
right arrow

Q124. Write a basic if-else condition code.

Ans.

If-else condition code example

  • Use if keyword followed by a condition in parentheses

  • Use curly braces to enclose the code to be executed if the condition is true

  • Use else keyword followed by curly braces to enclose the code to be executed if the condition is false

  • The else block is optional

  • Example: if(age > 18) { System.out.println('You are an adult'); } else { System.out.println('You are a minor'); }

Add your answer
right arrow

Q125. Basic Algorithms in day-to-day life used.

Ans.

Basic algorithms are used in everyday tasks like sorting, searching, and decision making.

  • Sorting items in a grocery list

  • Searching for a specific contact in a phonebook

  • Making decisions based on traffic patterns

  • Calculating the shortest route to a destination

  • Finding the highest or lowest value in a set of data

Add your answer
right arrow

Q126. Write a code for addition of numbers

Ans.

Code for addition of numbers using a simple function

  • Create a function that takes in two numbers as parameters

  • Add the two numbers together and return the result

  • Example: function addNumbers(num1, num2) { return num1 + num2; }

Add your answer
right arrow

Q127. doyou know anything related to coding

Ans.

Yes, I have experience in coding languages such as Java, Python, and SQL.

  • Proficient in Java for backend development

  • Familiar with Python for data analysis and scripting

  • Experience with SQL for database management

Add your answer
right arrow

Q128. Remove duplicates in Linked List

Ans.

Remove duplicates in a Linked List

  • Traverse the linked list and keep track of visited nodes

  • If a node is visited again, remove it from the list

  • Use a hash table to keep track of visited nodes for faster lookup

Add your answer
right arrow

Q129. Why we use capacitance

Ans.

Capacitance is used to store electrical energy in an electric field.

  • Capacitance is used in electronic circuits to filter out noise and stabilize voltage.

  • It is also used in touchscreens and trackpads to detect touch and movement.

  • Capacitors are used in power factor correction to improve the efficiency of electrical systems.

  • Capacitance is measured in farads, with smaller values measured in microfarads and picofarads.

Add your answer
right arrow

Q130. Explain whole project in detail

Ans.

The project is a web-based inventory management system for a retail company.

  • Developed using Java Spring framework for backend and Angular for frontend

  • Includes features such as product management, order processing, and reporting

  • Utilizes MySQL database for storing data

  • Implemented user authentication and authorization for security

  • Integrated with third-party payment gateway for online transactions

Add your answer
right arrow

Q131. What is meant by variable ?

Ans.

A variable is a named storage location in a program that can hold a value which can be changed during program execution.

  • Variables are used to store data in a program.

  • They have a name, a data type, and a value.

  • The value of a variable can be changed during program execution.

  • Variables can be used in calculations and to control program flow.

  • Examples of variables include integers, floating-point numbers, and strings.

Add your answer
right arrow

Q132. What is resistance?

Ans.

Resistance is the opposition to the flow of electric current.

  • Resistance is measured in ohms.

  • It is caused by the interaction between electrons and the atoms of a material.

  • Materials with high resistance are called insulators, while those with low resistance are called conductors.

  • Examples of conductors include metals like copper and aluminum, while examples of insulators include rubber and glass.

Add your answer
right arrow

Q133. Write down C program for email id validation.

Ans.

A C program to validate email IDs

  • Use regular expressions to check if the email ID follows the standard format

  • Check for the presence of '@' symbol and at least one '.' after it

  • Validate the characters before and after the '@' symbol

  • Consider the length restrictions for the email ID

Add your answer
right arrow

Q134. 5.Write any program in c language

Ans.

Program to print 'Hello, World!' in C language

  • Include stdio.h header file

  • Use printf() function to print the message

  • End the program with return 0 statement

Add your answer
right arrow

Q135. Software Development Life cycle

Ans.

Software Development Life Cycle (SDLC) is a process followed by software development teams to design, develop and test high-quality software.

  • SDLC consists of several phases including planning, analysis, design, development, testing, deployment, and maintenance.

  • Each phase has its own set of activities and deliverables that must be completed before moving on to the next phase.

  • SDLC models include Waterfall, Agile, and DevOps, each with its own strengths and weaknesses.

  • Effective ...read more

Add your answer
right arrow

Q136. Why is OOP needed ?

Ans.

OOP is needed for better organization, reusability, and maintainability of code.

  • Encapsulation: Bundling data and methods that operate on the data together.

  • Inheritance: Allowing classes to inherit attributes and methods from other classes.

  • Polymorphism: Using a single interface to represent different data types or objects.

  • Code reusability: Classes and objects can be reused in different parts of the program.

  • Modularity: Breaking down a complex problem into smaller, more manageabl...read more

Add your answer
right arrow

Q137. Write a program to swap to Numbers

Ans.

A program to swap two numbers

  • Declare two variables to store the numbers

  • Take input for both variables

  • Swap the values using a temporary variable

  • Print the swapped values

Add your answer
right arrow

Q138. Find Second Highest number in an Array

Ans.

Find the second highest number in an array of integers.

  • Sort the array in descending order and return the second element.

  • Iterate through the array and keep track of the highest and second highest numbers.

  • Use a priority queue to keep track of the highest and second highest numbers.

Add your answer
right arrow

Q139. Difference between array and union?

Ans.

Arrays are a collection of similar data types while unions are a collection of different data types sharing the same memory space.

  • Arrays are used to store a fixed number of elements of the same data type.

  • Unions are used to store different data types in the same memory location.

  • Arrays are accessed using an index while unions are accessed using the same memory location.

  • Arrays are used for homogeneous data while unions are used for heterogeneous data.

Add your answer
right arrow

Q140. Sort the array in increasing order.

Ans.

To sort an array in increasing order, we can use any sorting algorithm like bubble sort, insertion sort, or quicksort.

  • Choose a sorting algorithm based on the size of the array and the time complexity required.

  • Implement the chosen algorithm in the programming language of choice.

  • Test the sorting function with different input arrays to ensure correctness.

Add your answer
right arrow

Q141. SQL query to fetch count of records

Ans.

SQL query to fetch count of records

  • Use SELECT COUNT(*) FROM table_name

  • Replace table_name with the name of the table you want to count records from

Add your answer
right arrow

Q142. how http works in web tech

Ans.

HTTP is a protocol used for communication between web servers and clients.

  • HTTP stands for Hypertext Transfer Protocol.

  • It is used to transfer data over the internet.

  • HTTP requests are made by clients and responded by servers.

  • HTTP uses different methods like GET, POST, PUT, DELETE, etc.

  • HTTP headers are used to provide additional information about the request or response.

  • HTTP status codes are used to indicate the status of the request or response.

  • Example: When you type a URL in y...read more

Add your answer
right arrow

Q143. what is oops concept in java

Ans.

OOPs concept in Java refers to Object-Oriented Programming principles that allow for modular and reusable code.

  • Encapsulation: bundling data and methods that operate on that data within a single unit

  • Inheritance: creating new classes from existing ones, inheriting their properties and methods

  • Polymorphism: the ability of objects to take on multiple forms or behaviors

  • Abstraction: hiding implementation details and providing a simplified interface for users

  • Examples: creating classe...read more

Add your answer
right arrow

Q144. What are access specifiers?

Ans.

Access specifiers determine the level of access to class members.

  • There are three access specifiers in Java: public, private, and protected.

  • Public members can be accessed from anywhere.

  • Private members can only be accessed within the same class.

  • Protected members can be accessed within the same class and its subclasses.

  • Access specifiers help enforce encapsulation and prevent unauthorized access to class members.

Add your answer
right arrow

Q145. What is cloud computing

Ans.

Cloud computing is the delivery of computing services over the internet, including storage, databases, networking, software, and more.

  • Cloud computing allows users to access resources on-demand without the need for physical infrastructure.

  • Examples of cloud computing services include Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform.

  • It offers scalability, flexibility, and cost-effectiveness for businesses and individuals.

  • Data is stored and processed on remot...read more

Add your answer
right arrow

Q146. Why cloud computing is used

Ans.

Cloud computing is used for scalability, cost-effectiveness, flexibility, and accessibility of resources.

  • Scalability: Easily scale resources up or down based on demand.

  • Cost-effectiveness: Pay only for the resources you use, reducing upfront costs.

  • Flexibility: Access resources from anywhere with an internet connection.

  • Accessibility: Allows for collaboration and sharing of resources across different locations.

  • Examples: Amazon Web Services (AWS), Microsoft Azure, Google Cloud Pl...read more

Add your answer
right arrow

Q147. Write a program to find palindrome

Ans.

Program to check if a given string is a palindrome or not.

  • Convert the string to lowercase to ignore case sensitivity.

  • Use two pointers, one at the beginning and one at the end of the string.

  • Compare the characters at both pointers and move them towards each other until they meet.

  • If all characters match, the string is a palindrome.

Add your answer
right arrow

Q148. Reverse a string provided a input

Ans.

Reverse a string provided as input

  • Use a loop to iterate through the characters of the input string

  • Append each character to a new string in reverse order

  • Return the reversed string as the output

Add your answer
right arrow

Q149. Find 2nd largest number in the array.

Ans.

To find the 2nd largest number in an array, we can sort the array in descending order and return the second element.

  • Sort the array in descending order using any sorting algorithm.

  • Return the second element of the sorted array as it will be the 2nd largest number.

  • If the array has less than 2 elements, return an error message.

Add your answer
right arrow

Q150. What is dotnet framework?

Ans.

Dotnet framework is a software framework developed by Microsoft for building and running applications on Windows.

  • Developed by Microsoft

  • Used for building and running applications on Windows

  • Supports multiple programming languages like C#, VB.NET, F#

  • Provides a large class library known as Framework Class Library (FCL)

  • Includes runtime environment called Common Language Runtime (CLR)

Add your answer
right arrow

Q151. What is an array?

Ans.

An array is a collection of similar data types stored in contiguous memory locations.

  • Arrays can be of any data type, including integers, floats, and characters.

  • Arrays can be one-dimensional, two-dimensional, or multi-dimensional.

  • Arrays are accessed using an index, starting from 0.

  • Example: string[] names = {"John", "Jane", "Bob"};

  • Example: int[] numbers = {1, 2, 3, 4, 5};

Add your answer
right arrow

Q152. What is SDLC means?

Ans.

SDLC stands for Software Development Life Cycle.

  • It is a process used by software development teams to design, develop, and test high-quality software.

  • It consists of several phases including planning, analysis, design, implementation, testing, and maintenance.

  • Each phase has its own set of deliverables and goals that must be met before moving on to the next phase.

  • It helps ensure that software is developed on time, within budget, and meets the requirements of the stakeholders.

  • Ex...read more

Add your answer
right arrow

Q153. What are joins?

Ans.

Joins are used in databases to combine rows from two or more tables based on a related column between them.

  • Joins are used to retrieve data from multiple tables based on a related column between them.

  • Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

  • INNER JOIN returns rows when there is at least one match in both tables.

  • LEFT JOIN returns all rows from the left table and the matched rows from the right table.

  • RIGHT JOIN returns all rows from the righ...read more

Add your answer
right arrow

Q154. write the palindrome code in compiler

Ans.

Palindrome code checks if a word is same when read forwards and backwards.

  • Create a function that takes a string as input

  • Use a loop to iterate through the string and compare the characters at opposite ends

  • If all characters match, return true, else return false

Add your answer
right arrow

Q155. What is OOPS concepts

Ans.

OOPS concepts refer to Object-Oriented Programming principles such as inheritance, encapsulation, polymorphism, and abstraction.

  • Inheritance: Allows a class to inherit properties and behavior from another class.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit.

  • Polymorphism: Ability to present the same interface for different data types.

  • Abstraction: Hiding the complex implementation details and showing only the necessary features.

Add your answer
right arrow

Q156. Explain what is oops?

Ans.

Object-oriented programming paradigm that focuses on objects and classes for code organization and reusability.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit (object)

  • Inheritance: Ability for a class to inherit properties and behavior from another class

  • Polymorphism: Ability for objects of different classes to respond to the same message or method call

  • Abstraction: Hiding complex implementation details and showing only the necessary features...read more

Add your answer
right arrow

Q157. what are oops pillars

Ans.

OOPs pillars refer to the four main concepts of Object-Oriented Programming: Inheritance, Encapsulation, Abstraction, and Polymorphism.

  • Inheritance: Allows a class to inherit properties and behavior from another class.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit.

  • Abstraction: Hiding the complex implementation details and showing only the necessary features of an object.

  • Polymorphism: Allows objects of different classes to be treated as obj...read more

Add your answer
right arrow

Q158. Why software?

Ans.

Software is the backbone of modern society, and I want to be a part of shaping its future.

  • Software has the power to solve complex problems and improve efficiency.

  • It allows for innovation and creativity in various industries.

  • Software is constantly evolving, providing endless opportunities for learning and growth.

  • Examples: healthcare software improving patient outcomes, financial software streamlining transactions.

Add your answer
right arrow

Q159. Explain oops concepts with code snippet

Ans.

OOPs concepts are fundamental principles in object-oriented programming that help in organizing and designing code.

  • Encapsulation: bundling data and methods that operate on the data into a single unit (class). Example: class Car { private String color; public void drive() { ... } }

  • Inheritance: allows a class to inherit properties and behavior from another class. Example: class SUV extends Car { ... }

  • Polymorphism: ability of objects to take on multiple forms. Example: class Ani...read more

Add your answer
right arrow

Q160. what languages you know

Ans.

I know several programming languages including Java, Python, and C++.

  • Proficient in Java, Python, and C++

  • Familiar with HTML, CSS, and JavaScript

  • Experience with SQL and database management

  • Comfortable with object-oriented programming and software development principles

Add your answer
right arrow

Q161. Sorting array using any alogrithm

Ans.

Sorting an array involves arranging its elements in a specific order.

  • Choose an appropriate sorting algorithm based on the size and type of data in the array.

  • Common sorting algorithms include bubble sort, insertion sort, selection sort, merge sort, and quicksort.

  • Implement the chosen algorithm in code and apply it to the array.

  • Verify that the array is sorted correctly by checking the order of its elements.

Add your answer
right arrow

Q162. What is oops?

Ans.

OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.

  • OOPs is a way of organizing and designing code around objects

  • It emphasizes encapsulation, inheritance, and polymorphism

  • Examples of OOPs languages include Java, C++, and Python

Add your answer
right arrow

Q163. What is inheritance?

Ans.

Inheritance is a concept in object-oriented programming where a class inherits attributes and methods from another class.

  • Allows a class to inherit attributes and methods from another class

  • Promotes code reusability and reduces redundancy

  • Creates a parent-child relationship between classes

  • Derived class can access public and protected members of the base class

  • Example: Class 'Car' can inherit attributes and methods from class 'Vehicle'

Add your answer
right arrow

Q164. Tell about oops concepts

Ans.

OOPs concepts are the fundamental principles of object-oriented programming.

  • Encapsulation - binding data and functions that manipulate the data

  • Inheritance - creating new classes from existing ones

  • Polymorphism - ability of objects to take on many forms

  • Abstraction - hiding implementation details from the user

  • Example: A car is an object that encapsulates data such as speed and functions like accelerate and brake

  • Example: Inheritance allows a sports car class to inherit properties...read more

Add your answer
right arrow

Q165. Error detection in program.

Ans.

Error detection in program involves identifying and fixing mistakes in the code.

  • Use debugging tools to identify errors

  • Check for syntax errors, logical errors, and runtime errors

  • Test the program thoroughly to ensure all errors are fixed

Add your answer
right arrow

Q166. How to use bubble sort

Ans.

Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.

  • Start from the first element and compare it with the next element

  • If the first element is greater than the next element, swap them

  • Repeat this process for all elements in the list until no more swaps are needed

  • The largest element will be at the end of the list after the first iteration

  • Repeat the above steps for the remaining ...read more

Add your answer
right arrow

Q167. Any idea about database?

Ans.

Yes, I have knowledge about databases.

  • I am familiar with SQL and NoSQL databases.

  • I have experience in designing and implementing databases.

  • I am proficient in writing complex queries and optimizing database performance.

  • I have worked with databases such as MySQL, Oracle, MongoDB, and PostgreSQL.

Add your answer
right arrow

Q168. What is C Language

Ans.

C is a high-level programming language used for system programming, embedded systems, and game development.

  • C was developed by Dennis Ritchie at Bell Labs in 1972.

  • It is a compiled language that allows for low-level memory manipulation.

  • C is used for operating systems, device drivers, and firmware.

  • Examples of C-based software include the Linux kernel, MySQL, and Adobe Photoshop.

  • C is known for its efficiency and speed, making it a popular choice for game development.

  • C++ is an ext...read more

Add your answer
right arrow

Q169. What are arrays ?

Ans.

Arrays are a collection of elements of the same data type stored in contiguous memory locations.

  • Arrays have a fixed size determined at the time of declaration.

  • Elements in an array can be accessed using their index position.

  • Example: string[] names = {"Alice", "Bob", "Charlie"};

Add your answer
right arrow

Q170. string vs stringbuffer vs stringbuilder

Ans.

String is immutable, StringBuffer is synchronized and mutable, StringBuilder is not synchronized and mutable.

  • String is immutable, meaning its value cannot be changed once it is created.

  • StringBuffer is synchronized, making it thread-safe but slower than StringBuilder.

  • StringBuilder is not synchronized, making it faster than StringBuffer but not thread-safe.

Add your answer
right arrow

Q171. Write 2d matrix array code

Ans.

2D matrix array code

  • Declare a 2D array with desired number of rows and columns

  • Initialize the array with values

  • Access elements using row and column indices

Add your answer
right arrow

Q172. What are data types?

Ans.

Data types define the kind of data a variable can hold, influencing operations and memory usage.

  • Primitive data types include integers, floats, and characters. Example: int age = 25;

  • Composite data types include arrays and structures. Example: int numbers[] = {1, 2, 3};

  • Data types help in memory allocation and type checking during compilation.

  • Different programming languages have different data types. Example: Python has lists, while C has arrays.

Add your answer
right arrow

Q173. Concept of OOP

Ans.

OOP is a programming paradigm that uses objects to represent and manipulate data.

  • OOP stands for Object-Oriented Programming.

  • It focuses on creating objects that have properties and methods.

  • Encapsulation, inheritance, and polymorphism are key concepts in OOP.

  • Examples of OOP languages include Java, C++, and Python.

Add your answer
right arrow

Q174. Explain four pillars of OOPs

Ans.

The four pillars of OOPs are Inheritance, Encapsulation, Abstraction, and Polymorphism.

  • Inheritance: Allows a class to inherit properties and behavior from another class.

  • Encapsulation: Bundles data and methods into a single unit, protecting data from outside interference.

  • Abstraction: Hides complex implementation details and only shows the necessary features to the user.

  • Polymorphism: Allows objects of different classes to be treated as objects of a common superclass.

Add your answer
right arrow

Q175. Wirte a program of sorting

Ans.

Program to sort an array of strings

  • Use a sorting algorithm like bubble sort, insertion sort, or quicksort

  • Compare adjacent elements and swap them if they are in the wrong order

  • Repeat until the array is sorted

  • Example: bubble sort - for i in range(len(arr)): for j in range(len(arr)-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j]

Add your answer
right arrow

Q176. Difference between c and c++

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has built-in support for polymorphism and inheritance.

  • C++ has a standard template library (STL) while C does not.

  • C++ is more complex and has more features than C.

  • C++ code can be compiled with a C compiler, but not vice versa.

Add your answer
right arrow

Q177. Reffer all Categories

Ans.

Referring all categories means listing all the available categories.

  • List all available categories

  • Include subcategories if applicable

  • Provide brief description of each category

Add your answer
right arrow

Q178. Normalization in DBMS

Ans.

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization helps in minimizing data redundancy by breaking down large tables into smaller ones.

  • It ensures data integrity by reducing the chances of anomalies like insertion, update, and deletion anomalies.

  • There are different normal forms like 1NF, 2NF, 3NF, BCNF, and 4NF, each with specific rules to follow.

  • For example, in 1NF, each column should contain atomic valu...read more

Add your answer
right arrow

Q179. Binarysearch to find anumber

Ans.

Binary search is a method to find a specific number in a sorted array by repeatedly dividing the search interval in half.

  • Divide the array into two halves and compare the middle element with the target number.

  • If the middle element is equal to the target, return its index.

  • If the middle element is greater than the target, search the left half of the array.

  • If the middle element is less than the target, search the right half of the array.

Add your answer
right arrow

Q180. Any relocation restrictions

Ans.

No relocation restrictions

  • I am open to relocating for the right opportunity

  • I have no restrictions on where I can work

  • I am willing to move for the job if required

Add your answer
right arrow

Q181. Fibonacci series generate

Ans.

Fibonacci series is a sequence of numbers where each number is the sum of the two preceding ones.

  • The first two numbers of the series are always 0 and 1.

  • The next number is the sum of the previous two numbers.

  • The series goes on infinitely, unless a specific number of terms is specified.

  • Example: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 352...read more

Add your answer
right arrow

Q182. Write Fibonacci program

Ans.

A Fibonacci program generates a series of numbers where each number is the sum of the two preceding ones.

  • Use a loop or recursion to generate the Fibonacci series

  • Start with two initial numbers, 0 and 1

  • Add the previous two numbers to get the next number in the series

  • Repeat until the desired number of terms is reached

Add your answer
right arrow

Q183. Program to Array sort

Ans.

Program to sort an array of strings

  • Use a sorting algorithm like bubble sort, selection sort, or merge sort

  • Compare strings using a comparison function

  • Implement the sorting algorithm in a loop until the array is sorted

Add your answer
right arrow

Q184. Explain AD domain server.

Ans.

AD domain server is a server that manages user accounts and permissions within a Windows Active Directory domain.

  • AD domain server stores user account information such as usernames, passwords, and group memberships.

  • It authenticates and authorizes users to access resources within the domain.

  • It allows for centralized management of network resources and security policies.

  • Examples: Windows Server, Active Directory Domain Services (AD DS)

Add your answer
right arrow

Q185. code for Pattern matching

Ans.

Pattern matching is the process of finding specific patterns within a larger set of data.

  • Regular expressions are commonly used for pattern matching.

  • Pattern matching can be used in programming languages to match specific syntax or structures.

  • Pattern matching can also be used in data analysis to find trends or anomalies.

  • Examples of pattern matching include searching for specific words in a document or finding a specific sequence of numbers in a dataset.

Add your answer
right arrow

Q186. write a program in java

Ans.

Program to print 'Hello, World!' in Java

  • Create a class with a main method

  • Use System.out.println() to print the message

Add your answer
right arrow

Q187. Explains oops in java

Ans.

Object-oriented programming in Java focuses on creating classes and objects to organize and structure code.

  • Java supports the four main principles of OOP: encapsulation, inheritance, polymorphism, and abstraction.

  • Classes are used to define the blueprint for objects, which are instances of classes.

  • Inheritance allows a class to inherit properties and behavior from another class.

  • Polymorphism enables objects to be treated as instances of their parent class or as instances of their...read more

Add your answer
right arrow

Q188. Write program for prime Number

Ans.

Program to check if a number is prime or not

  • Create a function to check if a number is prime by iterating from 2 to the square root of the number

  • If the number is divisible by any number in that range, it is not prime

  • Handle edge cases like 0, 1, and negative numbers

Add your answer
right arrow

Q189. SQL Joins and its types

Ans.

SQL Joins are used to combine rows from two or more tables based on a related column between them.

  • Types of SQL Joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

  • INNER JOIN returns rows when there is at least one match in both tables.

  • LEFT JOIN returns all rows from the left table and the matched rows from the right table.

  • RIGHT JOIN returns all rows from the right table and the matched rows from the left table.

  • FULL JOIN returns rows when there is a match in one of ...read more

Add your answer
right arrow

Q190. Explain the B.E major projects

Ans.

B.E major projects are final year projects done by engineering students to showcase their skills and knowledge.

  • B.E major projects are usually done in the final year of engineering courses

  • These projects are meant to showcase the skills and knowledge acquired by the students during their course

  • The projects can be individual or group-based, depending on the requirements of the course

  • Examples of B.E major projects include developing a software application, designing a hardware sy...read more

Add your answer
right arrow

Q191. SQL command and it's uses

Ans.

SQL commands are used to interact with databases and perform various operations like selecting, inserting, updating, and deleting data.

  • SELECT: retrieves data from one or more tables

  • INSERT: adds new data to a table

  • UPDATE: modifies existing data in a table

  • DELETE: removes data from a table

  • CREATE: creates a new table or database

  • ALTER: modifies the structure of a table

  • DROP: deletes a table or database

  • JOIN: combines data from multiple tables based on a common column

  • GROUP BY: groups...read more

Add your answer
right arrow

Q192. Explain DBMS along with CRUD

Ans.

DBMS is a software system that manages databases, while CRUD stands for Create, Read, Update, Delete operations in databases.

  • DBMS (Database Management System) is a software system that allows users to interact with databases.

  • CRUD stands for Create, Read, Update, Delete - the four basic functions of persistent storage.

  • Examples: Creating a new record in a database (Create), Reading data from a database (Read), Updating existing data in a database (Update), Deleting data from a ...read more

Add your answer
right arrow

Q193. Common screening of relocation

Ans.

Common screening questions for potential relocation for Programmer Analyst Trainee positions.

  • Be prepared to discuss your willingness to relocate for the job

  • Highlight any previous experiences or reasons why you are open to relocating

  • Research the location of the job and show interest in the potential move

  • Discuss any concerns or limitations you may have regarding relocation

Add your answer
right arrow

Q194. Greedy Algorithm?

Ans.

A greedy algorithm builds a solution piece by piece, always choosing the next piece that offers the most immediate benefit.

  • Greedy algorithms make locally optimal choices at each step.

  • They do not consider the global context, which can lead to suboptimal solutions.

  • Common examples include the Coin Change Problem and the Activity Selection Problem.

  • In the Coin Change Problem, the greedy approach selects the largest denomination first.

  • In the Activity Selection Problem, it selects t...read more

Add your answer
right arrow

Q195. Swapping two numbers

Ans.

Swapping two numbers is a basic programming task that involves exchanging the values of two variables.

  • Create a temporary variable to store the value of one of the variables

  • Assign the value of the first variable to the second variable

  • Assign the value of the temporary variable to the first variable

Add your answer
right arrow

Q196. sum of two number

Ans.

The sum of two numbers is calculated by adding them together.

  • To find the sum of two numbers, simply add them together.

  • For example, the sum of 5 and 3 is 8 (5 + 3 = 8).

Add your answer
right arrow

Q197. Oops and its types

Ans.

Oops stands for Object-Oriented Programming System. Types include syntax errors, logical errors, and runtime errors.

  • Syntax errors are mistakes in the code that prevent it from running, such as missing semicolons or parentheses.

  • Logical errors occur when the code runs but produces incorrect results, such as using the wrong formula in a calculation.

  • Runtime errors happen during the execution of the program, such as dividing by zero or accessing a null object.

Add your answer
right arrow

Q198. Write code to print

Ans.

Code to print array of strings

  • Use a loop to iterate through the array of strings

  • Print each string in the array using a print statement

Add your answer
right arrow

Q199. Joins with example

Ans.

Joins are used to combine data from two or more tables based on a related column.

  • Joins are used in SQL to retrieve data from multiple tables.

  • Common types of joins include inner join, left join, right join, and full outer join.

  • Inner join returns only the matching rows from both tables, while left join returns all rows from the left table and matching rows from the right table.

  • Right join is the opposite of left join, and full outer join returns all rows from both tables.

  • Example...read more

Add your answer
right arrow

Q200. languages you known

Ans.

I am proficient in Java, Python, and SQL.

  • Java

  • Python

  • SQL

Add your answer
right arrow
Previous
1
2

More about working at Cognizant

Back
Awards Leaf
AmbitionBox Logo
Top Rated Mega Company - 2024
Awards Leaf
Awards Leaf
AmbitionBox Logo
Top Rated IT/ITES Company - 2024
Awards Leaf
HQ - Teaneck. New Jersey., United States (USA)
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Cognizant Programmer Analyst Trainee

based on 239 interviews
6 Interview rounds
Aptitude Test Round - 1
Aptitude Test Round - 2
Technical Round
HR Round - 1
HR Round - 2
Personal Interview1 Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter