Annoying check engine light & minor problem won't pass emissions test

It really would help us if you had included what year the Corolla is, how many miles are on it, and which engine it has. Manual or Automatic might sometimes make a difference.

That check engine light code would be very helpful also.

Regardless of what year Corolla it is, it most likely only has 2 O2 sensors.
They typically cost between $50 and $150 each, and you should only need to pay 1 hours worth of labor to install them. So, tops, you should be paying about $450 for both.

Hesitations, however, can be caused by so many different things, I can’t list them all.
Here’s my short list, however:

MAF Sensor.
Dirty Throttle body sticking.
Faulty EGR, or controlling solenoid.
Faulty spark plugs or ignition wires (when was the last time you had these replaced?)
Faulty distributor cap or rotor, or ignition coil stick.

BC.