It is impossible to determine the state of GPIO on most Pi (except by measurement).

It is possible with the Pi4 and I have written a Python3 library (based on RPi.GPIO) which does this and a program gpioread which shows this and the actual programmed function/state.