views:

469

answers:

10

I've been asked to tutor Pascal to a kid. Despite never seen Pascal before I did manage to get a tutorial and I now know enough to teach him.

I am writing you guys to see if anyone can point me out some basic exercises that involve simple algorithms, Something like: Sort this array, find the average, etc...

It can be in any language, I just need to find some exercises so he can work out.

A: 

Despite being a Delphi fan, can I ask why you would want to teach Pascal? It is a language used by no-one (Delphi is very far from Pascal). You would be much better off teaching something like Python (and I am not a Python fan). If he is a small child and likes to have fun, try him on Scratch.

But if you really need some Pascal exercises, see if you can get hold of a copy of Software Tools In Pascal, the best Pascal book I know of, and implement a few of the simpler tools.

anon
He is taught Pascal at school, and has an exam in one month. Not my choice :)
Sergio
Some school! You may want to have a word with is parents.
anon
Pascal *used* to be a staple of computer science education. Of course, you're much more likely to see Java being used. However, I have seen schools that use Ada for intro programming, so anything is possible. ;)
htw
If the exam is in Pascal, you should teach in the spirit of the exam...
Liran Orevi
I would also must rather choose Java or C# than Python. The chances to see python out in the wild in education or average corporate life are not that high.
Marco van de Voort
I just don't understand the reaction *against* pascal. It's pretty clear that learning a language is a bridge to the next, so why be so negative about one in particular, especially one that has been demonstrably useful as a teaching language? Fashionistas exist in computer science, too, I guess.
Argalatyr
+5  A: 

Here is a list of 15 Exercises for Learning a new Programming Language from freelance that expands on basic techniques used in many languages and can give him a feel of the new lanaguage he's learning

TStamper
nice one, thanks
Sergio
+5  A: 

I am going to address this in a (mostly) language-agnostic fashion. After teaching him print statements and flow control (if statements, for loops, etc.), my suggestion would be to start off with simple ASCII-art patterns that can be generated by for loops and such.

For example, how would you print half of a tree, like this?

*
**
***
****
*****
******

Alright, now how would you print a full tree, like this?

     *
    ***
   *****
  *******
 *********
***********

Now try drawing a rocket ship. ;)

These are great for most kids because they are visual, the results are enticing, and the exercises will impart the importance of loops and eliminating redundancy.

htw
+3  A: 

For sorting algorithms see link. It is a Wikipedia article - a little general information on sorting algorithms, but down below you have links to every type of them individually, and algorithms in pseudo code (and some languages).

As far as "find the average" goes, when you've got "n" elements:

SUM=0.
DO i=1,n
 SUM=SUM+element(i)
ENDDO
AVRG=SUM/n

Also, for learning purposes and thinking Project Euler is very nice.


Also, do take a look at this question: Where can you find fun/educational programming challenges? I didn't want to copy paste everything, but it has a bunch of links with stuff for exactly what you're looking for (programming exercices). And this: Algorithm Questions Website, What are your programming exercises?. You'll probably find something you think he'll be interested in in there.

ldigas
+1 for Project Euler
Liran Orevi
Nice mix of links. Surely there is something useful to be found among them for students of various levels.
John Y
+2  A: 

classic one:
Let the program choose a random number, the purpose of the game is to find the number through elimination. if the user guesses a lower number the program says its too low, if its higher it says its too high.

shoosh
+1  A: 

Tic tac toe game with "AI" (that is predefined moves) and text-graphics is a nice project.

Liran Orevi
+1  A: 

Add some fun to it. A good one to start with:

Paper-Rock-Scissor Game

User enters P, R, or S

Program responds that you win, lose, or tie

More advanced features: track record, winning %, win/loss streak

keeper
A: 

If you know any C/C-like language it's basically the same:

  • { } are begin end;
  • == is =
  • = is :=
  • a function that returns nothing is a procedure.
  • a function that returns something is still a function.
  • int is Integer.

The rest is almost the same. The syntax is a bit different, but not very different.

You would need to know which Pascal they're using, and what they taught them to be sure you're not wasting your/his/her time.

Osama ALASSIRY
A: 

Doing basic operations on a doubly linked list is also a classic.

Marco van de Voort
A: 

Early exercises I learned from include drawing the Mandelbrot set (computers are much faster these days so you don't immediately have to worry so much about optimization) and implementing cellular automata like the Game of Life.

Of course, if this is practice for a school course, exercises like this will only be helpful if the test is likely to test a similar domain of knowledge/skills.

Argalatyr