Compinvesti-prog-quiz

From Quantitative Analysis Software Courses
Jump to navigation Jump to 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:

  • 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.
  • 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).
  • 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.
  • 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.

Ensure that you have the following Unix competencies:

  • Open a text console on your local machine. Use "ssh" to connect to a remote unix machine.
  • Use "scp" or "sftp" to copy a file from your local machine to the appropriate directory on a remote machine.
  • Type in a single Unix command line that will do the following: Read in a file containing numbers, one per line. Remove duplicate lines. Output the remaining lines, sorted to a file named "output.txt"
  • Type in a single Unix command that will recursively copy all the files and subdirectories in one directory to a new directory.
  • Type in a single Unix command line that will search a file for all lines that contain the text "Tucker is Great!" and print them out. The search should not be case sensitive.

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