Programmer Analyst Trainee
200+ Programmer Analyst Trainee Interview Questions and Answers

Asked in Cognizant

Q. Correct the syntax and logical errors in the given C code to achieve the desired output.
Fix syntax and logical errors in maxReplace function
Change 'o' to '0' in second for loop
Replace sum with inputList[i] in second for loop
Add a condition to check if inputList[i] is greater than sum in second for loop
Print sum instead of inputList[i] in third for loop

Asked in Cognizant

Q. If you promised a customer a product by a specific date, but your company cannot deliver on time, how would you convince the customer?
I would apologize for the delay and offer a solution or compensation.
Acknowledge the inconvenience caused to the customer
Explain the reason for the delay and assure them that steps are being taken to resolve it
Offer a solution or compensation to make up for the delay
Maintain open communication with the customer throughout the process
Programmer Analyst Trainee Interview Questions and Answers for Freshers

Asked in Amazon

Q. Alien Dictionary Problem Statement
You are provided with a sorted dictionary (by lexical order) in an alien language. Your task is to determine the character order of the alien language from this dictionary. Th...read more
Given a sorted alien dictionary in an array of strings, determine the character order of the alien language.
Iterate through the words in the dictionary to build a graph of character dependencies.
Perform a topological sort on the graph to determine the character order.
Return the character array representing the order of characters in the alien language.

Asked in Cognizant

Q. What are OOP characteristics? Difference between abstraction and encapsulation? What are types of polymorphism ?4 to 5 Question on projects which I have mentioned in cv. Write a program to find the prime factor...
read moreAnswering questions related to OOP characteristics, polymorphism, and programming projects.
OOP characteristics include inheritance, encapsulation, abstraction, and polymorphism.
Abstraction is the process of hiding implementation details while encapsulation is the process of hiding data.
Types of polymorphism include compile-time and runtime polymorphism.
Projects mentioned in CV were discussed and explained.
A program to find prime factors of a number can be written using a loop...read more

Asked in Cognizant

Q. Why is Java platform independent?
Java is platform independent due to its bytecode and JVM.
Java code is compiled into bytecode which is platform-independent.
JVM (Java Virtual Machine) interprets the bytecode and executes it on any platform.
This eliminates the need for recompilation of code for different platforms.
For example, a Java program compiled on Windows can run on Linux or Mac without any changes.
This makes Java highly portable and flexible.

Asked in Cognizant

Q. Which programming language are you familiar with? what are the datasets in python what is the difference between list and tuple in python? write a program to find number of white spaces in a given string? what...
read moreAnswering questions related to programming language Python.
I am familiar with Python programming language.
Datasets in Python include NumPy, Pandas, and SciPy.
List is mutable while Tuple is immutable in Python.
Program to find number of white spaces in a given string: def count_spaces(string): return string.count(' ')
While loop executes a block of code as long as the condition is true, for loop executes a block of code for a specific number of times.

Asked in Cognizant

Q. You have a 1 kg cake and three chances to cut it. How would you divide the cake equally among eight people?
Divide 1 kg cake equally among 8 people in 3 cuts.
Cut the cake into 8 equal pieces using 2 cuts.
Stack the pieces and cut them in half using the third cut.
Distribute the 16 pieces among 8 people.

Asked in IBM

Q. Star Pattern Problem Statement
Display the star pattern for a given positive integer N.
Example:
Input:
N = 4
Output:
*
***
*****
*******
Explanation:
The dots in the image represent spaces. Align the stars in...read more
Display a pyramid star pattern for a given positive integer N with spaces in between.
Iterate from 1 to N to print each row
For each row, print N-i spaces followed by 2*i-1 stars
Use nested loops to handle spaces and stars accordingly
Share interview questions and help millions of jobseekers 🌟

Asked in Cognizant

Q. What is the difference between a method and a function in a programming language?
Method and Function are both blocks of code that perform a specific task, but the main difference is that a method is associated with an object while a function is not.
A method is called on an object, while a function is called independently.
A method can modify the state of an object, while a function cannot.
A method is defined within a class, while a function is defined outside of a class.
Example of a method: object.methodName()
Example of a function: functionName()

Asked in Cognizant

Q. What are argc and argv parameters in the main() function, and what types of programs use them?
argc and argv are used in C/C++ to handle command-line arguments in the main function.
argc (argument count) is an integer representing the number of command-line arguments passed to the program.
argv (argument vector) is an array of strings (character pointers) that holds the actual arguments.
Example: In 'int main(int argc, char *argv[])', argc counts the arguments, and argv[0] is the program name.
Usage: This format is commonly used in console applications to allow user input ...read more

Asked in Cognizant

Q. Write a program to check whether a string starts with 's'. If it does, convert it into an array and print each element of the array.
Program to check if a string starts with 's' and convert it to an array
Use string method startsWith() to check if the string starts with 's'
If it starts with 's', use split() method to convert it into an array
Loop through the array and print each element

Asked in Cognizant

Q. Write a program to check whether a given integer is prime or not and even or odd, ensuring it handles all kinds of inputs without errors.
Program to check if an integer is prime, even or odd without errors.
Take input integer from user
Check if input is valid integer
Check if input is prime or not
Check if input is even or odd
Display the result

Asked in Cognizant

Q. Write a C program that displays your name on the first line, and on each subsequent line, displays the name with one fewer word than the previous line, until only one word remains.
The program will display the name of the user in the first line and then decrease one word in each subsequent line until only one word remains.
Create an array of strings containing the user's name split into individual words
Use a loop to iterate through the array and print the name with one less word in each iteration
Continue the loop until only one word remains

Asked in Cognizant

Q. Write an SQL query to find the salary and department of employees.
An SQL query to find the salary and department of an employee.
Use the SELECT statement to retrieve the desired columns.
Specify the table name and join it with the department table using the appropriate join condition.
Use the WHERE clause to filter the results based on employee criteria if needed.

Asked in Cognizant

Q. Which programming language do you like the most and why?
I like Python the most because of its simplicity and versatility.
Python has a simple syntax which makes it easy to learn and use.
It has a vast library of modules and frameworks for various purposes.
Python is used in various fields such as web development, data science, and automation.
It supports both object-oriented and functional programming paradigms.
Python is also known for its readability and maintainability of code.
For example, I have used Python for web scraping, data a...read more

Asked in Cognizant

Q. what is the output for the given code sample explain
The output of the code sample is 'Hello World'.
The code sample is likely to print a string.
The string being printed is 'Hello World'.

Asked in Cognizant

Q. What error will you get if you enter a duplicate value into the primary key column?
You will get a primary key violation error if you enter a duplicate value to the primary key column.
A primary key is a unique identifier for each record in a database table.
When you try to insert a duplicate value into the primary key column, the database system will throw an error.
The error message will typically indicate a primary key violation or duplicate key error.
To resolve the issue, you need to ensure that each value in the primary key column is unique.

Asked in Cognizant

Q. Demonstrate Exception Handling in Java with an example.
Exception handling in Java manages runtime errors, ensuring program stability and providing informative feedback to users.
Java uses try, catch, and finally blocks for exception handling.
Example: try { int result = 10 / 0; } catch (ArithmeticException e) { System.out.println('Division by zero!'); }
The finally block executes regardless of whether an exception occurred.
Custom exceptions can be created by extending the Exception class.
Example: class MyException extends Exception ...read more

Asked in Cognizant

Q. In the development section, you will be given HTML, CSS, and JS code that you have to correct according to the required result given in the question.
Correct HTML, CSS, and JS code to meet specified requirements in a Programmer Analyst Trainee interview.
Check for missing or incorrect HTML tags, e.g., <div> instead of <div/>.
Ensure CSS styles are applied correctly, e.g., using class selectors.
Validate JavaScript functions for proper syntax and logic.
Use browser developer tools to debug and test changes.
Ensure responsive design with CSS media queries.

Asked in Cognizant

Q. I have chosen to write a Fibonacci series coding problem on an online compiler.
Fibonacci series is a sequence where each number is the sum of the two preceding ones, starting from 0 and 1.
The Fibonacci series starts with 0 and 1.
Each subsequent number is the sum of the previous two: 0, 1, 1, 2, 3, 5, 8, 13, ...
Commonly used in programming interviews to test recursion and iteration skills.
Example code in Python: def fibonacci(n): if n <= 0: return [] elif n == 1: return [0] elif n == 2: return [0, 1] else: fib_series = [0, 1] for i in range(2, n): fib_se...read more

Asked in Cognizant

Q. Explain how the Software Development process works ? And what is it that we are following now a days ?
Software development process involves planning, designing, coding, testing, and deployment of software.
Requirement gathering and analysis
Designing the software architecture
Coding and implementation
Testing and debugging
Deployment and maintenance
Agile methodology is commonly followed nowadays

Asked in Cognizant

Q. Write a program to find the third lowest element from an array and count the occurrence of that number in the array.
Find third lowest element and its occurrence in an array.
Sort the array and return the element at index 2 with its count.
Use a hash table to count occurrences while iterating through the array.

Asked in Cognizant

Q. What is R programming? What is Public class? What are access specifiers? Write a array program and explain it for nested loop concept?
R programming is a language and environment for statistical computing and graphics.
R programming is widely used for data analysis, statistical modeling, and visualization.
Public class in programming refers to a class that can be accessed from outside the package.
Access specifiers in programming define the accessibility of classes, methods, and variables.
An array program using nested loops can be used to iterate through a multi-dimensional array.

Asked in Cognizant

Q. In an 'If' statement, if there is more than one statement and curly brackets are omitted, what will be the output?
If more than 1 statements are under 'If' statement without curly brackets, what will be the output?
The first statement after 'if' will be executed
The second statement will be executed regardless of the condition
It can lead to unexpected behavior and bugs
Always use curly brackets to avoid confusion

Asked in Cognizant

Q. What are star and mesh topologies?
Star and mesh are network topologies used in computer networking.
Star topology connects all devices to a central hub or switch.
Mesh topology connects every device to every other device.
Star topology is easy to set up and troubleshoot.
Mesh topology is highly reliable and fault-tolerant.
Examples of star topology include Ethernet and Wi-Fi networks.
Examples of mesh topology include sensor networks and peer-to-peer networks.

Asked in Cognizant

Q. What is machine learning, deep learning, artificial intelligence and cloud computing?
Machine learning, deep learning, artificial intelligence and cloud computing are all related to advanced computing technologies.
Machine learning is a subset of AI that involves training algorithms to make predictions or decisions based on data.
Deep learning is a subset of machine learning that uses neural networks to learn and make decisions.
Artificial intelligence is the broader field of creating intelligent machines that can perform tasks that typically require human intell...read more

Asked in Cognizant

Q. Since I am from ECE, what is the difference between half duplex and full duplex?
Half duplex allows communication in both directions, but not simultaneously. Full duplex allows simultaneous communication in both directions.
Half duplex allows communication in both directions, but only one direction at a time.
Full duplex allows simultaneous communication in both directions.
Examples of half duplex communication include walkie-talkies and CB radios.
Examples of full duplex communication include telephone conversations and video conferencing.

Asked in Cognizant

Q. What are the advantages of using NetBeans for writing Java code?
NetBeans provides a user-friendly interface, powerful code editing features, and seamless integration with Java development tools.
NetBeans offers a user-friendly interface with drag-and-drop functionality for easy development.
It provides powerful code editing features like code completion, refactoring, and debugging.
NetBeans has seamless integration with Java development tools, making it easier to build, test, and deploy Java applications.
It supports various frameworks and te...read more

Asked in Cognizant

Q. What is difference between RDBMS and DBMS? What is differenence between stack and queue?
RDBMS is a relational database management system that stores data in tables with predefined relationships. DBMS is a general-purpose database management system that stores data in various formats.
RDBMS enforces ACID properties while DBMS does not
RDBMS supports SQL while DBMS may or may not support SQL
RDBMS is used for large-scale applications while DBMS is used for small-scale applications
Stack is a LIFO data structure while Queue is a FIFO data structure
Stack uses push and p...read more

Asked in Cognizant

Q. Tell about encoder, decoder and Multiplexer
Encoders, decoders, and multiplexers are digital logic circuits used in data processing and communication systems.
An encoder is a circuit that converts a set of input signals into a coded output signal.
A decoder is a circuit that converts a coded input signal into a set of output signals.
A multiplexer is a circuit that selects one of many input signals and forwards it to a single output line.
Encoders and decoders are often used together to convert data between different forma...read more
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Programmer Analyst Trainee Related Skills



Reviews
Interviews
Salaries
Users

