Why are ultrasounds used for producing images of body organs? Low frequency waves can penetrate better than high frequency waves, then why are high frequency waves used in ultrasounds for sharper images?
Similar is the case in detection of flaws in metal blocks.Why are high frequency waves used here instead of low frequency waves?
 A: Ultrasound frequencies for diagnostic imaging range from about 1-10 MHz. Lower frequencies tend to be used for imaging of deeper tissues because they penetrate further as you rightly say. However, penetration is only one consideration. The "sharpness" of the imaging depends on the wavelength. Basically, you will not be able to resolve structures that are comparable to or smaller than the wavelength that you are using because diffraction effects will blur the results.
The speed of sound in human tissues is about 1500 m/s (it varies slightly between different types of tissues, which causes reflections, which is how ultrasound actually produces images). Thus the wavelengths at 1 and 10 MHz are 1.5mm to 0.15mm and it is easier to resolve fine details with ultrasound for structures nearer the "surface" of the body.
Another issue is that to image structures at a range of depths then a range of frequencies needs to be used in order to ensure that sound penetrates to, and is reflected off, interfaces at a range of depths.
