Analyst
2500+ Analyst Interview Questions and Answers

Asked in Goldman Sachs

Q. A man starts at 0 and needs to reach 20 on a number line, moving in steps of 1 or 2. How many different ways can he accomplish this?
Count number of ways to reach 20 on number line starting from 0 in steps of 1 or 2. Derive recursive formula for n+1.
Use dynamic programming to count number of ways for each step.
For each step, number of ways is sum of number of ways for previous 1 or 2 steps.
Recursive formula: ways[n+1] = ways[n] + ways[n-1]

Asked in Goldman Sachs

Q. Boyer Moore Algorithm for Pattern Searching
You are given a string text
and a string pattern
. Your task is to find all occurrences of pattern
in the string text
and return an array of indexes of all those occur...read more
Implement Boyer Moore Algorithm to find all occurrences of a pattern in a given text.
Use Boyer Moore Algorithm to efficiently search for the pattern in the text.
Iterate through the text and compare the pattern with each substring to find matches.
Return an array of indexes where the pattern is found, or -1 if no occurrence is found.

Asked in Axtria

Q. Rotate Array Problem Statement
The task is to rotate a given array with N elements to the left by K steps, where K is a non-negative integer.
Input:
The first line contains an integer N representing the size of...read more
Rotate a given array to the left by K steps.
Create a new array to store the rotated elements.
Use modular arithmetic to handle cases where K is greater than the array size.
Shift elements to the left by K positions and fill in the remaining elements from the original array.
Return the rotated array.

Asked in Morgan Stanley

Q. Data is generally stored in normalized form, which can slow down query performance. How would you optimize query speed?
Denormalization, indexing, caching, and partitioning can improve query performance.
Denormalize the data to reduce the number of joins required for queries.
Create indexes on frequently queried columns to speed up search.
Cache frequently accessed data in memory to avoid disk reads.
Partition large tables into smaller ones to reduce the amount of data that needs to be scanned.
Use query optimization techniques like query rewriting and query hints.
Consider using NoSQL databases for...read more

Asked in eClerx

Q. Why Derivatives Contract are needed? What is put option, Call Option IPO FPO Future Forward Option Swap Investment Banking. Sebi Stock market BSE NSE Read all
Derivatives contracts are needed to manage risk and provide opportunities for speculation and hedging in financial markets.
Derivatives contracts allow investors to manage risk by providing a way to hedge against potential losses.
They also provide opportunities for speculation, allowing investors to profit from price movements without owning the underlying asset.
Put options give the holder the right, but not the obligation, to sell an asset at a specified price within a specif...read more

Asked in Goldman Sachs

Q. If you are asked to play a game where you toss a fair coin again and again until you get consecutive heads and win Re. 1 or you get consecutive tails and lose and quit, how much will you be willing to pay to pl...
read moreI would be willing to pay 50 paise to play this game.
The expected value of the game is 50 paise.
This is because the probability of getting consecutive heads is 1/3 and the probability of getting consecutive tails is 1/4.
Therefore, the expected value of the game is (1/3 * 1) - (1/4 * 1) = 1/12 = 8.33 paise.
However, since the minimum amount that can be won is Re. 1, I would be willing to pay 50 paise to play the game.
Analyst Jobs




Asked in Goldman Sachs

Q. Circular Tour Problem Statement
Consider a circular path with N petrol pumps. Each pump is numbered from 0 to N-1. Every petrol pump provides:
- The amount of petrol available at the pump.
- The distance to the ne...read more
The task is to find the first petrol pump from which a truck can complete a full circle or determine if it's impossible.
Iterate through each petrol pump and calculate the remaining petrol after reaching the next pump.
If the remaining petrol is negative at any point, reset the starting pump to the next pump and continue.
If the total remaining petrol at the end is non-negative, return the index of the starting pump.
If the total remaining petrol is negative, it's impossible to c...read more

Asked in Amazon

Q. Maximum Subarray Sum Problem Statement
Given an array ARR
consisting of N
integers, your goal is to determine the maximum possible sum of a non-empty contiguous subarray within this array.
Example of Subarrays:...read more
The goal is to find the maximum sum of a non-empty contiguous subarray within an array of integers.
Iterate through the array and keep track of the maximum sum of subarrays encountered so far.
Use Kadane's algorithm to efficiently find the maximum subarray sum.
Consider edge cases like all negative numbers in the array.
Example: For input [1, -3, 4, -2, -1, 6], the maximum subarray sum is 7 (subarray [4, -2, -1, 6]).
Share interview questions and help millions of jobseekers 🌟

Asked in Amazon

Q. Shortest Path in a Binary Matrix Problem Statement
Given a binary matrix of size N * M
where each element is either 0 or 1, find the shortest path from a source cell to a destination cell, consisting only of 1s...read more
Find the shortest path in a binary matrix from a source cell to a destination cell consisting only of 1s.
Use Breadth First Search (BFS) algorithm to find the shortest path.
Keep track of visited cells to avoid revisiting them.
Calculate the path length by counting the number of 1s in the path.
Return -1 if no valid path exists.
Asked in SatNav Technologies

Q. What do you know about networking?
Networking refers to the practice of connecting devices together to share resources and communicate with each other.
Networking involves the use of protocols and standards such as TCP/IP, DNS, and HTTP.
Networking can be done through wired or wireless connections.
Networking can be used for various purposes such as sharing files, printers, and internet access.
Networking can be secured through the use of firewalls, encryption, and authentication.
Examples of networking devices inc...read more

Asked in HCLTech

Q. What is Active Directory? How do we manage role from active directory
Active Directory is a Microsoft service that manages network resources and user access.
Active Directory is used to manage user accounts, computers, and other network resources.
It allows for centralized authentication and authorization for users and computers in a network.
Roles can be managed through Active Directory by assigning users to specific groups with corresponding permissions.
Examples of roles that can be managed through Active Directory include domain administrators,...read more

Asked in Goldman Sachs

Q. There is an urn with n red balls and 1 black ball in it. You and your friend play a game where you take turns drawing from the urn. The player who draws the black ball first wins. Should you go first or second?
Go second. The probability of winning is higher when going second.
The probability of winning when going first is (1/n+1), while the probability of winning when going second is (n/n+1)
This is because the first player has a chance of drawing the black ball on their turn, while the second player has a chance of drawing the black ball on their turn or the first player's turn
For example, if there are 10 red balls and 1 black ball, the probability of winning when going first is 1/1...read more

Asked in Oracle

Q. Greatest Common Divisor Problem Statement
You are tasked with finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'. The GCD is defined as the largest integer that divides both of the given...read more
Finding the greatest common divisor (GCD) of two given numbers 'X' and 'Y'.
Iterate through each test case and calculate GCD using Euclidean algorithm
Handle edge cases like when one of the numbers is 0
Output the GCD for each test case

Asked in Amazon

Q. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access.
When capacity is reached, evict the least recently used item before inserting a new item.
Update the order of keys in the linked list whenever a key is accessed or inserted.

Asked in UBS

Q. There is a closed room with 3 bulbs and three switches outside. You can toggle any two switches once without looking inside the room and map the bulbs to their corresponding switches. How do you do it?
You can map the bulbs to their corresponding switches by toggling two switches and leaving one switch untouched.
Toggle switch 1 and switch 2, leave switch 3 untouched.
After a few minutes, toggle switch 2 back to its original position.
Enter the room and observe the bulbs.
The bulb that is on corresponds to switch 1, the bulb that is off and still warm corresponds to switch 2, and the bulb that is off and cool corresponds to switch 3.

Asked in Goldman Sachs

Q. Suppose there are N chocolates, and you pick a random one, and eat that chocolate and also everything to the right of it. You then continue this process with the remaining chocolates. How many ways are there to...
read moreThere are (N-1)! ways to eat chocolates from left to right.
The first chocolate can be chosen in N ways, the second in (N-1) ways, and so on.
However, since the order of chocolates eaten matters, we need to divide by the number of ways to order N chocolates, which is N!.
Therefore, the total number of ways to eat chocolates is (N-1)!
For example, if N=4, there are 3! = 6 ways to eat the chocolates.

Asked in Goldman Sachs

Q. Given 3 functions, f which gives the first day of the current month, g gives the next working day and h gives the previous working day, conpute the 3rd working day? Compute the 2nd working day of the previous m...
read moreCompute working days using given functions f, g, and h.
To compute the 3rd working day, apply function g three times to function f.
To compute the 2nd working day of the previous month, apply function h to function f, then apply function g twice.
To compute the 4th working day of the next month, apply function g four times to function f.

Asked in Synchrony

Q. How would you segment a population based on certain attributes, which algorithm would you use. SAS and proc sql related questions are must for analyst interview. If lateral hire, expect questions based on work...
read moreTo segment a population based on attributes, use clustering algorithms like k-means or hierarchical clustering.
Identify relevant attributes such as age, income, education level, etc.
Normalize the data to ensure all attributes are on the same scale.
Choose a clustering algorithm based on the size of the dataset and the desired number of segments.
Evaluate the results using metrics like silhouette score or within-cluster sum of squares.
Use SAS and proc sql to perform the analysis...read more

Asked in UBS

Q. If there were 5 people sitting in a room and each thinks of some number, how could they find the average without telling each other the explicit numbers?
Five people can find the average of their numbers using a secure method without revealing their individual numbers.
Each person adds a random number (e.g., 10) to their own number before sharing it.
They share the modified numbers with each other.
The average of the modified numbers is calculated.
To find the actual average, subtract the random number from the result.

Asked in Goldman Sachs

Q. An IT sector multinational wants to expand its business into more countries. Suggest a strategy.
To expand into more countries, the IT sector multinational can adopt a market entry strategy that includes market research, partnerships, localization, and scalability.
Conduct thorough market research to identify potential countries for expansion
Establish strategic partnerships with local companies to leverage their knowledge and networks
Adapt products and services to meet the specific needs and preferences of each target market
Ensure scalability of operations to handle the i...read more

Asked in eClerx

Q. What is capital market, trade life cycle, what is option and it's style, what is mutual fund, what is bind market, why you want to join eclerx, how many investment banks are there
The interview questions cover various financial concepts such as capital market, trade life cycle, options, mutual funds, and bond market.
Capital market refers to the market for buying and selling of securities such as stocks and bonds.
Trade life cycle involves the steps involved in a trade from initiation to settlement.
Option is a contract that gives the buyer the right, but not the obligation, to buy or sell an underlying asset at a specific price on or before a certain dat...read more

Asked in Infibeam

Q. Which language do you prefer to code in? "Have you read The C Programming Language book by Dennis Retchie?" Which technical book have you read recently?.-So you like C, have you ever thought of bringing up the...
read moreYes, I prefer coding in C and have read The C Programming Language book. I have also explored the concept of Inheritance in C.
I find C to be a powerful and efficient language for system programming.
Yes, I have read The C Programming Language book by Dennis Retchie and found it to be a great resource.
Recently, I have been exploring the concept of Inheritance in C through various online resources and tutorials.
While C does not have built-in support for Inheritance, it is possib...read more

Asked in Morgan Stanley

Q. How would you determine if a number is even or odd without using conditional statements?
Using bitwise operator to check the last bit of the number.
Use bitwise AND operator with 1 to check the last bit of the number.
If the result is 0, the number is even. If the result is 1, the number is odd.
Example: 6 & 1 = 0 (even), 7 & 1 = 1 (odd)

Asked in Goldman Sachs

Q. A lemonade vendor spends all of his daily income on his daily expenditure, except for the amount needed to conduct equal business the next day. He wants to start saving for the future. How would you advise him...
read moreAdvise the nimbu paani wala on how to start saving for the future.
Encourage him to set a savings goal and create a budget to achieve it.
Suggest he start small by saving a small percentage of his daily income.
Recommend he explore investment options to grow his savings over time.
Remind him to continue setting aside enough money for his daily expenses.
Provide resources or education on financial literacy to help him make informed decisions.

Asked in ION Group

The camel can maximize the number of bananas delivered by making multiple trips with a decreasing number of bananas each time.
The camel should start by carrying the maximum number of bananas it can transport.
After each trip, the camel should leave one banana behind and carry the rest to the destination.
This way, the camel can make multiple trips with decreasing numbers of bananas until all bananas are delivered.

Asked in Tredence

Q. Given two hourglasses, one measuring 4 minutes and the other 7 minutes, how can you measure 9 minutes?
To measure 9 minutes using two hourglasses of 4 and 7 minutes, start both hourglasses simultaneously. When the 4-minute hourglass runs out, flip it again. When the 7-minute hourglass runs out, flip it again. When the 4-minute hourglass runs out for the third time, 9 minutes will have passed.
Start both hourglasses simultaneously
When the 4-minute hourglass runs out, flip it again
When the 7-minute hourglass runs out, flip it again
When the 4-minute hourglass runs out for the thir...read more

Asked in HSBC Group

Q. How do you calculate the average number of people coming to the airport daily?
The average number of people coming to the airport daily can be calculated by taking the total number of people arriving and departing and dividing it by two.
Collect data on the number of arrivals and departures for a given period, such as a week or a month.
Add the number of arrivals and departures together to get the total number of people coming to the airport.
Divide the total number by the number of days in the period to get the average number of people coming to the airpo...read more

Asked in Morgan Stanley

Q. In how many ways can you permute n numbers 1, 2, 3,...n so that all the numbers between i and i+1 are less than i (for all i in the permutation)?
Counting permutations where numbers between u and i+1 are less than i for all i in the permutation.
The first number in the permutation must be 1.
For each i in the permutation, all numbers between u and i+1 must be less than i.
Use dynamic programming to count the number of valid permutations.
The answer is (n-1)th Catalan number.
Example: for n=4, the answer is 5.

Asked in Deutsche Bank

Q. Can any work you did at Microsoft be applied to database systems?
Yes, an algorithm I designed at Microsoft can be applied to a problem in the stock market domain.
I designed an algorithm at Microsoft that can be used in the stock market domain
The algorithm can be applied to solve a specific problem in the stock market
The work I did at Microsoft has potential applications in the financial industry

Asked in Morgan Stanley

Q. In a unit circle, point P is chosen uniformly on the circle and point Q inside the circle. What is the probability that the rectangle formed by P and Q is inside the circle?
Probability of a rectangle being inside a unit circle with p chosen uniformly on the circle and q inside the circle.
The probability can be found by calculating the ratio of the area of the rectangle to the area of the circle.
The area of the circle is pi and the area of the rectangle can be found using the distance between p and q.
The probability is 1/4.
Example: If the distance between p and q is 0.5, then the area of the rectangle is 0.25 and the probability is 0.25/pi.
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Analyst Related Skills



Reviews
Interviews
Salaries
Users

