The LDR is absolutely necessary if you want to sense light or dark. It changes resistance with the amount of light it receives, hence its name--Light Dependent Resistor
Yes, the circuit can easily be modified to work with a variety of sensors, for example a thermistor could replace the LDR for heat or cool functions. Yes, an AC signal could be applied resulting in an output of a square or rectangular waveform of constant amplitude. Since thjere is no mention of the amplitude, waveshape, or frequency that is about a generic answer as can be.
This link is a very good read on the use of comparators.