This sounds like you need something that will limit the MacBooks to an allowed "white list" of web sites, which you set up. ("White list" is the opposite of "black list", which is when you set up a list of web sites that are not allowed.)
You might be able to use the built-in OS X Parental Controls system... go to Apple menu > System Preferences > Parental Controls.
Apple has some documentation on Parental Controls here, which includes the picture below: see the "Allow access to only these websites" button.
I would go with Ashley on this, parental controls allow you to whitelist certain sites that you want the students to use. This also keeps them from stumbling around sites that may be designed to take advantage of students trying to research common questions used in the learning process.
Setting the machines up with a Guest Account with Parental Controls enabled prevents the students from saving anything to the machine as the local files are wiped with each logout. It doesn't prevent them from transferring items like tests, or research to the instructor via a drop box. (you can also prevent them from sharing with each other) It also allows you to log all activity if you have concerns about a student.
The easy way: The shareware web browser iCab (20USD) [icab.de] has a kiosk mode that allows an admin to blacklist and whitelist sites. It also allows to set blacklisted words a user can input into text-fields, such as you would find in search engines. These features only affect user while iCab is in the kiosk mode and user cannot exit kiosk mode except by password set by admin. In kiosk mode user cannot access other applications.
Another way: Otherwise you can edit the hosts file [/private/etc/hosts] (admin privileges required). Example, to block the site, example.com, you would input:
or block an ip address:
Make sure you make a backup of the hosts file before you attempt to change anything in it.