## Analyst Interview Questions

- 0of 0 votes
How to sort an array of integers using two priority queues ?

- 0of 0 votes
This was design question.

I have a single timer class which is running on a single port of a machine.

There are multiple clients that can send request to this timer class as follows.

request_timer (x)

where x is time in seconds.

when the timer class gets this request from a client it starts a timer object of x seconds and after x seconds are over it sends an event to the requesting client and client can handle the event the way it wants to .

The problem is if you have large number of clients then the timer class is single point of congestion and the clients may receive the event from it after a long time.

What are the good ways to scale this for a large number of clients?

- 0of 0 votes
A parent array P is given where P[i] denotes the parent of the ith node in the tree(the tree is generic). Parent of root is indicated with -1. I need to find the height/depth of tree. (Best sol in O(n))

- 0of 0 votes
Table 1; transaction_id, price

Table 2: transaction_id, zipcode

Query to find the avg price per zipcode

Query to show zipcodes that have an avg price more than $5.

- 0of 0 votes
Ebay lowers its listing fee for one of the product ( bikes), and sees an increase in avg sales price. Explain why?

- 0of 0 votes
What is difference between Having and where clause?

- 0of 0 votes
Design a phone book such that fields are searchable with name , with number. Later enhanced teh question asking searchable with address as well.

- 0of 0 votes
An analyst at Amazon is conducting a satisfaction survey, sampling from a list of 10,000 new users. The list includes 2,500 French users, 2,500 German users, 2,500 Italian users, and 2,500 Portuguese users, The analyst selects a sample of 400 users, by randomly sampling 100 users of each country. Is this an example of simple random sample?

- 0of 0 votes
I applied online through Amazon page, and they contacted me right immediately like on that day which was scary for me. I guess they embody truly the culture of moving fast. I got an e-mail with to complete some online test with 13 questions and they were on:

13 questions:

9 Analytical Multiple Choice Questions – focusing on sets, trend analysis, calculus, stats, etc.

1 open ended basic SQL question.

1 open ended normalization question.

1 Multiple Choice English language comprehension question.

1 open ended language question (this part should be 200 – 300 words).

The entire online assessment test was conducted through hackerrank.com and it was for 90 min.

Personally I did not go and complete the Quiz within couple of day. I did take my time to prepare and I was right. It is a difficult test. I did use apps like ‘the impossible interview’ and ‘the aptitude interview’ from iTunes app store to prepare. They were a help.

- 1of 1 vote
How to design a multi key hash map ( key count can be dynamic. if there are two keys , initiallly which can be used to find the value , keys can be increased to three as well ex: consider school structure. Intially , consider , student id is key , later , should be searchable even with key name , later with grade.

- 2of 2 votes
Design a telephone directory for large ppl (he gave example like design for India). fields will be , first name , last name , number . this should be searchable with first name , last name , number as welll.

later added more complexity like do the same for organisation where even it contains designations. so this should be searchable with designations.

- 0of 0 votes
Suppose an Archeologist is visiting Africa, who don't know the native language. There are two tribe, one of those always speaks the "Truth" and another one always speaks "Lie". Suppose you are in front of three such people, of course you don't know them as truth/lie speaking tribe. You asked a question, and the 1st one replies in his native language, which you don't know, then 2nd tells that the 1st person is lying(in english) and the third person tells that 2nd person is lying(in english).

Which tribe does the 3rd person belongs?

- 0of 0 votes
`public class Gen { public static void main(String[] args) { Integer i1 = new Integer(1); Integer i2 = new Integer(1); System.out.println(i1 != i2); System.out.println(i1 <= i2); System.out.println(i1 >= i2); } }`

WHY THE OUTPUT IS TRUE IN ALL CASES?

- 0of 0 votes
Given a list of 'N' coins, their values being in an array A[], return the minimum number of coins required to sum to 'S' (you can use as many coins you want). If it's not possible to sum to 'S', return -1

Example:

Input #00:

Coin denominations: { 1,3,5 }

Required sum (S): 11

Output #00:

3

Explanation:

The minimum number of coins requires is: 3 - 5 + 5 + 1 = 11;

- 0of 0 votes
Basically I know that 378 small sheets were printed. These came from 21 full sized sheets of paper. The large sheets of paper were torn, leaving rough edges that can be put re-joined digitally. I have now recorded 60 different sheets, and have joined only five pairs. What I would like to know is what is the likely number of sheets that the five pairs came from of the 21 originally used.

- 0of 0 votes
This is a hardware design problem. I can not figure it out. Suppose we have 2 pipelined hardware multipliers(or something). One is working at 1GHz with 2 operations executed in parallel at the same time. The other one is at 500GHz with 4 operations. Suppose we have transistors of 3 types(low leaky(30%),middle leaky(50%) and high leaky(70%)) and here leaky means leakage power of the transistor. Which multiplier should we use considering the 3 types of transistors.

- 0of 0 votes
The strength of a pair integer sequences is defined by the number of integers that they have in common. You are required to find the strength of several pairs of integer sequences.

INPUT

The first line of input contains T, the number of test cases. T test cases follow. Each test case contains 3 lines. The first line contains two integers N and M, which are the lengths of the two sequences. The next two lines contain the sequences.

OUTPUT

This should contain T lines, each containing an integer representing the strength of the pair of sequences for the corresponding test case.

CONSTRAINTS

The length of each sequence will be between 1 and 20 inclusive

A sequence can contain an integer between 1 and 100 inclusive

Sequences will not contain duplicate integers

SAMPLE INPUT

3

4 4

1 2 3 4

3 4 5 6

4 5

1 2 3 4

1 2 3 5 6

3 4

1 2 3

5 6 7 4

SAMPLE OUTPUT

2

3

0

- 0of 0 votes
The binary weight of a positive integer is the number of 1's in its binary representation. For example, the decimal number 1 has a binary weight of 1, and the decimal number 7 (which is 111 in binary) has a binary weight of 3.

Given a positive integer N, find the smallest integer greater than N that has the same binary weight as N.

INPUT

The first line of input contains a number T the number of test cases. The next T lines contain a number N.

OUTPUT

For each test case output a line containing the smallest number greater than N which has the same binary weight as N.

CONSTRAINTS

1 <= N <= 10000

SAMPLE INPUT

2

3

7

SAMPLE OUTPUT

5

11

- 0of 0 votes
Given an integer N, find the smallest integer greater than N which is prime.

INPUT

The first line of input contains T, the number of test cases. T test cases follow. Each test case contains a single integer N.

OUTPUT

This should contain T lines, each containing the smallest prime integer greater than N.

CONSTRAINTS

1 <= T <= 5

1 <= N <= 100

SAMPLE INPUT

2

6

11

SAMPLE OUTPUT

7

13

- 0of 0 votes
Dart thrown land up uniformly and random at a distance from centre of a unit circle. Distance from center is in the range [0,1]. One who lands up farther from the center loses and the loser pays amount equal to distance from the centre. What is the expected pay?

- 0of 0 votes
Whats wrong in this code?

#include<stdio.h>

#include<stdlib.h>

void mystrcpy( char *string2 ,char *string1 )

{

string2 = malloc(20);

while( *string1 != '\0')

{

*string2++= *string1++;

}

}

int main()

{

printf("****************program starts*************************");

char *str1 ="hello world";

char *str2 =NULL;

mystrcpy( str2,str1);

printf("string1 = %s string2 =%s ",str1,str2) ;

getche();

return 0;

}

why str2 will print NULL here

- -2of 2 votes
There is a file of size 100 gb and you have given a memory of size 100GB. How you will sort the file on basis of ASCII. File is having line of text inside it. No line in the file is repeated.

- -3of 5 votes
How can a HashMap accepts caseSensitive value ?

- -2of 2 votes
Q? How to find the highest nus. and second highest nus from a file ?

- 0of 0 votes
Find the expectation value of number of times you need to pick numbers to find a number smaller than the number you pick from a hat containing 1 to n.

case 1: if you replace

case 2: if you don't replace

Expectation values! not probability

- 3of 3 votes
A lot of transistors contains 0.6 percent defectives. Each transistor is subjected to a test that correctly identifies a defective but also misidentifies as defective about two in every 100 good transistors. Given that a randomly chosen transistor is declared defective by the tester, compute the probability that it is actually defective.

- 0of 0 votes
Given an unsorted array (of unknown length .. can be infinite even ).. at any point of time , how to find a number which is repeated for maximum times , followed questions is how to find a number which is repeated for n times.

Answer I proposed is using combination of binary st as ell as heap.

ex: this binary search tree will have structure which even has pointer to its correponding healelement's pointer.

while inserting an element into tree , will check whether it is repeated , if yes , will increase the priority of this element , and adjust heap accordingly.

Please comment on this solution

- -4of 6 votes
need to implement a weather report functionality. user will provide the city name , need to return the weather report.

if weather station exists n functioning properly , will return the weather report of that station .

else ,

will return the nearest available weather station report.

interviewer looking for optimized manner.

looking for datastructures to stores the cities n algo to return the report.

- 0of 0 votes
what is the difference?

void test(vector<int> vec)

{

//ptint the vec;

}

void test(const vector<int> &vec)

{

//print the vec;

}

- 1of 1 vote
what is the probability of 5 people with different ages sitting in ascending or descending order at a round table.