Is it possible to ping a sensor, like DHT22 or 18B20, to check for connection. I want to do an error check in
void setup() and make sure all sensors are connected properly.
There is no simple "yes" or "no" answer to this.
You need to check the datasheets and libraries for your chosen devices and see what is available. Many libraries will have
begin() function, which may, or may not, return whether the device is working.
Many may just lock up waiting for communication, and there's not a lot you can do with that short of reprogramming the library to work differently.
Some (especially analog sensors) will return values from their reading functions that are far outside a tolerable range that you could assume indicated a malfunction.
For I2C based sensors you could use a variant of the I2CScanner sketch to look at what addresses are in use before attempting to use the sensors themselves.
Other protocols may have a similar system you can use to examine what is on the bus.
There isn't one answer for all sensors. Some may implement a self-check; if not, an operator could provide a specific environment at startup, which setup() would test for. Otherwise, about all you can do is a sanity-check on the output.
DS18b20 - the Dallas/Maxim one-wire digital thermometer, for example, has a specific value immediately after reset; you could check for that before commanding a measurement. Or simply take a sample and make sure it "makes sense". The specific tests available depend on what a given sensor implements.