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
Trainee Programmer
Fresher
Clear (1)

20+ Cognizant Trainee Programmer Interview Questions and Answers

Updated 18 Nov 2024

Q1. Networking Questions like What is IP ADDRESS WHAT IS MAC ADDRESS WHAT IS BSOD WHAT IS ACTIVE DIRECTORY WHAT IS NODE WHAT IS LAN WAN MAN WHAT IS SQL WHAT ARE SUBGROUPS OF SQL WHAT IS DML ,DDL TCL DCL? WHAT IS DB...

read more
Ans.

Answers to common networking and database related questions for a Trainee Programmer interview.

  • IP ADDRESS - unique identifier for devices on a network

  • MAC ADDRESS - unique identifier for network interface controllers

  • BSOD - Blue Screen of Death, an error screen displayed on Windows systems

  • ACTIVE DIRECTORY - centralized database for managing network resources

  • NODE - a device or computer on a network

  • LAN WAN MAN - types of networks (Local Area Network, Wide Area Network, Metropolit...read more

Add your answer
right arrow

Q2. what is polymorphism in Object-Oriented Programming?

Ans.

Polymorphism is the ability of an object to take on many forms.

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

  • It enables methods to be defined in the superclass and overridden in the subclasses.

  • Polymorphism helps in achieving code reusability and flexibility in object-oriented programming.

  • Example: A superclass 'Animal' with subclasses 'Dog' and 'Cat'. Both 'Dog' and 'Cat' can be treated as 'Animal'.

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

Q3. Rate yourself in 5 different programming languages on a 1-10 scale, 10 being the best.

Ans.

I rate myself differently in different languages based on my experience and proficiency.

  • Java - 8: I have worked on multiple projects using Java and have a good understanding of its concepts.

  • Python - 7: I have used Python for scripting and automation tasks and have a decent understanding of its libraries.

  • C++ - 6: I have basic knowledge of C++ and have implemented some algorithms using it.

  • JavaScript - 8: I have worked on web development projects using JavaScript and its framewo...read more

View 1 answer
right arrow

Q4. Write a program using any language of your choice (It was a palindrome-based program.)

Ans.

A program to check if a given string is a palindrome or not.

  • Take input string from user

  • Reverse the string

  • Compare the reversed string with the original string

  • If both are same, then the string is a palindrome

  • Else, the string is not a palindrome

View 1 answer
right arrow
Discover Cognizant interview dos and don'ts from real experiences

Q5. write a C program to find maximum and minimum of given 3 numbers

Ans.

Program to find maximum and minimum of 3 numbers in C

  • Use if-else statements to compare the numbers

  • Initialize variables to store maximum and minimum values

  • Consider using arrays to store the numbers for easier comparison

Add your answer
right arrow

Q6. What is database management system ?

Ans.

A database management system is a software that manages and organizes data in a database.

  • DBMS is used to create, modify, and delete data in a database.

  • It provides a way to store and retrieve data efficiently.

  • Examples of DBMS include MySQL, Oracle, and Microsoft SQL Server.

Add your answer
right arrow
Are these interview questions helpful?

Q7. What is encapsulation?

Ans.

Encapsulation is the process of hiding implementation details and restricting access to an object's properties and methods.

  • Encapsulation helps in achieving data abstraction and information hiding.

  • It prevents unauthorized access to an object's internal state.

  • It allows for better control over the object's behavior.

  • Example: A bank account class with private variables for balance and account number.

  • Example: A car class with private variables for speed and engine temperature.

View 1 answer
right arrow

Q8. What is API?

Ans.

API stands for Application Programming Interface. It is a set of protocols, routines, and tools for building software applications.

  • API allows different software applications to communicate with each other

  • It defines how software components should interact

  • APIs can be public or private

  • Examples of APIs include Google Maps API, Twitter API, and Facebook API

View 2 more answers
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Why C is called middle level language?

Ans.

C is called middle level language because it combines features of both high-level and low-level languages.

  • C allows low-level manipulation like memory management and bit manipulation.

  • C also supports high-level features like functions, data structures, and dynamic memory allocation.

  • C is closer to the hardware compared to high-level languages like Java or Python, but not as close as low-level languages like assembly.

  • C provides a good balance between performance and flexibility.

Add your answer
right arrow

Q10. Write a program to print a matrix of 3 by 3.

Ans.

Program to print a 3x3 matrix using nested loops.

  • Use nested loops to iterate through rows and columns of the matrix.

  • Initialize a 2D array with 3 rows and 3 columns to store the matrix elements.

  • Print the elements of the matrix using nested loops.

Add your answer
right arrow

Q11. difference between while loop and for loop

Ans.

While loop is used when the number of iterations is not known beforehand, while for loop is used when the number of iterations is known.

  • While loop checks the condition before executing the block of code, while for loop initializes, checks condition, and increments/decrements in one line.

  • For loop is used when the number of iterations is known, while loop is used when the number of iterations is not known.

  • Example: while loop - while(i < 5) { //code } for loop - for(int i=0; i<5...read more

Add your answer
right arrow

Q12. tell me about functions in c

Ans.

Functions in C are blocks of code that perform a specific task and can be called multiple times within a program.

  • Functions in C are defined using a return type, function name, parameters, and a body enclosed in curly braces.

  • Functions can be called multiple times within a program to perform the same task without rewriting the code.

  • Functions can return a value using the 'return' statement.

  • Functions can also be void, meaning they do not return a value.

  • Example: int add(int a, int...read more

Add your answer
right arrow

Q13. what is a string in C.

Ans.

A string in C is a sequence of characters stored as an array of characters terminated by a null character.

  • Strings in C are actually arrays of characters.

  • Strings are terminated by a null character '\0'.

  • Strings can be initialized using double quotes, e.g. char str[] = "Hello".

Add your answer
right arrow

Q14. tell me the tech stack used

Ans.

Our tech stack includes Java, Spring Boot, React, and MySQL.

  • Java

  • Spring Boot

  • React

  • MySQL

Add your answer
right arrow

Q15. what is a primary key

Ans.

A primary key is a unique identifier for each record in a database table.

  • Uniquely identifies each record in a table

  • Cannot contain null values

  • Can consist of one or multiple columns

  • Used to establish relationships between tables

Add your answer
right arrow

Q16. Preferable Programing Languages.

Ans.

Preferable programming languages depend on the project requirements and team expertise.

  • Consider the project requirements and choose a language that best fits them.

  • Consider the team's expertise and choose a language that they are comfortable with.

  • Popular languages include Java, Python, C++, JavaScript, and Ruby.

  • For web development, JavaScript and its frameworks like React and Angular are popular.

  • For data science, Python and R are popular.

  • For mobile app development, Java and Sw...read more

Add your answer
right arrow

Q17. What is pointer What is inheritance?

Ans.

A pointer is a variable that stores the memory address of another variable. Inheritance is a mechanism in object-oriented programming where a new class inherits properties and behaviors from an existing class.

  • Pointer is used to store memory address of a variable

  • Pointer can be dereferenced to access the value stored at that memory address

  • Example: int *ptr; ptr = # *ptr = 10; // num now has value 10

  • Inheritance allows a new class to inherit properties and behaviors from an exist...read more

Add your answer
right arrow

Q18. difference between break and continue.

Ans.

Break is used to exit a loop, while continue is used to skip the current iteration and move to the next one.

  • Break is used to terminate the loop and exit it completely.

  • Continue is used to skip the current iteration and move to the next one.

  • Example: for(int i=0; i<5; i++) { if(i==3) { break; } System.out.println(i); } // Output: 0 1 2

  • Example: for(int i=0; i<5; i++) { if(i==3) { continue; } System.out.println(i); } // Output: 0 1 2 4

Add your answer
right arrow

Q19. Any programming language Data types

Ans.

Programming languages have various data types such as integers, floats, strings, and booleans.

  • Data types define the type of data that can be stored in a variable.

  • Common data types include integers, floats, strings, and booleans.

  • Some programming languages also have more complex data types like arrays, structures, and classes.

  • Data types can affect the performance and memory usage of a program.

  • Examples of data types in different programming languages: int in C++, float in Python...read more

Add your answer
right arrow

Q20. Create table syntax in DBMS

Ans.

Creating a table in a DBMS

  • Use CREATE TABLE statement

  • Specify table name and column names with data types

  • Add constraints like primary key, foreign key, etc.

  • Example: CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(50), age INT)

  • Execute the statement to create the table

Add your answer
right arrow

Q21. What is algorithm

Ans.

An algorithm is a step-by-step procedure for solving a problem or accomplishing a task.

  • An algorithm is a set of instructions that are followed to solve a problem.

  • It is a sequence of well-defined steps that can be executed in a specific order.

  • Algorithms can be represented using flowcharts, pseudocode, or programming languages.

  • Examples of algorithms include sorting algorithms like bubble sort and searching algorithms like binary search.

Add your answer
right arrow

Q22. Java is fully oops concept?

Ans.

Java is a fully object-oriented programming language.

  • Java supports all four pillars of OOP: encapsulation, inheritance, polymorphism, and abstraction.

  • Classes and objects are fundamental concepts in Java.

  • Java allows for the creation of user-defined classes and objects.

  • Inheritance enables code reusability in Java.

  • Polymorphism allows objects to be treated as instances of their parent class.

  • Abstraction allows for hiding implementation details and showing only necessary features t...read more

Add your answer
right arrow

Q23. explain the concepts of oops

Ans.

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

  • OOPs focuses on creating objects that contain data and methods to manipulate that data.

  • Encapsulation is the concept of bundling data and methods that operate on the data within a single unit, called an object.

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

  • Polymorphism allows objects to be treated as instances of their parent class, enabli...read more

Add your answer
right arrow

Q24. write code for string reverse

Ans.

Code to reverse a string using array of characters

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

  • Swap characters at the two pointers and move them towards the center until they meet

  • Example: Input 'hello' -> Output 'olleh'

Add your answer
right arrow

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 Trainee Programmer

based on 16 interviews
4 Interview rounds
Resume Shortlist Round
Aptitude Test Round
HR Round - 1
HR Round - 2
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Recently Viewed
INTERVIEWS
Eternus Solutions
No Interviews
INTERVIEWS
CitiusTech
20 top interview questions
REVIEWS
Tech Mahindra
No Reviews
INTERVIEWS
Tech Mahindra
No Interviews
SALARIES
Tech Mahindra
INTERVIEWS
Mystifly Consulting
No Interviews
INTERVIEWS
Cognizant
No Interviews
JOBS
Tech Mahindra
No Jobs
JOBS
Happiest Minds Technologies
No Jobs
INTERVIEWS
Black & White Business Solutions
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
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