Sample Practical Question

The exam will contain 1 or 2 questions like this, depending on how many parts it has and how long it takes me to solve it. This one took me about 20-25 minutes to write, and has about 40 lines of code, so I think this would be about half or 2/3rd of an exam. Remember that you have to produce a decently working version of an application in the given amount of time, so do the things that you are certain of, and then go to the parts that did not work.

What you need to do is to create a simple guessing game. In this game, the computer thinks of a number between 1 and 200 (using the Random class - see the sample code posted below). The objective is to let the user guess this number in 5 tries. In each try, the system should response saying whether the guessed number was too small or too big, or if the guess was correct. If the number of tries is exceeded, then you whould notify the user saying the game is over and he/she lost.

Points distribution and sub-problems:

Starting code

Here is a simple code that you can start with:

  1. VB version
  2. C# version