In both of these example algorithms, the Classical one is restricted to a single bit of output, while the Quantum one is allowed to use information exposed from multiple bits. There is no question that more information can be carried by more bits, so it is not surprising that an answer can be obtained faster by measuring more than a single bit in the Quantum algorithm.
If a Classical algorithm were allowed multiple bits of output, for example, it could also produce the solution to the Bernstein-Vazirani computation in a single call. Rather than having to set one bit at a time at the input register across multiple calls, the input could have all bits set to one and read the output of all bits at once, and give the result of an AND operation revealing the secret string.
If the Quantum versions were also restricted to only using a single bit of output, they would not provide any speed up over the Classical versions. So how are these fair performance comparisons between Classical and Quantum computing?
An example Deutsch-Jozsa circuit for a "balanced" function:
░ ┌───┐ ░ ░ ┌───┐ ░ ┌─┐
q0_0: ──────░─┤ H ├─░───■────────░─┤ H ├─░─┤M├──────
░ ├───┤ ░ │ ░ ├───┤ ░ └╥┘┌─┐
q0_1: ──────░─┤ H ├─░───┼────■───░─┤ H ├─░──╫─┤M├───
┌───┐ ░ ├───┤ ░ ┌─┴─┐┌─┴─┐ ░ ├───┤ ░ ║ └╥┘┌─┐
q0_2: ┤ X ├─░─┤ H ├─░─┤ X ├┤ X ├─░─┤ H ├─░──╫──╫─┤M├
└───┘ ░ └───┘ ░ └───┘└───┘ ░ └───┘ ░ ║ ║ └╥┘
c0: 3/══════════════════════════════════════╩══╩══╩═
"Garcia-Escartin, Juan Carlos & Chamorro-Posada, Pedro. (2011). Equivalent Quantum Circuits" http://arxiv-export-lb.library.cornell.edu/pdf/1110.2998
Rule II: Control Reversal, Corollary II.A states:
CNOT gate with four H gates, one before and one after the control and one before and one after the target, is equivalent to a CNOT operation where control and target are exchanged.
So the above circuit can be transformed into the following:
░ ┌───┐ ░ ┌─┐
q0_0: ──────░─┤ X ├──────░─┤M├──────
░ └─┬─┘┌───┐ ░ └╥┘┌─┐
q0_1: ──────░───┼──┤ X ├─░──╫─┤M├───
┌───┐ ░ │ └─┬─┘ ░ ║ └╥┘┌─┐
q0_2: ┤ X ├─░───■────■───░──╫──╫─┤M├
└───┘ ░ ░ ║ ║ └╥┘
c0: 3/══════════════════════╩══╩══╩═
And a CNOT gate with a control that is always |1> is equivalent to a NOT gate:
░ ┌───┐ ░ ┌─┐
q0_0: ──────░─┤ X ├─░─┤M├──────
░ ├───┤ ░ └╥┘┌─┐
q0_1: ──────░─┤ X ├─░──╫─┤M├───
┌───┐ ░ └───┘ ░ ║ └╥┘┌─┐
q0_2: ┤ X ├─░───────░──╫──╫─┤M├
└───┘ ░ ░ ║ ║ └╥┘
c0: 3/═════════════════╩══╩══╩═
So the original circuit behaves like a circuit with no superposition and no entanglement, but simply flips and measures the bits in parallel. Needless to say that a classical circuit can do the same thing.
Below is a Quantum circuit that does maintain superposition and entanglement, doesn't use the "input" register as additional output data, but is restricted to only measuring the single "output" qubit (same restriction as classical circuit):
┌───┐ ░ ░ ┌───┐ ░
q0_0: ┤ H ├─░───■────────░─┤ H ├─░────
├───┤ ░ │ ░ ├───┤ ░
q0_1: ┤ H ├─░───┼────■───░─┤ H ├─░────
└───┘ ░ ┌─┴─┐┌─┴─┐ ░ └───┘ ░ ┌─┐
q0_2: ──────░─┤ X ├┤ X ├─░───────░─┤M├
░ └───┘└───┘ ░ ░ └╥┘
c0: 1/══════════════════════════════╩═
The measured qubit is a superposition of possible outputs, so for a balanced function could be measured as a 0 or 1. Therefore it may be necessary to evaluate the circuit multiple times before a 1 is measured. Even measuring a 0 many times in a row does not allow one to conclude the function is constant rather than balanced.