Quiz for Chapter 7

Let's quiz ! If you haven't read the lesson, you had better do it now before starting.

Theory (15 minutes. Each scores 5)

  1. What is an array ?
  2. What is it for ?
  3. How is the declaration ?
  4. Explain how to use it !
  5. How can we declare two or more dimension in array and explain the usage.
  6. Suppose we have n : array[char] of byte; Is it valid ? Explain.

Practices

A. Easy (10 min)

  1. Make a Pascal triangle, example :
       Input  : 7
       Output :        1
                      1 1
                     1 2 1
                    1 3 3 1
                   1 4 6 4 1
                 1 5 10 10 5 1
                1 6 15 20 15 6 1
    
  2. Suppose you have an array 100 elements of random numbers. Find its maximum and minimum value of the elements.

B. Intermediate (20 min)

  1. Make matrix operations : addition, subtraction, multiplication and division. You may limit the maximum dimension of the matrix.
  2. Make a menu that highlights the selection. User can press up and down arrow and press enter to make a choice.

C. Challenge (45 min. Choose one of these)

  1. Make a jackpot game. It has 4 digits. Each digits is represented by numbers. Jackpot can have 4 players to play. Each players has $500 at start and must place their bet of $20 every game. Winning points :
    IfBet returned plus bonus
    Any two numbers are the same10%
    Any three are the same25%
    All four numbers are the same100% (bet doubled)
    All four are in sequence e.g. 1 2 3 4 or 5 4 3 250%
    All four are even or all odd e.g. 1 7 5 3 or 2 6 4 85%
    All four are prime numbers10%
    Two numbers are the same and the other two are the same too75%
    None of abovebet lost
    Remember, in one digit, possible primes are : 2, 3, 5, and 7 only. Example :
    SequenceBonus
    1 1 2 275%
    2 1 2 175%
    2 1 2 225%
    9 5 3 75%
    7 2 3 510%
    4 3 2 150%
    1 8 3 2lost
    Players lose if he/she has less than $20 and cannot continue the game. The winner is who can stay after all players are gone.
  2. Make a blackjack game for 4 players. Players put their bet in the pot. The winner get the pot. Initially, players has $500. Each bet minimal $5. Players lose if he/she has less than $5 and can not continue the game. The winner is who can stay after all players are gone. Winning rank :
    1. Instant blackjack (Ace of spade and Jack of spade)
    2. Blackjack (any Ace and jack of the same pattern)
    3. Blackjack (any mixed ace and jack)
    4. Indirect blackjack (all summed up of 21)
    5. Bingo (5 cards already but is 21 or less/not burnt out)
    6. Any number (the bigger the score, is the winner)
    If you have two or more players won with the same rank, you should divide the pot equally. If all is burnt (all cards are 22 or up), then there are no winner, and the pot stays, but players should place another bet in the pot for the next game. Hint : Heart ASCII code is 3, Diamond is 4, Club is 5, and 6 for Spades.
  3. Make a poker game. The rule is the same as blackjack, but you may raise, drop, or follow. (Just like normal poker game)
  4. Space invader revisited.
    Last time you made space invader. Now you make a full version of Space Invader with matrices of enemies. You may extend it with bonus stages or UFO. All rules remain the same.

Good luck !


Where to go ?

Back to chapter 7
Advance to chapter 8, about strings
To lesson 1 contents
My main tutorial homepage
My programming links
Contact me here

By : Roby Joehanes, © 1996, 2000