The part of the sentence underlined below may contain an error. Choose the option that replaces the underlined part with the grammatically correct choice.
He had not scarcely entered when I shouted.
Words like 'scarcely' and 'hardly' are negatives on their own. Putting 'not' with them doubles the negation, which is a grammar error. The idiom is 'scarcely ... when'.
'Scarcely entered when' is the sentence you want.