S&T interview question

When to use @@IDENTITY and when @SCOPED_IDENTITY