The n-back task is a cognitive training exercise that measures working memory and attentional control by requiring participants to recall a sequence of stimuli presented at various intervals. The task involves identifying whether the current stimulus matches the one presented 'n' steps earlier in the sequence, making it a useful tool for assessing executive functions related to memory and attention.