Something like this will do it. It will also dynamically add new columns for new sub ids without you needing to worry about it.
DECLARE @cols nvarchar(MAX);
--get the list of subids from the table
SELECT @cols = COALESCE(@cols + ',', '') + '[' + CAST(SubId AS nvarchar) + ']' FROM (SELECT DISTINCT SubId FROM table);
Declare @sql nvarchar(MAX) = 'SELECT StdId, FEID, ' + @cols + 'FROM
(
SELECT * FROM table
)t
PIVOT
(
MAX(MarksObtained) FOR SubId IN (' + @cols + ')
)p';
EXECUTE sp_executesql @sql;