Programmer Analyst
400+ Programmer Analyst Interview Questions and Answers

Asked in Cognizant

Q. Given an array, write code to check which numbers are prime.
Code to check prime numbers in an array
Iterate through each number in the array
For each number, check if it is divisible by any number from 2 to the square root of the number
If the number is only divisible by 1 and itself, it is a prime number

Asked in Cognizant

Q. What are the differences between ViewBag, ViewData, and TempData in ASP.NET MVC?
ViewBag, ViewData and TempData are used to pass data between controller and view in ASP.NET MVC.
ViewBag is a dynamic object used to pass data from controller to view.
ViewData is a dictionary object used to pass data from controller to view.
TempData is a dictionary object used to pass data from one controller action to another.
ViewBag and ViewData are short-lived and can only be used to pass data from controller to view.
TempData is used to pass data between controller actions ...read more

Asked in Cognizant

Q. What is difference between procedurea and functions and how they work
Procedures and functions are both subroutines in programming, but functions return a value while procedures do not.
Procedures are used to perform a specific task and do not return a value.
Functions are used to perform a specific task and return a value.
Procedures are called using the CALL statement, while functions are called by assigning their return value to a variable.
Functions can be used in expressions, while procedures cannot.
Functions can have parameters, while procedu...read more

Asked in TO THE NEW

Q. Write an SQL query to find the second highest salary from an employee table.
SQL query to find second highest salary
Use ORDER BY and LIMIT to get the highest salary
Use subquery to exclude the highest salary and get the second highest

Asked in Wall Street Consulting Services

Q. How do you ensure the quality and security of your code?
I ensure code quality and security through best practices, code reviews, testing, and security measures.
Implement coding standards and best practices, such as using consistent naming conventions and modular design.
Conduct regular code reviews with peers to identify potential issues and improve code quality.
Utilize automated testing frameworks (e.g., JUnit for Java) to ensure functionality and catch bugs early.
Incorporate static code analysis tools (e.g., SonarQube) to detect ...read more

Asked in Boeing

Q. What design patterns have you implemented in your project?
I have implemented various design patterns such as Singleton, Factory, and Observer in my projects.
Implemented Singleton pattern to ensure only one instance of a class is created.
Utilized Factory pattern to create objects without specifying the exact class of object that will be created.
Used Observer pattern to define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
Programmer Analyst Jobs




Asked in Cognizant

Q. What is the difference between a Primary key and a Unique key in SQL?
Primary key uniquely identifies a record in a table, while Unique key ensures uniqueness of a column.
Primary key cannot have null values, while Unique key can have one null value.
A table can have only one Primary key, but multiple Unique keys.
Primary key is automatically indexed, while Unique key is not necessarily indexed.

Asked in Cognizant

Q. What is the difference between a temporary table and a table variable in SQL Server?
Temptable is a physical table created in tempdb while table variable is a variable created in memory.
Temptable is used for large data sets or complex queries
Table variable is used for small data sets or simple queries
Temptable can be indexed and have constraints while table variable cannot
Temptable can be accessed by multiple sessions while table variable is limited to the current session
Share interview questions and help millions of jobseekers 🌟

Asked in FOSS INFOTECH

Q. Add a field in sale order form and pass the value to invoice and delivery order
To add a field in sale order form and pass the value to invoice and delivery order, modify the code for all three forms.
Identify the code for sale order form, invoice form, and delivery order form
Add the new field in the sale order form code
Modify the invoice and delivery order form code to receive and display the new field value
Test the changes thoroughly before deploying

Asked in Fidelity International

Q. 1. What is serialization? 2. What is a Singleton class? 3. Difference b/w interface and abstract class. And a few more basic java 8 questions.
Serialization is the process of converting an object into a stream of bytes to store or transmit data.
Serialization is used to save the state of an object and recreate it when needed.
In Java, serialization is achieved by implementing the Serializable interface.
Example: ObjectOutputStream and ObjectInputStream classes are used for serialization in Java.

Asked in Cognizant

Q. How do you implement arrays within a structure?
Arrays in structures allow grouping of related data, enhancing organization and access in programming.
A structure can contain an array of strings to hold multiple values. Example: `struct Student { char names[10][50]; };`
You can access individual strings using the structure variable. Example: `strcpy(student.names[0], "Alice");`
Arrays in structures are useful for managing collections of data, like names, addresses, etc.
You can also define an array of structures. Example: `str...read more

Asked in Cognizant

Q. Tell me some technologies that were used in IT industry
Technologies used in IT industry include cloud computing, artificial intelligence, blockchain, and internet of things.
Cloud computing: AWS, Azure, Google Cloud
Artificial intelligence: Machine learning, natural language processing
Blockchain: Bitcoin, Ethereum
Internet of things: Smart homes, wearables
Asked in Electronica Hitech Machine Tools

Q. Write a program to determine whether a number is a palindrome.
Program to check if a number is a palindrome or not.
Convert the number to a string to easily check for palindrome
Reverse the string and compare it with the original string
If they are the same, the number is a palindrome

Asked in HTC Global Services

Q. what are the oops concepts and how we use them?
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 with properties like make, model, and methods like start(), stop().
Inheritance: Ability of a class to inherit properties and behavior from another class. Example: Class SUV inheriting from Class Car.
Polymorphism: Ability to present the same interface f...read more

Asked in Centum Electronics

Q. What is the difference between a motor and a generator?
A motor converts electrical energy into mechanical energy, while a generator converts mechanical energy into electrical energy.
Motors use electrical energy to create motion, while generators use motion to create electrical energy.
Motors have a rotor and a stator, while generators have a stator and a rotor.
Examples of motors include electric fans, washing machines, and power tools, while examples of generators include wind turbines and hydroelectric dams.

Asked in ZettaLogix

Q. How do you handle debugging a program that isn’t working?
I systematically identify and resolve issues in code through structured debugging techniques.
Reproduce the issue: Ensure the problem can be consistently replicated.
Check error messages: Analyze any error messages or logs for clues.
Use debugging tools: Utilize tools like breakpoints and step-through debugging to inspect code execution.
Isolate the problem: Comment out sections of code to narrow down where the issue lies.
Review recent changes: Look at the most recent code change...read more

Asked in Cognizant

Q. Libraries used in pythons and how do use it.
Python has a vast collection of libraries for various purposes. Some popular ones are NumPy, Pandas, Matplotlib, and Scikit-learn.
NumPy is used for numerical computing and data analysis.
Pandas is used for data manipulation and analysis.
Matplotlib is used for data visualization.
Scikit-learn is used for machine learning and data mining.
To use a library, it must be imported at the beginning of the code using the 'import' statement.
For example, to use NumPy, we can write 'import ...read more

Asked in Cognizant

Q. 1. If this a (showed an obj) and this is b, write a code to add both and get results
Code to add two objects and get results
Use the + operator to add the values of the objects
Ensure that the objects have compatible data types for addition
Handle any potential errors or exceptions that may occur during the addition

Asked in Cognizant

Q. What is the difference between SQL and SQL Server?
SQL is a language used to manage databases, while SQL Server is a Microsoft product that includes a database management system.
SQL is a language used to interact with databases, while SQL Server is a Microsoft product that includes a database management system.
SQL can be used with various database management systems like MySQL, Oracle, etc., while SQL Server is specific to Microsoft.
SQL is a standard language for querying and managing databases, while SQL Server provides addi...read more

Asked in Cognizant

Q. Explain how recursion works with an example.
Recursion is a programming technique where a function calls itself to solve a problem.
Recursion involves breaking down a problem into smaller subproblems and calling the function recursively to solve them.
Each recursive call works on a smaller input until a base case is reached to stop the recursion.
Example: Factorial calculation, Fibonacci sequence, tree traversal.

Asked in Cognizant Solutions Corp

Q. What are the ways of reading external data?
There are several ways to read external data, such as using file input/output operations, database queries, web scraping, and API calls.
File input/output operations: Reading data from files stored on the local system or network.
Database queries: Retrieving data from databases using SQL or other query languages.
Web scraping: Extracting data from websites by parsing HTML or using web scraping libraries.
API calls: Fetching data from external systems or services through API endpo...read more

Asked in Cognizant

Q. Write a simple program to find prime numbers in a series of numbers.
To find prime numbers in a series, iterate through each number and check if it's divisible by any number other than 1 and itself.
Start iterating through the series of numbers
For each number, check if it's divisible by any number other than 1 and itself
If it's not divisible by any other number, it's a prime number
Keep track of all the prime numbers found

Asked in Congruent Solutions

Q. How do you handle interview and technical questions?
Prepare thoroughly, practice responses, and stay calm to effectively handle interview and technical questions.
Research the company and role to tailor your answers. For example, know their projects and values.
Practice common interview questions and technical problems. Use platforms like LeetCode for coding questions.
Use the STAR method (Situation, Task, Action, Result) to structure your responses to behavioral questions.
Stay calm and take a moment to think before answering tec...read more

Asked in Cognizant

Q. What is the output of the given recursive code?
Output of a given recursive code
Understand the logic of the recursive function
Trace the function calls and their return values
Identify the base case and recursive case
Check for any errors or infinite loops

Asked in Amazon

Q. Given an array of integers, find the indices of a pair that sums to a target value K.
Given an array of integers, find the indices of a pair which sum results in K.
Iterate through the array and for each element, check if K minus the element exists in the array using a hash table.
If it exists, return the indices of both elements.
If it doesn't exist, add the current element to the hash table.

Asked in Amazon

Q. Write code to find the minimum difference between any two elements in an array.
Find the minimum difference between any two elements in an array of integers.
Sort the array first to make it easier to find minimum differences.
Iterate through the sorted array and calculate differences between consecutive elements.
Keep track of the minimum difference found during the iteration.
Example: For array [3, 8, 15, 17], after sorting: [3, 8, 15, 17], differences are 5, 7, 2. Minimum is 2.

Asked in Cognizant

Q. Explain the Quicksort algorithm, including the steps.
Quicksort is a divide-and-conquer algorithm that sorts an array by partitioning it into two sub-arrays, then recursively sorting the sub-arrays.
Choose a pivot element from the array.
Partition the array into two sub-arrays, with elements less than the pivot in one sub-array and elements greater than the pivot in the other sub-array.
Recursively apply the quicksort algorithm to each sub-array.
Combine the sorted sub-arrays to obtain the final sorted array.
Asked in Paccore Software

Q. Write a program to check if a number is a palindrome.
A program to check if a number is Palindrome or not.
Convert the number to a string
Reverse the string
Compare the original string with the reversed string
If they are equal, the number is a palindrome
If not, the number is not a palindrome

Asked in Cognizant

Q. 1) what is capture action and record action in AA?
Capture action is used to extract data from an application while record action is used to automate user actions.
Capture action is used to capture data from an application's UI elements such as text boxes, drop-downs, etc.
Record action is used to record user actions such as mouse clicks, keyboard inputs, etc. to automate them later.
Capture action is used in conjunction with data scraping to extract data from web pages or desktop applications.
Record action is used to create aut...read more

Asked in Cognizant

Q. Write pseudocode for printing a 5-row triangle using asterisks.
Pseducode for printing a 5 rows triangle with star elements.
Use nested loop to print the triangle
The outer loop will iterate for 5 rows
The inner loop will print the stars for each row
The number of stars to print will increase with each row
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Programmer Analyst Related Skills



Reviews
Interviews
Salaries
Users

