# Construc a DFA for given language

The given language is this. $$L = \{a^nb : n \geq 0\}$$ Let $M = \left<\{q_0,q_1,q_2\},q_0,\Gamma=\{a,b\},\delta,\{q_2\}\right>$ be a DFA, where $q_0$ is the initial state, $q_2$ is the accept state.

For this language is this DFA accept it??

The trap state is for any input that is greater than any string in $L$ such as $aabb.$

You need to add transitions $q_2\overset{a,b}\longrightarrow q_2$ to make it a true DFA, but otherwise it’s fine.