It's a template that searches an array of data for a specific value, and returns that values location within the array. Type t can be any one type, at any point in time. In this case, it is an int, it is looking for int 3 in int *data, and returns it's position (3).
Look up templates for more info. The main point of templates is that this code will work if you have an array of ints, doubles, bools, or puppies.
int data[size] = {0,1,2,3}; declares an array of ints with a size of... size (which is equal to 4 in this case), and initializes those values to 0-3, so that data[x] == x You don't always have to make the array location equal to the value (that would be kinda redundant), but in this case, the author did choose to.
template <class T> says that the following template will take 1 data type that is unknown to the programmer. It is referred to as class T. It doesn't matter what T is, but it has to be one thing, so int search (T *data, int size, T value) could be (int, int, int), or it could be (float, int, float), or (puppy, int, puppy).
Both of the exceptions are derived from the base exception class, the first catch statement tries its hand at catching what is thrown, and because it can catch everything, it catches everything. If you were to put the first catch clause at the end of the program, you would see more interesting things.
I believe Exception is the parent and MemException, IOException are sub-classes ? So usually for exception handling it is to catch the most specific and if there isn't any, it moves "up" the hierarchy until it find the parent of all and that is Exception.