Microsoft Interview Question
Testing / Quality Assurances1. Write a script of some sort to check to see if n numbers are in the result
2. Compare the result to some sort of reliable prime number generator to see if they are generating consecutive prime numbers
3. If n is defined in the spec give the value of n to be specified MIN (which may be 0 or 1), MAX (100 or something like that), MIN - 1, MAX + 1, a value between MIN and MAX
4. Also monitor the performance of the generator when you increase n from MIN to MAX. Usually it wont perform in a polynomial way, as checking for primality is NP-Complete.
5. Do stress testing (run it in a loop to uncover memory leaks if any)
5. Volume testing (Give a very large number, much greater than MAX mentioned in the specs)
6. Invalid inputs (-1,'A'...)
Good point!
1. Check # is n;
2. Run several times to check the overall pattern by printing out as a graph;
Given some limit value,
3. Write an automate program to find the repeated data in each output, total # should be small;
4. Write an automate program to compare all outputs, same as above...
This is a very tricky question. I think the question really tries to see if you include testability as factor when developing software. Having said that there are couple of ways to test this software
1. As a part of the random number make sure you can see it so that the results are predictable. This is a good very to prevent your self from shooting in your foot.
2. Make sure generation of N numbers can accurately generate the desired quantity.
3. If the random number can specify bounds, make sure we can write a regression test to ensure boundary conditions.
4. If the random number should not be repeated, make sure that is covered with a regression test case to get a good degree of confidence.
5. Random number generations can some times get really complicated, so we should try to load test the code to generate millions of values with different seeds to ensure it meets the desired response time
"How would you test program to generate first n random numbers" lol.
What are your graduation degrees folks? There are some GBs of papers testing randomness, I wrote one of them. :)
Please check en.wikipedia.org/wiki/Randomness_tests for initial ideas. Then get some ideas on Statistical Hypothesis testing.
This is a very tricky question. I think the question really tries to see if you include testability as factor when developing software. Having said that there are couple of ways to test this software
- VJ October 27, 20061. As a part of the random number make sure you can seed it so that the results are predictable. This is a good very to prevent your self from shooting in the foot.
2. Make sure generation of N numbers can accurately generate the desired quantity.
3. If the random number can specify bounds, make sure we can write a regression test to ensure boundary conditions.
4. If the random number should not be repeated, make sure that it is covered with a regression test case to get a good degree of confidence.
5. Random number generations can some times get really complicated, so try to load test the code to generate millions of values with different seeds to ensure it meets the desired response time
6. To ensure that the code is not using a specific os specific function , ensure testing it on different platforms (linux, win 98 etc.) if this is a application or test the code on multiple browsers if it is a webapplication