Final Exam Practice Problems
  1. Write a function that accepts a two-dimensional array of integers, and arrange the elements of it in such a way that the smallest value in each column is in the first cell.  (The remaining items in the column can be in any order).
  2. Write a function that accepts a two-dimensional array of integers, and returns true if the array is a "magic square."  In a magic square the row, column, and diagonal sums are identical.
  3. Write a function that accepts a 9 by 9 two-dimensional array of integers, and returns true if the array contains  a valid solution to a Sokoban puzzle.
  4. Write a program that reads a text and converts all its uppercase characters to its lowercase, leaving non uppercase characters unchanged.
  5. Write a program that copies all characters from the standard input to the standard output, except that each newline character is preceded by two characters "\n" and each tab character by two "\t", so that newlines and tabs become visible.
  6. Write a program that reads a sentence and prints the frequency of each of the vowels and the total count of consonants.
  7. Write a boolean function checkRandomGrid that accepts a two dimensional array as an input parameter and the size (an integer). The function returns true if the grid meets the requirements for a board in the memory quiz game. That is, it contains each integer from 1 to size*2 two times.
  8. Write a program that reads words up to 20 characters long from the console, one per line, and after each word displays the number of vowels it contains. Input is terminated by end-of-file.
  9. Write a program that reads words up to 20 characters long from the console, one per line, and displays the word with any leading and trailing blanks removed. Input is terminated by end-of-file.
  10.  Chapter 7 programming problem 10 (mayor race)
  11. slo baked bakery problem
  12. Enhance the hurkle program so after every move it displays the board showing the position of all guesses so far.
  13. Hot Potato
  14. Find the prime numbers from 1 to 500 using the method of the Sieve of Eratosthenes
  15. Matrix X
  16. In cryptography, a substitution cipher is a method of encoding by which units of plaintext are replaced with ciphertext, according to a regular system.
    Substitution of single letters separately ("simple substitution") can be demonstrated by writing out the alphabet in some order to represent the substitution. This is termed a substitution alphabet. The cipher alphabet may be shifted or reversed.
    Using this system, the keyword "zebras" gives us the following alphabets:
    Plaintext alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ
    Ciphertext alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY

    A message of
        flee at once. we are discovered!
    enciphers to
        SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!

    Traditionally, the ciphertext is written out in blocks of fixed length, omitting punctuation and spaces; this is done to help avoid transmission errors and to disguise word boundaries from the plaintext. These blocks are called "groups", and sometimes a "group count" (i.e., the number of groups) is given as an additional check. Five letter groups are traditional, dating from when messages used to be transmitted by telegraph:
        SIAAZ QLKBA VAZOA RFPBL UAOAR
    If the length of the message happens not to be divisible by five, it may be padded at the end with blanks.

    Write a program that accepts as input a keyword and a line of plaintext and produces the encrypted ciphertext.