Interview Question: Randomize This

Sample Question #21 (programming)

I give you a text file, x.txt, which has millions of records with three columns in each record:

   ID, age, income

The records are sorted by ID, and no two IDs are the same.

Now, write a short program in each of the following languages to pull out 10,000 randomly selected records from x.txt. Put these 10,000 randomly pulled records in an output file called y.txt.

  1. C++
  2. Visual Basic
  3. Matlab
  4. Perl
  5. Python
  6. SAS
  7. R or S-Plus
  8. UNIX shell script

(Comment: how many programming languages do you know?)

Advertisements
This entry was posted in Sample Qs. Bookmark the permalink.

One Response to Interview Question: Randomize This

  1. Wu Chao says:

    can work on C++ and Matlab. Know something about perl and python. visual basic, cannot recall it. SAS, heard of it from my roommate. R or S-Plus, no idea. UNIX shell script, know the command, but need time to play withe parameters and formats.Sigh, a lot to learn.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s