How to check if jQuery is loaded and what version?

To check if the Jquery is loaded or not and version of the loaded Jquery, use following code snippet( found it on stackoverflow)