Is it possible to assign attributes to different roles?
Yes. There many ways to go about this but the Profile2 module is one that covers the entity field data (variables) per a specified user role. 


  Designed to be the successor of the core profile module, which is
  deprecated for Drupal 7. In contrast to the deprecated module this
  module provides a new, fieldable 'profile' entity - leverage the power
  of fields!


Your your student role can be assigned to have to have a student profile which a Teacher can edit, but only a student can view. It has the additional permission View Own Profile... which should restrict students from seeing other profile pages.