A classical solution to the quantum combination lock

One way to figure out the secret 4-digit code is to follow the algorithm given below.

Set all guess qubits to 0, except the first one
Measure result after applying the black box
If the answer qubit is 0, the first digit of the secret code is 1 (because the answer changed); otherwise the first digit is 0
Repeat steps for every digit in the secret code

When we look at the example from the previous page, we will obtain the secret code 110 the following way (use the previous and next step buttons to toggle through the code).

1001 1000 X X 01010100 X X 00110011 X X

While you can easily try more than 3 combinations, it is not possible to find out the secret code with less than 3 measurements.

In general: Following the algorithm above, how many guesses does one need to figure out a 5-digit secret code?