Essentially one is declarative, whereas one is programmatic. The TagExtraInfo class was introduced before
JSP 1.2 and apart from existing for backwards compatability, there is another good reason for it.
Imagine that you are trying to implement a copy of the <jsp:useBean> tag which looks up an object and introduces it into the page as a scripting variable. There is no way that you can know in advance what type (class) that variable might be and this, therefore, means that you can't use the <variable> tag to define the variable. Instead, you must use the TEI class.
Basically, the <variable> attribute is useful if you know the type of the variable, whereas the TEI class is useful if you want to programmatically determine some of the variable's properties.
Hope that helps and good luck with the exam.
Regards
Simon