Bob tells Mr. Sam
that there's a hypothetical computer program called Hyp. Mr. Sam secretly inputs his number into Hyp. Bob can input two sets into Hyp. If the secret number is in the first set, Hyp displays a $0$. If it's in the second set, Hyp displays a $1$. And if it's in neither Hyp randomly displays either a $0$ or a $1$.
Bob's first question is then: "if I input 1 to 9 as the first set and 10 to 18 as the second set, will Hyp display a $0$?" If Mr. Sam answers "yes" - his number's in the first set, "no" - it's in the second and "I don't know" - it's in 19 to 27.
Bob's second question is: "taking the first three numbers as the first set and the next three numbers as the second, will Hyp display a $0$?" This narrows it down to three numbers and the last question uses the first number as the first set and the next as the second set yielding the secret number.