Compinvesti-prog-quiz

From Quantitative Analysis Software Courses
Jump to: navigation, search

Here's a self test you can take to see if you have strong programming skills. For each of these questions, feel free to use your programming language of choice. The questions are progressively more challenging:

  1. Write a program to generate 100 random integers between 1 and 100. It should generate exactly the same numbers each time you run it. Bonus: If you wonder whether the distribution should be normal or uniform, give yourself extra points.
  2. Write a program to sort a list of numbers provided on standard input (for instance, the numbers you generated above). You are NOT allowed to call external routines to do the sorting for you. After sorting the numbers, print them out. Focus on a simple method (not an efficient method).
  3. Write a program that can read in a list of words and convert each word into an integer, and a separate program that convert integers into words. The program should work with words up to 10 characters in length. It should generate integers in the range 0 to N^10, where N is the number of characters in the alphabet you are using. If N=26, then your maximum value would be 26^10 = 141167095653376.
  4. Write a program to discover the answer to this puzzle:"Let's say men and women are paid equally (from the same uniform distribution). If women date randomly and marry the first man with a higher salary, what fraction of the population will get married?"

You should be able to complete #1 in less than ten minutes, #2 in less than 20 minutes, and #3 in less than 45 minutes. Even if it takes you longer than this, it is OK, but you should plan extra time for the course.

If you cannot complete these questions you should not take the course.