Does iCloud Backup store WiFi password?
iCloud Backups of iOS devices include the Keychain of all saved passwords on the device, including WiFi network passwords, however that keychain is signed against the UDID (The Universal Device Identifier, a unique ID for your device).

If the UDID does not match (examples being if your device was replaced by Apple due to failure or you purchased a new one), than the key store will not be able to be opened, and your passwords will need to be re-entered on the device.

Macs using iCloud backups do not back up the Keychains at this time.