Make your own free website on Tripod.com

Random Object Questions (4 days)



  1. Write a program that will print out 10 random numbers between 1 and 100.
  2. Write a program that will let you enter a low number and then enter a high number and will then print out a random number between the two (inclusively)
  3. Write a program that fill an array with random numbers between and 50
    void fill(int[] ar, int ct)
  4. Write a program that will generate 50 random numbers between 1 and 100 and will then print out the sum, mean and average deviation.
  5. Write a program that will pick a number between 1 and 100 and then let you guess the number. It will tell you that you got it (and end program) or tell you your guess was too high or too low and let you continue guessing.
  6. Write a function that will pick 10 random numbers between 1 and 100 with no repeats and return them in an array.
    void fill(int [] ar)
  7. Using function above, write a program that will pick 10 random numbers between 1 and 100 and then will pick 10 others between 1 and 100 and tell if there was at least 1 number in common. Then loop through this 10000 times and tell what percent of the time there was at least one number in common.
  8. Monte Carlo Approximation - If I start with 48 dice and roll them and remove all 2's, how many rolls will it take until all the dice are removed. Run simulation (with a loop) 1 million times and find the average of how many rolls it would take on average.


HOME